Materials and light transport
#1
Posted 06 April 2012 - 03:39 AM
#2
Posted 06 April 2012 - 04:00 AM
So if you calculate reflected light = incoming * material color, then that's the reflected light, period. No need to do any randomization type of stuff.
This tends to create photons with a wide distribution of values. Some photons are directly from a light source and will be very bright while others have been bounced a few times and are dim. This is not wrong - you'll still get a correct rendering result - but my understanding is that the trouble with this is it tends to worsen the noise. You'll need more photons and/or more rendering time to get a high-quality image.
So in photon mapping, people often take some steps to try to keep all the photons at about the same power. One way to do this is, instead of multiplying each photon by the material color when it gets reflected, you randomly either absorb the photon or reflect it. If you forget about colors and think about monochrome rendering for a minute, you can see that if you have a surface that reflects 20% of the light, that it's equivalent to either reflect all the photons and multiply each one's power by 0.2, or reflect only 20% of the photons but keep the same power (the rest are absorbed, i.e. thrown away).
In full-color rendering you have three different color channels (or more) but you can only pick one probability to reflect the photon, so people usually pick the max of the three colors or the average of them. Then you have to multiply the photon by material color divided by whatever probability you used. That ensures the photon gets colored properly, but the amount of reflected light is correct overall.
#4
Posted 06 April 2012 - 05:15 PM
#5
Posted 06 April 2012 - 06:16 PM
#6
Posted 06 April 2012 - 07:26 PM
#7
Posted 06 April 2012 - 07:40 PM
#8
Posted 06 April 2012 - 08:07 PM
#9
Posted 06 April 2012 - 09:22 PM
#10
Posted 06 April 2012 - 09:48 PM
But you don't have separate R, G, and B photons (well, you could, but this isn't the way it's typically done); you just have a photon, and you must decide whether to reflect or absorb it. You must somehow condense three numbers, the RGB material color, down to one number, the probability for reflecting or absorbing.
A reasonable way to do this is to choose the max of the RGB components (although personally I would probably choose the weighted average by eye sensitivies to R, G, and B, rather than the max).
But when you reflect the photon it must pick up the material color. So you multiply the photon color by the material color. But now you've incorporated the material color twice - once to calculate the probability to reflect a photon, and once to modify the photon color. That's wrong, so you must compensate. You can do this by dividing the photon color by the probability. That way the photons still pick up the material color but the total amount of reflected light is correct.
In other words, you're splitting the material color into an overall intensity - which tells you the probability to reflect a photon - and the actual color part, which tells you how to change the color of a photon when it reflects. These two when multiplied together must give the original material color, so it follows that the "color part" = material color / probability.
#11
Posted 06 April 2012 - 10:09 PM
float Luminance(const vec3 clr) {
return 0.212671f * clr.r + 0.71516f * clr.g + 0.072169f * clr.b;
}
So the probability of reflection is...
bool p = frand(0..1) < Luminance(materialColor);
if (p) {
reflectedColor = photon * materialColor / Luminance(materialColor);
}
Is that right?
#12
Posted 07 April 2012 - 12:40 AM
#13
Posted 07 April 2012 - 01:05 AM
#14
Posted 07 April 2012 - 02:23 AM
#15
Posted 07 April 2012 - 02:28 AM
#16
Posted 07 April 2012 - 02:31 AM
#17
Posted 07 April 2012 - 02:46 AM
I've been trying to make my lights nice and I have a hard time. What I mean is, take the Cornell box for example, the light on the ceiling is square. When I render that, the light is not anti-aliased because it is so bright. So what I did is store the photon comming out of the light right where it leaves the light. Looks ok on large lights, but again, no anti-alias on small lights because the area is so small and packed with photons. So I dumped that and instead I read the light color at trace time, but the light is almost black! So I don't know how to handle this, and for glass for example, I like to have the light shinning on them, but it's eather very faint or too bright that it looks stupid! Any idea? you are the genius
#18
Posted 07 April 2012 - 03:25 AM
One thing to check is that the total photon power is scaled correctly. If you set the radiance of the light - that is, the color that rays return when they hit it - then you can calculate the total power as light color * pi * the area of the light's geometry. (The pi is to convert from radiance to irradiance, i.e. it's the integral of cos(theta) over the hemisphere.) This total power should equal the total power of all photons emitted from that light.
#19
Posted 07 April 2012 - 04:49 AM
#20
Posted 07 April 2012 - 05:32 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users













