bagginsbill opened this issue on Sep 29, 2010 · 74 posts
bagginsbill posted Wed, 29 September 2010 at 2:59 PM
This is easy. In matmatic, you say:
fresnel = TrueFresnel(1.5)
The fresnel variable is now a bunch of nodes that calculate the correct reflection coefficient for a 100% smooth material with an IOR of 1.5.
Now we need a reflect node. This is also easy:
reflect = Reflect()
Now we need to combine the fresnel effect with the reflect node. We could do this using the poser surface Reflection_Color and Reflection_Value channels. But this is a lot of typing, and also when we deal with shader GC, we can't use those anyway.
All we want is to use the fresnel coefficient as a coefficient - a multiplier. So we make our combination by simplying multiplying the two values.
combination = fresnel * reflect
And we want to make this our material output. Since this is so very common, matmatic has a very simply function, View, that takes one argument - what you want to see as the output of the shader. It builds an otherwise empty surface, and connects the argument to the Alternate_Diffuse channel.
surface = View(combination)
So let's put that all together - here is the entire script:
fresnel = TrueFresnel(1.5)
reflect = Reflect()
combination = fresnel * reflect
surface = View(combination)
For those that are amused by brevity, this can also be written as the one-liner:
View(TrueFresnel(1.5) * Reflect())
However, in steps that follow, we'd need to take that apart, so I'd stick with the four-line version.
The attached render shows the result.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)