#### Archived

This topic is now archived and is closed to further replies.

# reflection and refraction question

This topic is 5878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all. I want to know if someone can help me, than you very much. I give two values for the triangles, one for reflection and one for refraction. These values are in the range 0..1 If we have a reflection value == 1, then we have a perfect mirror, discarding all triangle color. If we have a refraction value == 1, the we have a perfect transparency(but we have to contemplate the refraction angle). Well, if the values are fr and fl, we have to do: refraction color: (triangle color)*(1-fr) * (reflex color)*fr reflection color: (triangle color)*(1-fl) * (behind color)*fl then, the color = refraction color + reflection color (is this right?) Well, i would thank very much your help. I want to know if im right becouse i dont know how to relate the two values. In the way that i do it i can have reflection == 1 and refraction too, and im not sure if that is ok.

##### Share on other sites
If you want to be realistic, then the blend is a bit different:

final colour = reflection_colour * F + refraction_colour * (1-F)

F is the Fresnel term for the current viewray and face normal. This factor (from 0..1) specifies how much light is reflected and how much is refracted from your surface. Then you simply need to blend between the reflected and refracted pixels based on the Fresnel factor.

/ Yann

##### Share on other sites
Thank you very much.
I was thinking something like that, and i supose that this factor depend on the properties of the material. Im right?
The the color ecuation would be:

color = F*( reflectionColor*fl + objectColor*(1-fl) ) +
(1-F)*( refractionColor*fr + objectColor*(1-fr) )

Thank you Yann.

##### Share on other sites
Actually, the fresnel value depends a lot on the angle as well. Of course, you could use any formula for it, but the angle is very important if you want to make it look realistic.

- hillip@xenoage.de''>JQ
Full Speed Games. Period.

##### Share on other sites
Your equation looks good, although it is not physcially correct. You can get good visual results with that, but be careful when adjusting the fr and fl factors. You might easily create a paradoxal situation.

But as JonnyQuest said, the Fresnel term must take the light/viewray to normal angles into account. That''s very important for realistic objects.

There is a brief explanation about the working of the Fresnel term here. Or you can just Google for ''fresnel reflectance''.

It can be somewhat costly to compute the fresnel factor, esp. if you want to do it per pixel. Approximations can be used, and give very nice results. The paper ''Deep water animation and rendering'' (somewhere on Gamasutra) has a nice section about fast Fresnel approximations.

/ Yann

##### Share on other sites
Thank you again, i gonna prove all that.
Thank you for the links too.
I think im understanding better now.
See you latter.

naher

1. 1
2. 2
3. 3
Rutin
22
4. 4
frob
17
5. 5

• 9
• 33
• 13
• 13
• 10
• ### Forum Statistics

• Total Topics
632580
• Total Posts
3007190

×