And here's a render:
Note that we set the diffuse colors back to 0.5, and the specular colors to 0.5 as well. This is because the dgs photon shader enforces energy preserving 'scattering coefficients'. The source comments:
* The dgs photon shader enforces energy-preserving scattering coefficients,
* that is, the following three requirements:
* diffuse.r + glossy.r + specular.r has to be <= 1,
* diffuse.g + glossy.g + specular.g has to be <= 1,
* diffuse.b + glossy.b + specular.b has to be <= 1.
This means, we would get physically incorrect results if we used photon tracing and a combination of diffuse, glossy and specular values that exceed a total value of 1.0. In other words, the V components of our HSV colors should be smaller than 1.0 in the sum.
Speaking of photons, what can we do to mimic the dgs' photonic behavior? All though the solution is easy, it's a bit tricky if dont have any starting point. Well, here it is: We switch off the Derive From Maya checkbox and press the Take Settings From Maya button, to inherit anything we did from the regular shader. It will look like this first:
To recover from the irradiance trick we applied due to internal 'correction-calculations' the shader does, we would need to multiply the photonic intensity by pi again. To do this, we again use the diffuse attribute, but this time the miDiffuse or photonic diffuse attribute. It's currently at 0.318 (1/pi) - so if we multiply it by pi, it yields exactly 1:
And glossiness? Well, the glossy color is again the same as 'Specular Color' (with reflctivity 1.0), the shininess is controlled by 'Reflection Blur' attribute - where a 'Shiny' value of 5 equals (experimentally obtained) approx. a 'Reflection Blur' of 13. However, in my experience it is usually better to rely on custom blurry reflection shaders, like Francesca Luce's ctrl_shading - simply because they are faster than the built-in reflection blur. You can plug the ctrl_shading's reflection output into the Reflected Color slot of your Maya shader, turn the Reflection Limit attribute under Raytrace Options of your material to 0 (to completely hand over raytracing to the custom shader) and set the ctrl_shading's reflectivity to 1.0 (it's actually called 'Scale' in the shader) - it will be properly scaled by our Specular Color attribute of our Maya shader, so no worries. If we use photon tracing, we simply set the 'Shinyness' value of the photon part of our Maya shader to the same value as in the ctrl_shading. The ctrl_shading can be found here: http://forums.cgsociety.org/showthread.php?t=252304
Alternatively in Maya version 7 the mib_glossy_reflection can be used, which now ships with the MentalRay base shaders.
If you ask yourself why the dgs are still faster, specially when using finalgathering, there is an answer too. The dgs internally rejects light sample calls on the 'wrong' side of your surface (the side with normals pointing away from the light). In my tests this reduced the amount of light sample calls by about 30%, resulting in faster rendering. Unfortunately, this cannot be simulated by our Maya shaders, so we have to bear with it.
That's it! I hope you enjoyed the little brain workout! Much of theoretical stuff and no beautiful pics, but "The noblest pleasure is the joy of understanding." (Leonardo da Vinci)
< previous page