Searched but couldn't find anything. Sorry if this has been asked before (wouldn't be surprised). Also hope I got the "polarized colored reflections" term correct.
How would you guys go about making this kind of reflections in UE4?
In UE3 you could just simply add the colors on the specular without having to modify the diffuse so the colors would only show up when light would hit it. With UE4 (4.4 and 4.5 tried), I tried keeping my shaders as always (roughness and all that) but connecting a rainbow-looking texture onto the specular. I know the specular node isn't really used anymore except for some very minor control in some cases, but for things like this I thought they still would keep the UE3 use (ie, colors from the specular showing up in the reflection).
I assume now things must be done in a more "physical" way, but.. how do these reflections work? Is there an easy way to go about it or I'm looking at some fairly complex nodes?
Thanks in advance. I'll keep trying here and post if I also find something.
Maybe you can find some tech docs about what causes the effect and recreate it.
Anyway, I will see if I can get something done. Thanks!
The oil slick is typically known as a "thin film" effect. Light partly reflects from the surface, and partly passes through the thin film, then reflects from the layer underneath. Different colors arise when the film thickness is an even multiple of half the wavelength of that color. The wavelengths constructively interfere and so a color stands out, other wavelengths tend to cancel as they interfere destructively.
Beetle shells are a similar phenomena, but the shell itself is comprised of many many layers of chitin stacked together like shale. The microscopic structure of thee chitin plates reflects light in a similar way as the oil slick, as each layer of chitin is subtly separated from the others by a sort of organic adhesive. Since there is a boundary between materials, reflection and refraction can occur. The substructure of the chitin also winds up polarizing the light. There's a species of golden beetle who's chitin plates stack in a spiral pattern, which circularly polarizes the reflected light, rather than linearly. Other beetles may be similar.
All that is why EQ says "Iridescent/pearlescent are sort of their own thing, and would likely require a custom shader."
You could likely get passable results by using a dot product from camera to normal, using that as the UV input to a color ramp that held the colors you wanted, then combining that with a mask onto the iridescent parts of the model in the diffuse channel, and making sure the metalness was way up for those areas.
that will get the iridescent effect to follow the viewer correctly (the colors correspond to the relative thickness of the chitin normal to the viewing angle) but also reflect nicely due to smoothness and in proper color shift due to metalness.
Not sure if you have found a solution. I started to try and create one this weekend and gathered some links that you might find useful.
Uses UE4's material editor. google translate
Fake, but looks nice using Octane renderer
Used by Unity3d and the one I am trying to implement/port.
Seems to be popular
I am using a custom shading model. I think that might be the best way to go about it since you can use a custom BRDF and fresnel? You can use this website (http://blog.felixkate.net/2016/05/22/adding-a-custom-shading-model-1/) to add one.
The current results are completely wrong, but at least it's a start.
I also did some playing around with the shader and tried creating some materials with it.
Supposed to be a holofoil card.
A sequin cloth thing.
Heya , you think youd be able to share how you went about some of these materials?
*code was taken from Unity Labs linked below*
Here is the material network in case the uasset does not work:
Wow, brilliant work!
Thank you so much for sharing this with us!
One question; if I understand correctly, the Dinc value is the thickness of the thin film? If so, would it be possible to remap it to a nm value instead? Is it just a factor of thousand maybe?
I'm trying to match the material examples in the paper you based the shader on. I can't seem to be able to use their values though. I understand that you omitted the clear coat layer, but that shouldn't make it differ too much, right?
Would be cool to be able to use the clear coat shader model for this, but it only accepts a float value as it seems.
Again, great work, and thanks for sharing!
I created a pearl material for fun:
I used the values from page 5 of the supplementary pdf.
The first one I had to change the value of Dinc to 910nm and the last two images I had to change eta3 to three to match it. Again not sure if its a typo or not.
For the thickness values d. Using values supplied in page 8 d=350nm to d=650nm.
When varying values of k3 they do not match up with the images in the paper. You would have to compile mitsuba and try the values for yourself.
You should be able to use the clear coat material for this. I have been using it with an anisotropic shader and that seems to be working fine.
Im confused with which of the material parameter names corresponds to what names in the supplementary.pdf
eta3 = n3
and kappa = K3?
also with the code update I did
if thickness is 350 nm from the PDF, it would be 0.35 in the material?
maybe I broke something changing the code? not sure though, but nothing matches up whatsoever.
I tried to manually eyeball and tweak the thickness d together with Eta2, Eta3 and kapa, but no combinations seem to work.
eta3 == n3
kappa = k3
If your using thickness as a parameter then trying to use Dinc is meaningless.
if the thickness is 350nm then you would input 0.35 for the thickness.
As far as matching up the supplementary material goes it should match the behaviour and colours. There is a limitation with using the custom material nodes instead of writing a custom shading model. The first is that fresnel is applied from the default shading model. Also the reflection captures will appear with the wrong colours and the sky lighting wont work correctly. If you need to match the colours more accurately then you need to write a custom shading model.
Here are my settings for page 7, fifth column, and first row.
float eta_2 = lerp(1.0, eta2, smoothstep(0.0, 0.03, Dinc));
float eta_2 = lerp(1.0, eta2, smoothstep(0.0, 0.03, FresnelBias));
and than plug in a scaler paramotor?
Or is that completely new code for that? Over here I just swapped out all instances for Dinc to FresnelBias, and my default is .5 for that right now.
Edit: Hmm actually wait that's not right, ouch
Edit 2: I'm just not getting that golden color in any of the materials.
I've done all of them in pages 5 - 8
Here are my mats for the 600nm, notice the farther right that it lacks the gold and red colors.