Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Bram de Greve, posted on November 08, 2004




Image Description, by Bram de Greve



The poem, it was the poem... and the cheddar. It left me no choice but to also submit an IOTD, so here I am...

Let's see... more than three years have passed since my previous Image Of The Day, too long to remember! A lot of things have happened, too... except working on said raytracer. Then Jacco Bikker (aka The Phantom) started his raytracing column - an excellent opportunity to get back on track myself, I thought. So, I wrote a little tutorial and started coding again. The result is displayed above (pure raytracing, no global illumination yet). What you see are reflective/refractive spheres, walls and floor. Particularly noteworthy are the transparent spheres and the bumpmapped water... Our three gentlemen, Mr. Snell, Fresnel and Beer explain what's so special about them:
  • Mr. Snell: "Both the sphere and the water are not only transparent, but also have an index of refraction (n = 1.5 and n = 1.33 respectively). Thus, the rays of light must be refracted by my law." That's done here (well, at least for primary rays, shadow rays don't obey this). Observe the lens effect in the sphere and the distorted floor through the water; this is what my tutorial "Reflections and Refraction in Raytracing" is about.

  • Mr. Fresnel: "In most ray tracers, reflectance and transmittance (reflection and transmission coefficients) are given by hand. And maybe that works fine for you, but I don't like it because it's not natural. Here I have equations that calculate the reflectance and transmittance on interfaces between two materials with different indices of refraction, and for every angle of incidence. You should use them." And that's exactly what I've done for the glass sphere and the water. Well, not really, because I didn't like the idea of simulating polarised light, so I cheated with a simplified equation proposed by Schlick (if you like French, you'll find it as equation 3.24 in his Ph.D thesis). Anyway, notice the reflections on the water and on the sphere.

  • Mr. Beer: "In many ray tracers, the colour of transparent objects is totally determined by the surface material. In case of transparent solid, rays are tinted twice (on incident and exitant transmission). Of course, that's not correct: It's not the *surface* that determines the sphere's color, but the material *inside* the sphere. This is also true for water: it's not the water's surface that tints the light, but the water itself. You should alter the light intensity based on the distance traveled through the medium. That's only obvious: if you travel through a thick plate of glass, light will be tinted more than it would through a thin plate." So, I've implemented that as well: if light travels through a medium, its intensity is affected by Beer's law. The surface of a material can still affect transmitted light (e.g. for a coloured coat layer), but in the above scene this surface colour is set to white (this is also explained in part 3 of Jacco's column).

  • To illustrate the effect of Beer's law, I rendered the same scene with more dense glass and water (higher extinction rate in the exponential decay term). In particular, notice how the three coloured spheres quickly disappear in the water, and how you can see the reflections better in this rendering. That's not because the sphere and the water have become more reflective, but simply because the background on which they're displayed has become darker.

    So, what's next? Global Illumination I suppose... I've been hacking a photon mapper today, but it's too early to show any results yet... but that's only an excuse to post an IOTD later :)

    Anyway, that's it for today. Happy coding, folks.
    Bram de Greve

    P.S. Oh, I almost forgot: I've spotted an error in my tutorial, can you find it too? :) I'll send the corrected version to flipCode later, with a special mention for anyone who finds the mistake.

    P.P.S. Thanks Thomas ;)


    [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]

     
    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
     
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
     
    Nicholas Chapman

    November 08, 2004, 01:50 AM

    Wow, great stuff.
    The bottom left water shot in particular is really beautiful.

     
    Daniel Talagrand

    November 08, 2004, 03:00 AM

    Yep, great work, although the water looks too much like plastic-wrap. You might also want to consider adding some sort of octave-based distortion filter on the water, to make the surface seem slightly more realistic.
    Additionally, the lighting on the walls (especially where they join) strikes me as being rather odd.

    Other than that, looks great! Puts my rather pathetic raytracing "excursions" to shame ;)

     
    davepermen

    November 08, 2004, 03:25 AM

    looks great! really great!

    can't wait when even your shadow rays and all "obey the rules". (when we see shots from the photon map, that is:D)

     
    Bramz

    November 08, 2004, 06:32 AM

    Thanks.

    The lack of any caustics doesn't help the realism of the water either :) So, I guess that will improve a lot when the photon mapping is included. Have you some reference links to this octave band distortion filter?


    the lighting on the walls isn't odd. It's regular diffuse lighting. The "sharp" corners are perfectly normal if you consider the lack of any global illumination. Again, that should improve with the photon mapping :)


    Greetz,
    Bramz

     
    NCCAChris

    November 08, 2004, 08:45 AM

    Its the shadow that looks wrong tbh - you have shadow on the left wall but absolutly none on the back wall. It looks like you have two light sources in the room - but even so - the back wall should be darkened by the occulusion of one of the light sources....

    other than that - good work!

    btw - how have u done the water? is it a heightmap from perlin noise?

     
    Bramz

    November 08, 2004, 10:01 AM

    There are three point lights in the room: key-, fill and back light.
    http://3drender.com/light/3point.html

    The key light is at the right from the camera near the ceiling. It's the main light source. This light is also near the right wall and that's why the back wall is so bright and the right wall is not.

    The fill light is near the floor and on the left of the camera. This is the one causing the shadow on the right wall. On the right wall this is very visible because this wall is mostly lit by this fill light. On the back wall this shadow almost isn't visible because that wall is very well lit by the key light. So the shadow is drown by the key light.

    The back light is very high and in the corner (between back and right wall). This one is causing the highlight on the water (in the bottom of the image).

    So what you see is correct.
    However, I'm afraid I have choosen the position of the key and fill light rather badly. Maybe I should have swapped them.



    The water is just a bumpmap read from a bitmap.

     
    Bramz

    November 08, 2004, 10:04 AM

    thanx, I can't wait myself ;)

     
    NCCAChris

    November 08, 2004, 11:14 AM

    ahh fair enough :)

    My usual lighting setup - (I like dramatic lighting) - is usually a strong keylight just behind the camera and offset to one side and with a rim light, behind, above and offset to the object being viewed. If this is done with a strong colour (blue always works well) - it leads to some really nice visuals.

    Some really nice lighting can be seen in the unreal 3 engine videos.

    I dont really know about using point lights for fill lighting though, point lights unless far away often leads to harsh lighting. I personally would use area lights to add ambient light and soften the shadows... Spot lights are also better to direct the lighting....

    We were taught all the pro's and cons of all these sorts of lighting setups - but i personally go with what works at the end of the day...

    also check out http://www.3dluvr.com/davewilson/makingof/arach/MakingOfArach.htm

    for some funky visuals and lighting :)

     
    Bramz

    November 08, 2004, 11:21 AM

    Mmmh, that one looks nice :)

    Yeah, for some reason I've forgotton to use different colours for my lights. They're all white now. Though I remember me having a blue fill and back light once :/

    Currently, I only have point lights because I was too lazy to code the others.
    Maybe I should do it anyway :)

    Bramz

     
    Andrew Lauritzen

    November 08, 2004, 01:25 PM

    Looks great! I especially love the water in the bottom left shot.

     
    lycium

    November 08, 2004, 02:54 PM

    i'd be more than happy to help you implement bandlimited (self-antialiasing) procedural textures if you like, just ask me online sometime ;)

    ps. anytime dude ^_^

     
    Nick

    November 09, 2004, 04:56 AM

    Impressive work Bram!

    Sooner or later I have to try this myself. Are there any breakthrough technologies (algorithms) for real-time raytracing? It scales very well with scene complexity, so if we could minimize the 'constant' cost per frame it could quickly become competitive with rasterization...

    I don't know what I'm talking about. ;-)

     
    Bramz

    November 09, 2004, 06:39 AM

    Thanks!

    Well, there's some great efforts in hardware you can find here: http://graphics.cs.uni-sb.de/~sidapohl/egoshooter/

    check it out!

    Bramz

     
    This thread contains 13 messages.
     
     
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.