PDA

View Full Version : Using GI and Caustics Properly


Sully
01-30-2006, 09:15 AM
Hi I have a thousand questions regarding this subject but heres one thats confusing me at the moment...When setting up a scene using GI and caustics should I turn the lights intensity to 0 and let the caustics and GI take care of the diffuse and spectular lighting? In theory this should be the way to do it right? Also how do your photon maps look without FG are they quite blotchy or do they look like a occlusion pass? should they be smooth or should you be able to see the photons on the participating surfaces? and is there anyway to view the saved photon map? :eek:

playmesumch00ns
01-30-2006, 09:56 AM
You can use photon mapping for direct lighting, but it's usually a bad idea. This is because the photon map will indeed look blurry and splotchy unless you use an obscene number of photons.

I'm assuming you're talking about mental ray, in which case I believe you can view the photon map using the diagnostic modes. Alternatively you can set the photon radius very small and set the accuracy to 1, to see individual photons as little dots in your render.

floze
01-30-2006, 05:20 PM
You can use photon mapping for direct lighting, but it's usually a bad idea. This is because the photon map will indeed look blurry and splotchy unless you use an obscene number of photons.
It's a bad idea indeed, but fun to play with. If you set up your lighting for this condition (put a photon-refracting surface right in front/around your lightsource), you can play with stuff like bending lightrays and stunning volumetric effects, e.g. you could visualize a LASER ray.

Probably the most valuable effect when lighting this way is the fact, that the correlation between direct and indirect illumination will be physically correct. This gets obsolete though when using either some physical_light shader or a specially tuned regular light. If you're using mental ray for maya, try this:
http://forums.cgsociety.org/showthread.php?t=293775

playmesumch00ns
01-31-2006, 10:25 AM
Hmmm that's be kinda cool. I remember working with a guy who made coloured lights by putting an actual gel in front of the light source. Was kinda fun!

Be careful with photon mapping: it'll never be physically correct. The most accurate way of rendering in mental ray is to use the path tracing shader, but of course this is very slow.

Sully
01-31-2006, 10:43 AM
Funny you mention this Floze I was up all night playing with Volumetric lighting and placing planes in front of lights to see what kind of cool effects i could achieve, this is an amazing technique but very low to render...But im looking to achieve physically accurate results so I can except slightly slower render times..Thanks for the link will have a look at that now...

floze
01-31-2006, 01:01 PM
Be careful with photon mapping: it'll never be physically correct. The most accurate way of rendering in mental ray is to use the path tracing shader, but of course this is very slow.
Heh, yeah.. I wasnt referring to the physical correctness of photon mapping itself though. What I mean by 'physical correct correlation' (grain of salt, hint hint ;) ) is the proportionality of direct illumination and photonic energy in mentalray, which is, e.g. for a regular maya spotlight, provided that it has quadratic decay: photonic energy / 4pi (spherical area term, does not apply to flat area lights).

Speaking of path tracing, if any mr shader dev is listening: I recently tried to 'manually' reproduce what mi_reflection_dir_diffuse does, without much success though. I know how to reproduce mi_reflection_dir, which is quite basic (roughly R = 2*N*dot_nd - dir, if I remeber correctly). But I'm stuck with the lambert thingy in the diffuse distribution.

playmesumch00ns
01-31-2006, 01:05 PM
The diffuse direction should just be a randomly chosen direction in the hemisphere (or better, cosine-weighted distribution). The siggraph course notes on monte carlo techniques from recent years are good references for this stuff, otherwise googling should turn up something

floze
01-31-2006, 01:15 PM
The diffuse direction should just be a randomly chosen direction in the hemisphere (or better, cosine-weighted distribution). The siggraph course notes on monte carlo techniques from recent years are good references for this stuff, otherwise googling should turn up something
I see.. actually I tried chosing random directions, but with limited success. What I'm after is that really smooth distribution mi_reflection_dir_diffuse yields - probably it's the cosine-weighted distribution you mention. I'll check the paper you mentioned, thanks.

Sully
01-31-2006, 04:20 PM
Damn you guys Know your stuff!! :eek: Is there any chance for someone who doesnt script or write shaders to fully understand Mentalray? I feel like im pickin up mr slowly but do you need to know the mechanics of things? if so could you point me in the direction of where to start...Ive noticed alot of the documentation is writen in mr shader language which is kind of difficult to get your head round if you dont understand it...

By the way floze, your thread was very helpful thanks alot!!:D

floze
01-31-2006, 04:43 PM
Damn you guys Know your stuff!! :eek: Is there any chance for someone who doesnt script or write shaders to fully understand Mentalray? I feel like im pickin up mr slowly but do you need to know the mechanics of things? if so could you point me in the direction of where to start...Ive noticed alot of the documentation is writen in mr shader language which is kind of difficult to get your head round if you dont understand it...

By the way floze, your thread was very helpful thanks alot!!
Thanks Sully, glad it helped.
To get things started, my simple advice is: get them started. I started off with zero knowledge too, as probably anyone else (except some reincarnation of Isaac Newton maybe?), but I'm still not near where I want to get. Keep the ball rolling and always try some stuff you didnt try before. Reading through the forums and some proper books does help greatly too - you're definitely not alone with your desire out there.

playmesumch00ns
01-31-2006, 04:48 PM
I see.. actually I tried chosing random directions, but with limited success. What I'm after is that really smooth distribution mi_reflection_dir_diffuse yields - probably it's the cosine-weighted distribution you mention. I'll check the paper you mentioned, thanks.

The main thing to bear in mind when sampling is the quality of your sampling patterns. Simply choosing random numbers is a very bad way to go about it. The best bang-for-the-buck quality increase comes from using stratified sampling, and you can improve on that still further by using low-discrepancy sequences instead (this is what mental ray does internally).

floze
01-31-2006, 04:55 PM
The main thing to bear in mind when sampling is the quality of your sampling patterns. Simply choosing random numbers is a very bad way to go about it. The best bang-for-the-buck quality increase comes from using stratified sampling, and you can improve on that still further by using low-discrepancy sequences instead (this is what mental ray does internally).
Yeah, it's funny that you mention this because right now I'm reading over the samplers sources of http://pbrt.org/src/pbrt-src-1.02.zip, which does contain examples of random, low-discrepancy, stratified and best-candidate sampling methods. Unfortunately I dont own the book though (yet!)..

neutronic
01-31-2006, 05:41 PM
.......................................................

floze
01-31-2006, 05:47 PM
.......................................................
Uhm... (didnt know that's your sock puppet).

francescaluce
01-31-2006, 05:48 PM
.................................................. .....
what's. a sampling pattern ? :)


to add something to the GI+Caustic workflow. the caustic
should be a different pass if you plan to use it also fg.
fg is best suited for purely diffuse scenes without great
amounts of contrat. that's just what caustic adds. so
exclude them from your fg pass and recompose them in
post. I do the same also for speculars. no flicker, smooth
scenes, no burned zones, way to ctrl your additional
contrasted pass.

my two cents.

ciao
francesca

Sully
02-01-2006, 08:26 AM
Ok thats a really handy bit of advice francescaluce I will give that a try!! Ive been working on a few projects lately where I split my image up into different render passes and I was amazed how much quicker and more effective it is to render this way....Is it good practice to always split your render into different passes? Can you cut corners with this and combine say the colour channel and the fg pass or is it best to do it all seperate and tweak in post?

CGTalk Moderation
02-01-2006, 08:26 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.