PBR Displacement example

A while ago I adapted a displacement example from diatom on the forum for PBR, now I saw some requests about this subject so here it is. It reads the heightmap texture from the PBR material and displaces the vertices accordingly along the normals sampled from the normalmap texture in the PBR material.

Note: Vertex displacement only gives a good result if your geometry is already very high poly, as you’ll see on the sphere in my network.

pbr-displacement.png

This example needs TD 099, Substance PBR material is included.

EDIT april 12th 2017: new version 1.1 with correct shadows
PBR Vertex Displacement_v1.1.zip (3.8 MB)

1 Like

Great example, Idz!

Brilliant, exactly what I was after! THX

Why not add it to example section of Wiki page, this could probably help millions of people.

Great example, thanks a lot for sharing!

just posted new version 1.1 where i fixed the shading&shadows not being calculated correctly.

Idz you are golden , The shadows are working great now!

Thanks for updating this

I can’t seem to illuminate this Material with Environment lighting COMPs.

I just did a quick test and it seems to work fine with Environment light.
The Environment Light Comp is Image Based Lighting - this means it needs an image to do anything. Have you applied a TOP to the environment map parameter of the Environment Light?

Yes. I have. I’ve been using the example as a part of a larger project that uses .Exr animations for lighting scenes.

For some reason it worked with the previous version but not this one. They’re may be other issues in my network. I certainly couldn’t see any changes in the shader that would account for it. I must have busted up some other part while trying to swap in the new shaders.

When I start with the example and use the env mapping setup i’ve been using it seems to work fine. Sorry for the mixup.

Thank you so much for making this reference setup! It’s priceless. Now if we could get dynamic mesh tessellation… :slight_smile:

amazing example!

Just trying to figure out why the vertices are displaced in one direction instead of being parallel to the surface of the sphere.
In fact if you put a grid in place of the sphere the displacement goes “diagonal” inseat of straight up to the y-axe like a regular vertex displacement.

I’ve tried to tweak a bit the vertex shader, in partcular the following line (37)

vec3 newP = P + (N+noSample.rgb) * dsSample.rgb * uDisplace.x;

but with no luck

You really want a scaling operation here:

vec3 newP = P + (N*noSample.rgb) * dsSample.rgb * uDisplace.x;

Rather than a translation operation:

vec3 newP = P + (N+noSample.rgb) * dsSample.rgb * uDisplace.x;

That still ends up a little egg shaped when pushed all the way to the displace max, you might also try looking at what happens if you just use the height map:

vec3 newP = P + (N*dsSample.rgb)* uDisplace.x;

You’ll also end up with different results if you add a texture SOP inline inside of the geo - this lets you change how uvs are assigned on the object - which will in turn change how you’re sampling from the displacement textures.