Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 30 September 2012 - 06:17 PM
Posted 01 October 2012 - 03:35 AM
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
Posted 01 October 2012 - 05:42 AM
Edited by Ashaman73, 01 October 2012 - 05:42 AM.
Posted 01 October 2012 - 11:15 PM
Posted 01 October 2012 - 11:48 PM
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
Posted 08 October 2012 - 08:23 AM
Posted 08 October 2012 - 06:17 PM
Glad you solved it!Bacterius: Ah, solved it! Also added matrix operations, and a rotation procedure, and was able to tilt the sphere by 30º, and saw that the texturing was all correct. No mirroring at the poles.
Well, this is a tricky question, but in theory you multiply bounces. This is because in real life, light comes from light sources, and bounces into your eye. So say a light ray starts with energy E, then hits a reflective surface like a mirror. It'll bounce in the reflected direction, but might lose, say, 4% of its energy. Then, it hits a diffuse surface, and loses another 10% of its energy. Then it enters your eye. So in total, its new energy is E * 0.96 * 0.90. If you do this backwards (which is allowed because of reciprocity), it becomes 0.90 (reflectance at first bounce) * 0.96 (reflectance at second bounce) * E (emittance at light source). It's a bit more complicated if your surfaces both emit and reflect light (it becomes a recursive multiplication of emittance + reflectance).1) Regarding colors, as I trace a ray through the scene, through reflections, textures, etc, for each step of the way how do I handle the computation of the final color?
I'm, for now, going with:
rgb_final = (rgb1 + rgb2) /2;
...basically averaging colors for each ray collision...
I've heard something about color multiplication, like so:
rgb_final = rgb1 * rgb2;
The formula above is wrong, I think, it's actually R = I - 2 * N * dot(I, N) where I is the incident vector (your AP) and N the normal. You must always follow this new reflected vector for perfectly mirror surfaces, anything else will look very wrong. However, not all reflective surfaces work like that. Most actually reflect light over a small "cone" focused on the reflection vector, so that the reflected image looks kind of blurred. Others (diffuse surfaces) reflect any incident light randomly in any direction. It's a fairly complex topic, but in general, if you hit an ideal mirror, you always use the equation above. This comes from the principle of least time, which states that when bouncing off a surface, light will take the shortest path from point A to point B - which happens to be described by the equation above.2) If I hit a reflective surface, should I follow the surface's Normal vector, or should I calculate the reflection as below?
R = 2(AP . N) x N - N
Many. If you ever need physics information about whether what you're doing is right, Wikipedia and Hyperphysics are the place to go. Also, Physically Based Rendering (book) covers a lot of ground when it comes to raytracing. You can also have a look at this in-depth tutorial about ray tracing, or perhaps this one both of which I found useful to work out some concepts, particularly regarding cameras.3) Any online resources you advise?
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.