Parallax shader with Silhouette Clipping for Blender 2.8 Eevee and Cycles

Hello!
This is based on the work of Blenderartists user Binary for Cycles (2013), which
was itself based on Blenderclan user Zelouille original version for Blender Internal (2009).

I organized the nodes in a more user-friendly manner, and implemented the extra image map
nodes (for Metalness/Roughness/Transparency/Emission) as well as some tweak nodes (Inverse/Strenght)
which all connect to the Principled Shader node.

All you have to do to use it is remove the built-in images from the Image nodes and replace them
with your own. Also, remember to change the Height and Normal maps to Non-Color instead of sRGB.
The Image nodes that you are not using (e.g: Emission) can be left emptyā€¦ but you can freely
mess with the Invert node Factor as well as the Strenght node Factor and Color fields directly.

The Material is set up to use the ā€œAlpha Clipā€ option inside the Settings Tab of the material.
This means that transparent areas on the viewport are either completely opaque or 100% transparent
and is something required for the Silhouette Clipping feature of the shader to work correctly.

If you wish to use the Alpha Blend option instead (to allow for partially transparent areas or image maps), go to the ā€œSettingsā€ tab of the Material and enable the ā€œBackface Cullingā€ option, or alternatively disable the ā€œShow Backfaceā€ option that appears after you select ā€œAlpha Blendā€.

AlphaBlend

Apparently the shader (or Blender itself) has trouble trying to show semi-transparency AND the backfaces of the models at the same time. If you wish to use the Parallax shader and at the same time MUST see the backfaces, Iā€™d recommend duplicating the mesh, flipping the normals and ajusting itā€™s scale/positions. (Solidify doesnā€™t help here)

Some screenshots:


The Silhouette Clipping, as well as some shininess/roughness on the bricks:

Have fun!
Evandro Costa

EDIT1: Reorganized the Height Map to be inside of a group, because itā€™s referenced elsewhere in the node tree. (Thanks @filibis!)

Zip File:
Parallax_eevee_cycles_silhouette_clipping.zip (897.2 KB)

46 Likes

That.

Looks.

Amazing.

Strangely it also looks a lot simpler than I thought it would be.

2 Likes

Hi Evandro, this looks great! Thank you for sharing it.

Just an enhancement to the material: If you create a node group for height map like this it would be better in my opinion. Because that height map is referenced inside Parallax Main, so that we only need to change one.

image

3 Likes

Hi there Filibis!

Thanks a lot for the suggestion, you are correct, I forgot about the height map inside the Main group.

I think a Mapping node could also probably be squeezed somewhere to allow for dynamic resizing of the textures, instead of having to change the UV islands size as it is currently.
Later Iā€™ll try to implement it.

Iā€™ll change the file on the main post.
Anyway hereā€™s the updated node and a demonstration that itā€™s working correctly with other maps:


Reminder: if using other maps, remember to change the Height and Normal maps to Non-Color instead of sRGB inside their nodes.

4 Likes

This is insane!! Thanks for sharing :slight_smile:

1 Like

Works marvelous, thanks!

1 Like

really nice ! One of the best attempt so far !!!

but how the roughness, emission, metallic and transparency map can be correct if they arenā€™t moving with the depending on the view ?

also i saw that the height map is instanced, is there a way to make an all in one PBR node ? im trying to make the node simple

3 Likes

This is Awesome! Mast have. Thanks for sharing!

1 Like

Awesome work! This is the best parallax shader I found for Blender so far. And itā€™s free!
Iā€™ve been doing some Fur R&D and your shader has helped immensely.

If you havenā€™t already, UE4 has POM documentation

Some integrations Iā€™d love to see is ā€˜Height Ratioā€™ and ā€˜Tilingā€™. Hereā€™s an example of ue4ā€™s shader. Iā€™m having trouble making the hair look long using your shader

fur_gif

Hair R&D Video

1 Like

