How to blend between mirror and diffuse with custom Fresnel?

24 February 2016 07:33
I want to create a material with a custom Fresnel curve, so I will need to use material nodes. There are two versions I would like to create:

1. A Mirror Map material

2. A Dynamic Reflection material

Update: The above methods don't involve material nodes, but I just found this section that does. I think I'm getting closer.

I'm hoping someone here can explain what settings will need to be changed (if any), and how a node setup can be constructed for this.

Thank you!
24 February 2016 12:10
Okay, I modded the B4W_REFLECT node to have a physically-based Fresnel curve. I "ported" a node setup from a PBR Cycles material I have into Blend4Web.

Here are two .blend files for comparison:

Original: cube_map_mirror_default_fresnel.packed.blend

Modified: cube_map_mirror_physical_fresnel.packed.blend

At first I thought there was a noticeable difference, but now that I am comparing them I'm thinking there may not be. Hmmm… It's possible I just did a lot of work for nothing, if the B4W_REFLECT node was already using phyically-based Fresnel. I will have to get some feedback from the B4W team, I think.

Well, I also need to figure out how to use this same curve to factor between max and min cube map reflection textures. I have an idea of what to try for this next step.

Also, I think textures need to be prepared/baked at the roughness matching the node's roughness value. Planning to experiment with this.

I still have no idea about what to do for Dynamic Reflection though, as it may not use nodes at all. Maybe there is a way to mix reflective and diffuse by layering textures.
24 February 2016 12:31
Manager and 3D Generalist at Blend4Web
No pain, no gain.
24 February 2016 16:29
Thank you, Mikhail!
Your example is very helpful!

It appears that there was no need for me to rework the B4W_REFLECT node, as Blend4Web inserts its own Fresnel in upon compiling.
I did a test and cut the node connections inside, but I still got a a reflective monkey :-)
And since B4W already uses Schlick's approximation instead of Blender's Fresnel, I don't really need to tweak anything. Well, I learned something.
Please register or log in to leave a reply.