Parallax Occlusion Mapping with Vertex paint?

Hello,

I was fooling around with Tessellation and vertex paint and was wondering if it would also work with a POM shader, but the output of vertex paint is a float. (I need t2d :frowning: )


Is it possible to even do vertex paint with POM or should I just stick with the tessellation version?

Couple of thoughts…

Firstly the vertex colours interpolate accross the faces so even if you could paint values to go into a POM, they wouldn’t give any extra detail inbetween vertices. So you might as well just do world position offset.

Secondly, I don’t think that you can sample vertex colours with a UV argument which would be needed inside of the tracing in the POM custom node.

Or are you mixing vertex colour with POM?

You need to POM twice, then lerp/vertexcolor :slight_smile:

I will give it a shot this weekend, once I have some spare time again :).

There will be some floating artifacts when blending using vertex colors since vertex colors are impossible to sample from offset positions.

The only way to do this without floating artifacts is with texture alphas, and then you must modify the POM function to accept the mask texture object and mask UVs and add a few lines of code. I can post them later.

It was pretty hard to consider adding those type of options to the existing POM node since it already has a daunting amount of options but it is likely we will see some POM variants released soon. 4.12 has a ‘texture bombing POM’ node that was an expensive experiment that might be interesting to some. Even in that one I still haven’t fully fixed the floating blends but I will be fixing them soon (hopefully).

for some cases with gentle slopes, you can fix a lot by using bumpoffset using the vertex mask as a height modifier to modify the height of your 2nd texture and mask to be at closer to the average height of the neighbor where blending occurs. 4.12 content examples map has an example like that but I simply used the 1st parallax UVs on the 2nd texture so it was more avoiding it.

Here’s some material functions that might help a bit. They use old stuff but it might be good enough to get the idea across :slight_smile:

&stc=1

&stc=1

&stc=1

Thank you Chesire :slight_smile:

Looking forward to the 4.12 update :).

Cool!

For those curious, here are the line changes you need to add in order to support multi texture tracing in POM.
This example multiplies Tex by Tex2 which is what you would want if you were going to blend 2 poms.

For this to work without additional code for the ‘top layer’ (meaning you need 2 pom functions), you would have to also store an inverted alpha mask and use that in the other layer.


texatray=dot(HeightMapChannel, Tex.SampleLevel(TexSampler,UV+offset,0));
texatray2=dot(HeightMapChannel, Tex2.SampleLevel(TexSampler,UV2+offset,0));

texatray *= texatray2;

Needs 2 new inputs to the POM custom node, Tex2 and UV2.

Then you need to sample the original 2 heightmap using parallax UVs at the end. You can subtract one from the other, divide by ‘blend length’ and clamp to 0-1 then use that as lerp alpha. Or you could save a bit and simply blend using the output z (float3 output.Z stores the Y intersection) which would be the same as sampling the heightmap with parallax UVs.

Thanks ! Will give that a try in 4.12 :slight_smile:

Using a POM for each heightmap texture and lerping it works as Chesire suggested, however as many have said it causes some errors once you look at it on an angle. Will give it another shot once 4.12 comes out. :slight_smile:

Hello ,

Do you have screen shot of your material graph for this? I know it was sometime ago but it would be really helpful to know how you set this up

kind regards