Archive for August, 2008

Website updates

Tuesday, August 19th, 2008

I’ve been working on this website a bit, mainly on the design side. I’ve been adjusting the colours so that the text is a bit more readable. The layout of some pages has also been changed to utilize the sidebar area, previously the archive/blog navigation was placed at the bottom of the page due to the way the original WordPress them was laid out. I also intend to use the sidebar on standard pages to make the pages look a bit more interesting, though how I will do this isn’t certain yet.

One design problem I’ve encountered is that the colours of the page look subtly different between Firefox and Internet Explorer, I have a feeling this is something to do with the PNG images that I’ve been using and the browsers using different rendering methods for it.

Here is a comparison:

Internet Explorer

Internet Explorer

Firefox

Firefox

I’ve also just noticed that the layout is also subtly different, but it doesn’t look broken in either browser so I’m more concerned about the inconsistent colours, especially in IE where the background gradient doesn’t smoothly go into the final background colour.

Update

Problem solved! It turns out that other people have also noticed this problem. The problem is that PNG files have gamma correction and store a value in the file to do this, it actually sounds pretty clever but it’s a problem for web-safe colours. With the proper tool this value can be removed to draw the PNG without gamma correction, thus making the colours constant between browsers. More information can be found here.

-Thomas

RayTracing – Day 3

Tuesday, August 19th, 2008

Reflections!

Reflections have now been added to the raytracing algorithm. In the image above I set both spheres to have reflective properties, and you can see the results for yourself. It may not be the best scene layout for demonstrating the feature but it’ll do.

Other things I’ve added is more GUI controls so that the user can see the progress of the rendering and choose different options. A popup window appears once the rendering has completed to display the rendering time. Note in the image that it’s over 4 seconds to render as it’s running in Debug mode, the published version renders the image in 1.8 seconds on the same computer.

To improve the user interface the PictureBox (where the rendering is displayed) can now display portions of the image as it is being rendered instead of needing to wait for the entire image to be calculated for any results. The last thing I added was a second rendering mode called QuickRender, this mode effectively renders at half the resolution by skipping every other pixel.

I also rewrote the program a bit. I rewrote the raytracing function to be more recursive, which was necessary to implement the reflections.

I will try to upload a build of this to my Projects page soon.

-Thomas

RayTracing – Day 2

Sunday, August 17th, 2008

The fun stuff has started now!

Here’s my first RayTracing attempt, this was to see if I could pick out the primitives with the rays I’m casting. It came out as a outline of them all. There is a plane running along the ground in the bottom half, two spheres popping out, and a light in the sky (there’s another light somewhere else too, but it can’t be seen from this angle).

Next I updated this so that instead of using “white” it uses the primitives’ material colour.

Alright, getting somewhere now! But, they’re still just outlines at the moment, this needs some diffuse lighting.

Something didn’t quite go right there. It should have been a smooth gradient transition, instead there are two extreme colours here, white and black. I tried scaling the colour values down a bit.

YES! Now this is more like it! This is looking a bit boring though, all grey? Let’s add a little bit more colour.

Awesome.

I’m happy with my progress with this, but I think I need to go back and modify the diffuse lighting calculations as I’m not entirely sure the lighting is exactly as it should be. That’s for another day though.

If anyone is interested in doing a similar project, my current source of information for this project is an article on DevMaster.Net by Jacco Bikker. I’m personally trying to use as little source code from his examples as possible and focus on just the theory, but it is there for anyone who does want to examine it. I did more or less copy the scene that he is using though so I could compare my results.

-Thomas

RayTracing – Day 1

Saturday, August 16th, 2008

Behold, the progress I’ve made in a day!

Well, not a lot to show yet admittedly. Visually I’ve just got a Form with a blank 800×600 PictureBox on it, which the raytracer will eventually render onto.

However in the background I’ve been laying out some of the framework functionality needed including some annoying mathy bits like the actual raytracing algorithms, I’ve done some of this before with my dissertation so it hasn’t been too difficult yet. I’ve also programmed in a few other trivial math things like 3D vectors and planes (no, not the flying kind). There is also a basic scene manager which can have three types of objects added to it: spheres, lights and flat planes, each with their own material colour and diffuse/reflection variables.

But as mentioned, there’s currently no actual rendering functionality yet, these are just the boring beginning steps of it. Hopefully I will have something a bit more interesting to show soon.

Sidenote: C# is a great language, I’m pretty sure its going to become my language of choice.

-Thomas

Temp agency woes, and a new project!

Thursday, August 14th, 2008

Well, I figured I should probably write something in here and actually use the website I’m paying for. (which is still looking a bit rubbish but at least the functionality is there now!)

I’ve finished my Computer Science degree now (First class honors! Woo!) and I was wanting to get a temp job this summer in IT or something before I go back for my Masters but it seems like that idea is going to have to go out the window now, I’ve tried registering with a few temp agencies and most have said that a) they don’t think they can find anything for me or b) they can, but then proceed to have never contacted me after a month… I would like to do something useful with my time though, so I was thinking of doing a small project to have finished by the time uni starts again.

I thought maybe something low-level with graphics would be interesting to do, I’ve played with basic/intermediate OpenGL before with my dissertation project and done some 2D graphics manipulation so I know I really like the graphics side of programming already. My idea is to do something like a basic ray-tracer in C# (a language which I don’t have too much experience in) and try a few effects out with that. I need to find some websites to help me out with the theory, though that shouldn’t be too difficult. I think I should try to keep regular posts on this blog to give myself a bit of pressure to actually work on it.

Hmm, not sure what else to write about, so I’ll end it here!

-Thomas