Dove more into your shader, I messed around with the View Vector and Parallax Pass parameters to try and slide each ā€˜layerā€™ to fake longer hair.

I ended up throwing a Multiply on the top two View Vector Dot Products. Not exactly sure what is really going on. But it kind of works. The ā€˜Directional lengthenā€™ breaks the shader when you multiply too much, ideally each ā€˜hair strandā€™ wouldnt get more blurry, just lengthen.

3 Likes

Hi there, nice results! Cool that it worked approximately like the Ue4 shader.
I think your high value Directional option is very similar to the Height Ratio example from ue4, IMO that one also became blurry. But I think parallax works better with short hair anyway.

Iā€™m not sure what the Tiling option does in the ue4 shader. Does it repeat the UV? If so, I think this is easy to implement, with a mapping node going to all image textures at once, and changing the X/Y scale values. But Iā€™m out of free time atm to work on this, maybe when I have some I can add it for you.

A cool effect that I wish was possible, but I donā€™t think itā€™s so easy to implement, would be something like the fur on GTA5, which appears to do a parallax effect (multiple repetitions of the same texture at different heights according to the POV), but with an alpha effect increasing at each layer, which works even at the profiles/silhouettes, giving that fluffy effect:

1 Like

That GTA5 shader looks great. The silhouette breakup really sells it. I believe itā€™s a shell/fin shader.

Hereā€™s a similar shader build in ue4. Iā€™m not really sure how you would automate the mesh extrusion and fur length variation. Any ideas?

1 Like

Hi,

Thank you very much for this awesome share.
When I tried to change the image of the sphere, its showing a gap as in the image below. Could you please help to solve this issue?


Also my image is not a seamless texture so I use curve, mesh deform and shrink wrap modifiers to wrap the image around a sphere. That works quite well for me. So is there any option to apply the parallax effect in this?

The gap is usually because of the Silhouette Clipping slider value. Try to change it to more or less.

As long as the image has the proper height map (and optionally a normal map to give more detail), and is properly UV mapped into the mesh, then it doesnā€™t matter how you distort the mesh after, the parallax effect will still workā€¦ of course the texture will stretch or squash according to the mesh deformation, but this is expected (just as it appears stretched in the original sphere or pillar that are in the file).

I wouldnā€™t advice using modifiers instead of properly uv-unwrapping the texture into a sphere, but this is a discussion for another topic, and has nothing to do with the shader.

1 Like

Continuing the discussion from Parallax shader with Silhouette Clipping for Blender 2.8 Eevee and Cycles:

OMG!!! SOLID GOLD!! thanks!! a lot! a ton! :smiley: this is something I was looking for a long long time ago :smiley: :orange_heart: :orange_heart: :orange_heart:

1 Like

Thank alot man !!!

1 Like

What is the UV2 input for? Why not reuse the input within the node?
I changed the Height Group to look like this


Using vector sockets throughout and reusing UV instead of having a UV2 input, and it still works just fine.


Less importantly, I also edited Parallax Main to look like this. Itā€™s a bit more work to add another iteration but imo itā€™s more readable this way. The only arguably non-cosmetic change is that I replaced Combine RGB in the View x Tangent frame with Combine XYZ.

2 Likes

Great work!
I wonā€™t be changing the main post as itā€™s more trouble than itā€™s worth, but Iā€™ll definitely implement your changes to my personal file. Itā€™s good that other people will see your changes and implement them as well, and in the process learning a little more about how everything works.

I hope we get a proper parallax node built into Blender some time soon.

Hey Evandro, Iā€™m interested in what it takes to build a Fur Realtime Shader.

I believe one component is to use POM. Iā€™m just curious how they ā€œReverseā€ the pom effect, where layers are stacked above the geo to create a silhoutte breakup. How do you think this is achieved?

I believe your shader is a solid foundation to build a fur shader system. The video below is a good example of what Iā€™m trying to convey. Cheers

2 Likes