POM material

Issue still actual. Maybe shader author knows ?

You wont be able to use composited height maps, as it has to use sample grad in the custom node in a loop, the only way to do it, would be to modify the code to sample from a number of different heightmaps, in the custom node itself.

hey i c&p the code and got that http://i.imgur.com/gH0B7vX.jpg

left POM right Bump.

what the problem?

using 4.4.3

Parallax occlusion mapping basically uses ray traces to determine where there needs to be displacement. The problem is that when it has to trace at those angles it loses a lot of accuracy and starts returning the wrong position. You can increase the numbers of passes it makes to alleviate that. You could use tessellation instead, it’s cheap and will give a better look.

thanks :slight_smile:

Would Pixel Perfect Displacement be possible with a custom/modified shader along similar lines as one?
I can see there’s a code-sample on GPU-Gems but I have no clue how to modify a shader like for UE4.

Hey,

first of all, very impressive work so far on ! :slight_smile: I tried using it for landscape and even with renaming the sample (made a material function out of the complete thing) I did not get it to work. For some reason, the landscape just becomes invisible when I apply the material. So I am not sure what the problem is here.

I also did not get tiling to work. Tweaking texcoordinates only has an effect on the heightmap, but not on the diffuse in which it gets plugged later on. Shouldnt that just work?

Next question…:smiley: Is there a way to get it to work together with WorldAlignedNormal? It would be sooo badass to have a landscape material that supports the POM effect and projects textures in 3d space to not have stretching on steep slopes :slight_smile:

To have it work with landscape, you can’t have the CalcSilhouette node, since that caps the texture coordinates. As for the WorldAlignedNormal I have no idea, havent really looked at using POM for landscapes.

Works just fine for me with both, LandscapeCoord and regular TexCoord nodes.

Yes should work. The most important part would be to do the tri-planar based blending early on to not compute POM 3 whole times.
However, you should be aware that POM tends to produce morphing artifacts whenever it is applied to deformed geometry.

Yeah…I already tested it and that was okay…the problem is more that the WorldAlignedNormal node already outputs a texture, so you have to integrate the pom function into the WorldAlignedNormal function, but I was not sure on how to merge the 2 UV modifications together so the output works.

If you guys have an idea on how to tackle I would be an extremely happy man^^

PS: the problem is, world aligned is basically taking world uvs and masking stuff off based on it. But Since I go into the texture sample with the world coordinates masked off by direction, I am not sure how to integrate the local UV modification for pom into that :S Argh…friday^^

First of all you would need to have 2 texture objects inputs, one for the heightmap and one for the output texture (diffuse/normal…).
The heightmap is being sampled first in the material function (3 times, one for each direction) and POM is calculated afterwards 3 times.
The outputs of the POM nodes (texture coordinates) go into another 3 texture samples which is your second texture object.
These are then blended regularily based on world normals.

I don’t see where the masking comes in. WorldAlignedNormal is basically the same as WorldAlignedTexture but for normal maps. It’s meant to output correct normals when doing a tri-planar projection in world space.

Hey malkavian,
thanks a lot for the support, very appreciated! :slight_smile: So what I dont get though when I read what you wrote above (I almost had exactly the idea of what you described) is : The outputs of the POM nodes (texture coordinates) go into another 3 texture samples which is your second texture object.

I may be somehow stupid for not getting it, but, the second 3 texture samplers where the normal goes in already get the world coordinates into the UV input. So do I just add the pom coordinates on top? Or how do I add them together? I tried it with adding the pomified UVs to the world UVs that go into the normal map samplers, but that gave me super strange results. I have to admit that I am not math/trigonometry solid enough to fully understand stuff xD

Alright, you need to calculate POM with world space UVs in the first place. means starting from the material screenshot by you need to replace all the TexCoord nodes by world UVs and also sample the heightmap with these world UVs.
In addition make sure not to transform the camera vector from world space to tangent space.

I’ll try to post a screenshot later on.

Hey man,

yeah…I am on it again (have tons of other things to do as well, so I am working on it on/off^^), but I am not 100% sure on how I will get it to work. If you would have time for a screenshot, that would help me tremendously and would be very appreciated! :slight_smile:

Cheers!

EDIT: Ha…I think I am almost there^^ (I also think I am making it a bit more complicated than it needs to be, because I want to get a couple of other things to work as well, like distance based tiling etc. to make it a fully featured replacement for the functions I am using right now on the landscape^^) but I think I will get it to run soon :wink: Would still be interested in how you would have tackled it in the end and see what we approached differently…but maybe we came up with the same (but honestly, judging from all your posts here, you will probably find some things I could optimize later on :D)

I just make a iterative parallax and create static occlusion myself and multiply with diffuse texture.
http://s17.postimg.org/sb1tlra8f/image.png
http://s17.postimg.org/lymobx767/image.jpg
http://s17.postimg.org/uv21tln67/image.jpg

So, I was able to get it to work (somehow) but I am not that happy with it :smiley:

The thing is , it looks perfectly fine on a cube, however on a landscape, you can see quite some heavy issues. My guess is that it has something to do with the “max offset” part, but I am not entirely sure :frowning:

I will link some screens and hope that somebody here is able to help me with , would be extremely awesome if we can get to run! :slight_smile:

So here is the with the landscape:

Its like the lerping isnt working like it should on landscape. The X projection has the fuckup on the Y side and vice versa. But since I lerp them together with a mask based on these axis in the end, the ****** up part should not be visible, but it is for some reason. But I also think that I might do something else wrong.

Here you can see a cube with the same material and its working fine:

is the function that I built for it, including the POM shader from thread:

And is the material testsetup:

Hope you guys can help me with :slight_smile:

Most likely it’s caused by the blending. What does that 3Way_01 function look like?

the function looks like :

It already does a better job than the one Epic is using in “WorldAlignedTexture” but still not a good one^^

The power node is causing some issues. Since the normals are in [0,1] range a large exponent will pull all the values down to zero so that there’s barely any full white left for proper blending.
Try to multiply your absolute normals by a value greater than 1 before taking the power and add a constant clamp right behind the power node.

Hey man,
thanks a lot for the tip! Sadly, it does not really make it any better. It just makes it different, but still bad (now more axis are blended together, so the is less visible, but you have overlapping projections which makes the textures look ugly).

I dont even know if “can” work in a clean way on such organic meshes :S