"Everything has fresnel!"

I’d imagine you just plot the curve’s percentage reflection to a value between black and white at various steps along the way. It’d be brilliant to have some kind of spreadsheet data with say a value every 10 degrees of the facing ratio with a value of 0 - 100% reflectivity so you could make a simple curve - not as accurate as a full curve but still maybe better than what we’ve gone with before?

Here’s an idea of what your curves would look like if you were doing rgb bits:

It seems that metals not only have really weird curves based on the angle you’re viewing from, they also have different strengths of reflection for different parts of the spectrum of light which is what gives gold it’s yellowy reflections and so on! all from Reflectance - Wikipedia by the way.

Use a ramp.
To understand how you can do this, here a curve, and here a ramp :

You can plug a ramp into remap node which has curves.

@Dmitry, which remap node would you recommend? The Remap Color, Remap HSV, or the Remap Value?

@Damien, which ramp you were referring? The 2D Ramp texture I can find in Maya has a vertical interface?

if you wish to control the value, you can use remap value, its a single channel. If you want to control color you can use remap hsv, since it accepts outcolor but has a value ramp, so you can affect the overall luminance of the texture.

Thanks Dmitry. Seems to be a great way to have a curve control in Maya for simulating the fresnel effect curves.

Just to speed up the process and to learn some mel, I wrote this simple script that creates and connects all necessary nodes (a facing ratio connected to a black/white ramp connected to a valueRemap).

Btw, does someone know of a site with more of these ior-curves?

string $fresnelSamplerInfo = `shadingNode -asUtility samplerInfo -name “fresnelSamplerInfo”`;

string $fresnelRamp = `shadingNode -asTexture ramp -name “fresnelRamp”`;
autoUpdateAttrEd;
setAttr ($fresnelRamp + “.colorEntryList[2].color”) -type double3 0 0 0 ;
autoUpdateAttrEd;
setAttr ($fresnelRamp + “.colorEntryList[0].color”) -type double3 1 1 1 ;
autoUpdateAttrEd;
removeMultiInstance -b true ( $fresnelRamp + “.colorEntryList[1]” );

string $fresnelRemapValue = `shadingNode -asUtility remapValue -name “fresnelRemapValue”`;

connectAttr -f ($fresnelSamplerInfo + “.facingRatio”) ($fresnelRamp + “.vCoord”);
connectAttr -f ($fresnelRamp + “.outColorR”) ($fresnelRemapValue + “.inputValue”);

Thanks for sharing the script, Ekenryd. I did a quick test and it seems to me that I have to put a reverse node between the remap node and the Vray material’s fresnel IOR so that the curve in the remap will control the fresnel reflection like the curves joconnell posted earlier (i.e. the closer the control point to value of 1 the more reflective it is). Also, it will be great if we can figure out a way to control this on a per R, G, B channel basis. Maybe through the Remap Color node?

Hm, not sure what you mean with the reverse node, it works like expected here. From left to right you get 0 to 90 degree refl, and from down to up,0 to 1, you get 0% to 100% refl.

Here is a modified script which create a remap color node instead of remap value, plug it into the refl color.


string $fresnelSamplerInfo = `shadingNode -asUtility samplerInfo -name "fresnelSamplerInfo"`;

string $fresnelRamp = `shadingNode -asTexture ramp -name "fresnelRamp"`;
autoUpdateAttrEd;
setAttr ($fresnelRamp + ".colorEntryList[2].color") -type double3 0 0 0 ;
autoUpdateAttrEd;
setAttr ($fresnelRamp + ".colorEntryList[0].color") -type double3 1 1 1 ;
autoUpdateAttrEd;
removeMultiInstance -b true ( $fresnelRamp + ".colorEntryList[1]" );

string $fresnelRemapColor = `shadingNode -asUtility remapColor -name "fresnelRemapColor"`;

connectAttr -f ($fresnelSamplerInfo + ".facingRatio") ($fresnelRamp + ".vCoord");
connectAttr -f ($fresnelRamp + ".outColorR") ($fresnelRemapColor + ".color.colorR");
connectAttr -f ($fresnelRamp + ".outColorG") ($fresnelRemapColor + ".color.colorG");
connectAttr -f ($fresnelRamp + ".outColorB") ($fresnelRemapColor + ".color.colorB");

Also, a tech question: Should I gamma correct this color remap node for linear workflow if I plug it into refl color? Wont that make the curve look different and hence the reflections wont be like the curve? On the other hand I’ve heard that you should always gamma correct colored reflections.

Ekenryd,

If I understand the curve correctly, toward the left (X-axis) is getting closer to the glancing angle and the higher the Y-axis the higher reflective. I did two test renders shown in below with a reverse node inserted. A solid blue is specified as the environment color.
lower reflectivity when faced dead-on.

higher reflectivity when faced dead-on.


I don’t know if I’m tired and missing something but I get the same result without the reverse-node. Leftmost on X is 0* for me, see screenshot.

My bad Ekenryd. I plugged the remap node into the fresnel IOR of the VRay Mtl, instead of the Reflection Amount (assuming this is where you plugged the remap node to?). Thank you for the screen shot.

http://refractiveindex.info/?group=METALS&material=Gold

Now if i understand, we must to recreate the same curve as the “Reflection calculator”, “Direction in” ?

Heya

Its something I ask vlado before some time a go…

We need to find out vray wavelenght at which its calculating its physics as far as I remember. And from that number we pick index (n is for IOR, k is for exstinction if I remember correctly) Not sure if this web will give us R G B IOR values per material…