That would be great Vlado! Sure would beat mapping the curves out by hand…
Although it would be even better if the two methods would work side by side. Essentially you could enter the rgb n and k values to get a starting point for ‘reflectivity’ and ‘edgetint’ and then switch over to ‘artist friendly’ color slots to tweak the color if needed. So if the client says, make that gold more rosy or less yellow - it would be easy and intuitive to do while still having physically correct starting point for the particular metal.
Here is a shader that allows you to enter n and k values directly (for 0.65, 0.55 and 0.45 micrometers - you can get values directly from http://refractiveindex.info/)
Use as a reflection color map and make sure the Fresnel option in the VRayMtl material is disabled.
Or else, just have a drop-down with values from the refractiveindex website (copper, gold etc) so that you don’t have to type those each time… would be much simpler
Sure, that would be perfect
For now, I guess I’ll just create a few preset maps for the most common metals manually and run them through a color correct node to slightly change the hue if needed for artistic purposes. I think that should work pretty well.
you know I probably shouldn’t have put n and k in there as those values need to be normalized to fit 0-255 (from refractiveindex.info) as was said. The idea is to make it easier to have a complex fresnel but be able to tweak those colours by eye.
just have a drop-down with values from the refractiveindex website (copper, gold etc) so that you don’t have to type those each time…
so that’s why in another post I was wondering about a dropdown list in OSL
even that thinFilm shader you wrote would be great to have some pre-sets for different materials.
This is a somewhat different approach, I think I got the equation from the old Odforce Wiki. If someone wants to do complex number calculations in OSL there are a few functions for that included here. complex_fresnel_v001_rh.zip (829 Bytes)
Vlado, would it be possible to include colour swatches next to the n and k values? It would be awesome if we can put the correct numbers in and then tweak the colours individually. It would give more control over a colour correct and keep the shader a bit simpler.
Sure! Here you can see your complex fresnel osl with the values for copper. On the left without any modifications, on the right with gamma 2.2. When I redraw the reflectance curves with a falloff map, I get a result close to the gamma 2.2 version. Will check my gamma settings just to be sure, but I never had something like that before.
Ok; not sure about that one though - I just copied the formulas and I’m pretty sure the Fresnel equations do not feature any gamma correction. What are the n and k values that you used? I think the default ones that I put in the shader are for copper.
Vlado,
I looked up the settings for copper over at refractiveindex.info and found out that your default values are already set for copper. But it is the same for all my other materials as well. My older ones used the curves, and they are much more saturated then the materials with the osl and no gamma correction.
That isn’t a big problem for me, I can always put the osl texture into a color correct node.
I’m not sure this is a gamma issue.
I made a test with gold, rendering 3 different versions :
1- with the complex ior vrayosltex (values from refractiveindex.info)
2- with a falloff map with custom RGB curves (values from refractiveindex.info)
3- same as 1 (vrayosltex) but with a cc with gamma 0,45
As you can see the first two are pretty close, but the vrayosltex does indeed lack a little punch in the colors, whereas the gamma corrected version is very different.