It can make quite a difference - look at some of the colour ramps presented in the papers I linked to earlier (there is a soap on water, SiO2 on Silicon and Si3N4 on silicon. The start of the colour ramps are broadly similar - but they quickly diverge in terms of the colours presented as a function of film thickness as the film gets thicker.
can we build a shader with the formulas we see in papers,no or maybe in osl.
can we precalculed formulas and feed for example a sinewave with the result.? yes ,as moony allready dit.
Well… That might not actually be so. The formulas are calculating different light for a different type of surface, so the precalculated values cannot be expected to be accurate in different environment in practice. Observing real materials might be a more realistic approach in production.
But hey… If it works for you, that’s great.
we allready know that.
if im not wrong,we are trying to reproduce a soapbubble thinfilm for example,under white light.then we can choose a thickness for it.and start calculating.
if you want an oil thinfiilm feed your excel math with different ior,and mabye different thickness ect.and start calculation.
if you have no formulas in your shader,you have to precalculat to get something you can put into your shader and rendering.
whats your point?we trying to find out some ideas. any idea ?
edit,what do you think are ior values,like 1.33 for water or 1.0 for air 1.5 for glass and so on.
thats all precalculated values.
or do you calculating the ior of water before use it? we are trying the same.a simple reproduction.
I’m more on the artistic approach, so the colorramp is enough for me, so far.
And by the way, is there some table, as for IOR, where we can find the measured thickness for iridescent materials?
If not this whole matter would turn into eyeballing exercise anyway, wouldn’t it?
Again I’m saying: suggest iridescence presence. No one will shout out at your renders because the edge should turn into violet instead of red. Only comparing with a real photo will expose the artifact…
The problem is not really that. It’s quite easy to find the interference distance for any single-thin-film layer, knowing the width and the IORs of both interfaces.
Things get a bit more complicated when you have internal reflections (dued to bigger angles of incidence and widths); When you have multiple layers of thin-films (as in pearls), multiple interferences (as in diffraction gratings, or other structural interferences).
In the top of the cake, we still have to address a good way to deal with spectral>RGB conversions.
Aha, as mentioned in this thread few times before.
I also agree on artistic approach as best suitable in this case. But should also note that artist must be master of the skill, technically knowledgeable & experienced about the topic in question. Only then can one confidently cater the needs of any client, a simple, scientific or highly demanding (super star brand)…
This is the reason why i consider this discussion highly valuable, especially for newcomers so they don’t fall into the pit of hype & false engine advertising - simulated light, computed results will always be to some extent biased. Yes, even if it’s spectral.
So what if one can never achieve 100% ground truth, as NVidias MDL developers stated (IIRC): “Even if material/shader is not real or it doesn’t exist, it’s rendition is bound to the laws of physics.” And this IMHO is one of most important aspects of realistic visualizations. On the way to make a good tool better.
On the IOR values take similar approach as for alloys. One can never be absolutely correct about it’s value unless proper lab. measurements are done (but even that values will be true only for the specific test object.)
A. Oil & Water are easier to do since they do not mix, thus can be considered as two different components. Constant movement makes it almost impossible to define real thickness in specific areas, so one must predict the value that will help it keep in the realm of compromised tolerances (eye of the beholder - your style or client’s POV).
B. Soluble soaps (soap bubbles) are harder but also easier (it helps to read-understand what MartinZ wrote in the thread)
Also this:
For what we usually think of as “soap” and what we usually think of as “soluble”, yes. But there are details.
Soaps are a class of compounds that include some that are practically insoluble (“insoluble” as to the solubilities where reference works draw the line) in water at any temperature at atmospheric pressure. These include soaps of all the polyvalent cation metals whose soaps I know about, and soaps whose fatty chains are at least of a certain length (C20 if I recall correctly; C18 is soluble at high temperature).
But the solutions of all but the shortest-chain soaps are far from ideal (Newtonian) solutions. Above a certain concentration (which is usually pretty low) their molecules are no longer randomly dispersed in the water, but form micelles or other structures. This is why soap solutions are usually not optically clear.
So study, read, explore, make thorough tests & your works of visual renditions might become prophetic.
I think it makes sense to to use IORs and thickness for thin film interference in spectral renderers, because you can find out IORs of the materials in many cases and guess the thickness looking at the real object and matching the effect visually and then you get all the benefits of the physical calculations - the object looks predictably in different lighting scenarios and the reflections on it look realistic, so it’s quite convenient and logical to have those parameters when more accurate calculations are possible, however in Cycles we will not be able to have correct reflections and accurate result when lighting environment is changed, so I think having thickness and IORs in this case is not as practical because they would be used for calculations disregarding the actual lighting of the object that is the result of global illumination in the scene and BSDF that defines how the object scatters the light when reflecting or transmitting it. I actually believe that at the moment it can be more physically accurate to just visually match the effect using a color ramp and camera viewing angle to the result expected(through observation) in a particular lighting environment.
I am not advocating a less accurate way in this case, I am trying to make a point, that by having more intuitive parameters like actual colors on a ramp it is probably possible to achieve a more accurate result with the ‘artistic’ approach than with calculations from a different context.
Secrop, did you have a look at the source code of Cycles? How much work do you think it would require to implement some sort of more accurate thin film interference to Cycles in the source code? Do you think that is achievable? I mean… How hard can it be?
It’s not difficult to implement it to some extend. There are two problems to solve: the best way to incorporate this logic in the UI, and minimize the calculus to a
simple formula just for the RGB response.
the first is just an implementation problem that must address the possible variables of the second. If we can find a nice solution to solve the integrals of the second part of the problem, implementing them could be fairly easy.
found this code,maybe usefull
based on this code,this free plugin was made
https://www.sigershop.eu/free-3ds-max-plugins/sigertexmaps-thinfilm/
here maxwell render workflow with interface
thea workflow
arnold in c4d
https://support.solidangle.com/display/AFCUG/Thin+Film
Calculations are just a deterministic framework to easy interact with complexity and get the results. One simply input the values (thickness & IOR) that goes hand in hand with the methods of questioning. A person using or an artist can even be blind yet results will be shown and also considered as correct.
Although in this case am more intrigued by the interaction of uneven & rough surfaces. Still questioning the interaction between surface roughness & film thickness. One surely influences the other. IMO roughnes should drive the thin film thicknes to some extent.
That’s the Achilles’ Heel from Cycles. Roughness should drive most of the light interactions to a great extend (we all know how much roughness can be found in any specific material).
What we have now, is implemented in each BDRF, and it doesn’t take into account interactions with other BRDFs being sampled (fresnel is a good example of this flaw).
It is important to think how we could have this working in our current node system logic, aside being able to calculate intensities and interferences from roughness surfaces.
It doesn’t have a significant impact on performance.
I have just tested a straight up colour ramp - verses my shader with the wave texture recombination technique and the performance hit is negligible. On an 800x800 image with 250 samples - the render times were 25.14 and 25.87 seconds respectively (~2.9% difference).
If you calculate the sine waves using math nodes rather than wave textures - the difference is even smaller at 25.38 seconds (<1% slower than using a colour ramp)
Well, that is nice to know. But at the moment I do not see any benefits of doing so. Even if you calculate interference for red green and blue while that would probably be a bit more accurate, we still have the biggest issue - it would not be calculating the light of the scene so it’s only accurate for sharp glossy objects illuminated by completely white light from all directions. So in practical situations this might give undesired results and might not have intuitive way to work with it as opposed to a simple ramp where if you see a color in reality, you just put the same color there. Of course, I say ‘might’, because I haven’t tried it, but I think it would make more sense to put all this effort into programming the actual Cycles source.
…so the best would be to start a OSL project? I guess ,implementing the shader direct into the master source code ,would be to complicated? first build and test the OSL shader,and if this works, bring the code to the cycles devs ,for implementing its the way to go,i guess?
I think Secrop mentioned some problems with OSL as well. I have no idea about the source code. It would be interesting to see how it works. If anybody reading this had any advice of where one should start if he wanted to mess around with Blenders source it would be interesting to hear it. It seems like a project for a year or two though
We could try to figure out the maths and physics part though. That sounds like fun
. But it seems to me that’s about all that can be done to make a real difference from visual matching of colors on a color ramp to photographs.
…ehm…source code.have a look on this.if you know how and where to start,good luck.
here the main folder
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/
and here in the render folder, the node.cpp file give you an idea how it looks i think.
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/render/nodes.cpp
edit,wait here the shaders
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/kernel/shaders/
I think that the code should only calc the colors.
and if wanted a seperate input for a highmap(not the roughness one extra input)would be handy.that input could be used only for the thickness.
like in this shader,where you can set the min and max clamp for the map.or if you dont use the map.the thickness value would taken for the calc.
cause the thickness makes no roughness at all,it changes only the color.the thickness itself is to thin.its only a few nm.
edit,even a thickness of 1000 nm is only 0.001 mm thick
https://support.solidangle.com/display/AFCUG/Thin+Film
If you’re planning to make soap bubbles, the thin-film setup discussed here is enough (and no need to make changes in the code). What I’m saying is that we still have to address other situations where iridescence takes place (and the roughness problem when mixing closures).
In case of thin-film, we have the case where the internal interface has roughness (which is most of the cases where the thin-film works as a coat); and where we have multiple thin-film layers (can be simplified to add up multiple thin-films, but it’s more of an approximation).
Then we have structural iridescence, which is also a bit difficult to setup with the minimum parameters possible, and we need to think about it to give artists some control.
Diffraction gratings, is just a matter of adapting the color equation to the anisotropic BRDF.
We could make some simplifications in the math, but for example calculating 20 orders in a diffraction grating is still quite fast, and the result is almost white at this point. For n-layers thin-film, the situation is the same (a little bit faster).
The roughness problem is a bit harder. We either remove versatility from the user and have something like a principled bsdf, or we need to change the way we are currently using nodes (it’s possible to add some exceptions in the code, although not very practical)
Now, things we need to consider:
-how do we want to implement iridescence in a way simple to use and understand?
-how do we want to deal with the roughness when mixing closures?