New Cycles Node for Metals

Hi everybody,

I have been writing a new custom bsdf node for cycles, to make conductive materials.
It has the NK inputs for complex fresnel, it has also a more artistic interface, and it has the ability to read nk data file from the Sopra-sa, RefractiveIndex.info and the Filmetrics.com databases.
I hope you like it. :wink:

Did you include proper Fresnel Schlick approximation and energy conservation (due to roughness) in the material nodes?

No. Schlick approximation is for non-conductive materials only. This node is just for conductive materials, where the fresnel factor is a complex number and it varies for different wavelengths.

The node uses the a similar version of the formula in the OSL ‘Fresnel Conductive’ script that comes with blender.

Where do you get nk files? I’ve never seen them before.

Out of curiosity what advantage does your node offer?

Basically the correct fresnel and material color based on the NK input?

Looks good - i’ll have to give it a whirl.

How about an iridescence one next :smiley:

@ifcruickshank Sopra-sa has been down for quite some time, but you can find the database in the internet. I have a copy if you need. Refractiveinfo.org and filmetrics.com websites are online, just go there choose the material you want and download the data file.

@cekuhnenyes, basically it gives you the correct fresnel values based on nk input. But it jumps the steps of finding the correct value for each color component wavelength from the interpolation of the sample data. If you ever tried to do it, you know that it’s slow and boring.

Apart from the shader functionalities for render, I wrote this node with a few details in mind. First, it doesn’t fill your node groups list from the add menu with nodegroups. Second, tangent and normal inputs don’t need to be connected for the node to work. Third, it doesn’t add any event handlers, and integration with cycles nodes is seamless. These are common problems that nodegroups suffer, and I tried at all costs to avoid them.

@moony not that I haven’t thought about it. It would still be slow but it’s possible to optimize the internals of the node based on the user input. Must test to see if it makes any difference from what I’ve already done.

@ Secrop

a dedicated metal shader in my opinion is always for me more welcome than crazy long node groups.

specifically when you teach Blender / Cycles to product design students for rendering more efficient
building blocks are always more welcome!

So how can one use it? I just saw that it will be at the Blendermarket ?!

Is this a scripted node?

The node will for sale in the blender market. But I will share a more simple node with the comunity; for those who don’t work at a fast paced production. I’m still trying to solve some problems as I want the people with the complete version still being able to share materials with those with the light version . And yes, it’s a scripted node.

Very cool!

@nudelZ, The fresnel part is using the same equations you’re using in those setups. But the node it’s not the same. :wink:

I’m curious, how do you handle the conversion from wavelength data to RGB triples for the IOR components? Do you just pick the values of the dominant wavelengths of the three sRGB primaries or go the full way (multiplying with the CIE XYZ curves, integrating to get XYZ values and multplying with the XYZ->sRGB matrix)?

I picked the dominant wavelength for each component. Actually I don’t think there is a good equation to deal with this problem. CIE XYZ is good to represent light emitted from the source, but from what I know, it’s not easy to represent reflective and transmissive colors (I may be wrong here, but never found a good answer anywhere).
There’s also the Cycles limitation of not being a spectral renderer, nor light emissions have wavelenghts encoded…
For a more precise equation, we would need to treat each wavelength from the source independently, estimate all interferences resulted from medium/surface structure, and only perform the transformation to sRGB in the end… but this requires some deep changes in cycles algorithm, far beyond my current knowledge and means.

Wait I am confused now.

Is this a new shader or a shader group or an OSL shader?

Sorry for asking.

Claas

Thanks for clarifying this.

Can’t wait to try it! Looks good so far :slight_smile:

@cekuhnen, atm creating a true bsdf shader has to be done in the source code, and it couldn’t be installed as an addon.
Behind the curtains, the node has a node_tree with all the logic needed for rendering. so yes it has a shader group inside so cycles can understand and use. Blender doesn’t allow the creation of new datablocks, we must use what there is. Then there’s the node itself, with all the file reading functions, interface drawing, and the control of the node_tree inside.

Just to note, Lukas Stockner has a patch in the works that includes a proper NK-data shader. This looks to be a good stop-gap until that’s ready though.

The main reason why I asked is because I render mainly only with GPU and OSL shaders sadly dont run on GPUs to my understanding.

a few examples of the node in action:

Attachments