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


Submitted by Markus Buretorp, posted on November 05, 2004




Image Description, by Markus Buretorp



Hello, I thought I should post a IOTD for the first time of a simple demo I made. Ambient Occlusion, nothing special.

This demo trace rays distributed in a hemisphere to compute the average direction of unoccluded rays, which is an approximation of the average direcion of incident light. This is done for a finite set of points on a surface, in this case the result is encoded into a texture which is used to do soft real-time lighting.

Home page: http://sunray.cplusplus.se/?p=proj

Thanks,
Markus Buretorp


[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.
 
.oisyn

November 05, 2004, 05:41 AM

Looks nice, what speed are you getting?

.edit: You say you're computing the average light direction... why not compute an average color for every ray that hits an object, and use that as the light's color? I think that'll give some nice looking radiosity effects. You may want to define a single (average) color per object as exact color computation would be too timeconsuming. Or maybe a small cube map instead of a single average color to produce more accurate results.

Or are you doing something like that already?

 
Thomas Ludwig

November 05, 2004, 07:22 AM

nice render, though i'd like to know: exactly what is it that you do once you have the average incident radiance direction?

moreover, when you say 'soft real-time lighting', do you mean quickly recalculating the lighting or just re-rendering from another viewpoint?

[pet peeve: 'radiosity' (being a crappy, discretised, diffuse-only* gi solution) is *NOT* the same thing as 'global illumination'. neither is radiosity an 'effect', there's actual maths and physics to this, and when people just... oh nevermind, no one cares anyway...]


* unless you use clustering or higher order approximations, which are a huge waste of time, code, blood, sweat, tears and most of all skill, when compared to elegant monte carlo methods...

 
.oisyn

November 05, 2004, 10:30 AM

>> [pet peeve: 'radiosity' (being a crappy, discretised, diffuse-only* gi solution) is *NOT* the same thing as 'global illumination'. neither is radiosity an 'effect', there's actual maths and physics to this, and when people just... oh nevermind, no one cares anyway...]

I agree, but my point was that what I said basically does what radiosity does, only on a much smaller scale and with a single iteration, namely shooting rays from discrete points on the surface to collect how much light (and what color) reaches that particular point.

 
Sunray

November 05, 2004, 12:15 PM

Hi,

I precalculate the average direction of unoccluded rays and the average "intensity" (NumUnoccludedRays / NumRays). This is stored in a texture; the vector in the RGB channels and the intensity in the ALPHA channel.

The pixel shader just perform a texture read and calculate the diffuse light using lambert's cosine law multiplied by the intensity. DiffuseLight = dot(AvgVector, normalize(LightPos - FragmentPos)) * Intensity


/ Sunray

 
lycium

November 05, 2004, 12:26 PM

"shooting rays from discrete points on the surface..."

*ahem*, this isn't what discretisation is, and what you described isn't how radiosity works.

hmm, people often see corrections as being an attack (*sigh*), so i'll leave it there...

 
lycium

November 05, 2004, 12:30 PM

> DiffuseLight = dot(AvgVector, normalize(LightPos - FragmentPos)) * Intensity

so you're using the average incident light direction as the normal, then multiplying by the occlusion factor... need to work out what this is doing, and also why ;)

gonna get your program and try see what happens when the light moves... not quite sure how ambient occlusion ties in with that :)

 
lycium

November 05, 2004, 04:00 PM

hmm, now that i *really* think about it, excessive nitpicking is just stupid.

apologies ^_^

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