Archive for the ‘Personal’ Category

Ray Tracing explained 1

Monday, March 1st, 2010

I recently had an in class test on ray tracing (which I got full marks on). In order to get maximum use from all the revision I did I’ll also be flogging the subject here. So this is a series of straight forward articles on ray tracing, but first just explaining the general idea.

So what is it?

It is a method of rendering scenes usually characterised with a checkerboard floor, ultra-shiny surfaces and all perfectly sharp and crisp. The idea is very much like how light works in the real world, but in reverse. The 3d has a camera from which rays travel from.

The above diagram shows a simple ray tracing scene. The Projection Plane is the display which the rays intersect as they fly into the world. A ray intersects this plane for each pixel on your screen. The Projection Reference Point behind it is a single point in space that they originate from. This allows the rays to all fly out at a different angles.

Primary, Secondary

Rays that originate directly from the projection reference point are the primary rays and when they hit an object two secondary rays are created. One is for flying off to record any objects or lights reflecting onto the object that was hit. The other is for going through the object to record any light refracting through the object (but obviously only if the object is transparent).

When a secondary ray hits an object the above process will repeat, and repeat, and repeat slowly building a tree of all of the reflections and refractions of light that can be recorded from the original primary ray.

This process will stop if there are no more objects to hit (in which case it’s just background colour), if the ray hits a light (no point reflecting off them, you’ve just got full light), if you have set limit on the number of sub-rays to create and if the impact that the sub-ray will have on the primary ray is too small for us to notice.

The original primary ray is used to find the colour of a pixel on the screen, and to do this all we need to do is walk up the tree of sub-rays from bottom to top looking at each object in turn. This also needs to take into account the lighting on the object (diffusion, any specula highlights and ambient lighting) and the distance of the object to add fog.

End

That’s the basic model, but next time I will be writing about some more advanced algorithms used in ray tracing for making it more efficient and for making more realistic images.

the guy in red

Sunday, February 21st, 2010

Last week I was in a book, this week I’m in an Indian newspaper!

No, it’s not about me at all. The guy in the main photos is an Indian friend of mine I met in Hong Kong who wrote sent the article. It’s about his Hong Kong experiences. Instead I am the guy in red standing next to him in front of the giant Tian Tan Buddha in the background, located at the Po Lin Monastery in Ngong Ping. It’s not about me, but at least I’m in it!

If your ever in the Hong Kong area then I highly recommend visiting the monastery. You can get there via cable car with impressive views of the Hong Kong Airport and the surrounding untouched tropical wilderness of Lantau island. Although their cable cars do occasionally crash into the surrounding mountains.

Next week, I’m on the back of an envelope!

A history of Circles

Monday, February 15th, 2010

Not too long ago I uploaded my second tech demo, Circles. Very small, very simple and was built also as a tutorial for my framework.
Circles ScreenshotBut it’s history goes back a lot further then that.

The version on my site is built in Java but originally it was built in Ruby using OpenGL. It was something small I’d knocked up in an hour called Physics Balls and built for an easy-going weekly competition called the Wednesday Workshop over at SoCoder. You can find it here.

The original Circles, on SoCoder


Overall it went down like a lead balloon. “Not much of a game” was the description given, and the consensus from most users. But that wasn’t the end!

During my time at university I’ve been very priviledged to be able to work with the Greenfoot team building example scenarios, testing and creating worksheets. The software allows you to easily build games and interactive scenarios with very little code and includes an web portal, the Greenfoot Gallery, where they can be uploaded. One of the projects I uploaded was a newer version of Physics Balls: Circles, and later it was included in a combination scenario I built: the JL235 Collection (which I thought was really cool, but people weren’t that impressed).

Some of my GreenfootGallery scenarios

Last year a book was released for Greenfoot for which I was asked if I could provide my Circles scenario. So I’m in a book, WOOT! Here is the book…

Inside this copy looked as though it had been through a washing machine


and in Chapter 10 on page 157-158, is Circles!

Circles, but my name is wrong! I never call myself 'Joe Lenton'

So is that it? Of course not! For my third year project at uni I’m building a highly concurrent framework in Erlang for which I’ve also made a version for another small tutorial…

In this version each Circle is updating in it's own seperate process

Next week, the magical Square!

Arts & Crafts

Friday, January 8th, 2010

My brother recently asked me if I still had a copy of a video I made years ago. A small proof of concept video when I was building my own green screen (actually it was orange, that was all I could get for free). So I managed to track it down and reposted it on YouTube.

It’s also online at MySpace where amazingly this has almost 4,500 plays!

Next is something more recent. If you’ve played through ColdWar Chaos then you’d have seen the bombs that explode into different cat faces. These were all made using a video of one my cats, Moses. Here are the original images I made for each of her faces in the game:
moses