I’ve been trying, unsuccessfully, to reference a texture object in the parallax occlusion code: will allow anyone to use parallax occlusion code in a material function, making it a hell of a lot easier to implement. I was able to replicate Oliver M-H’s custom texture pass on his blog (http://oliverm-h.blogspot.de/2014/12/ue4-quick-tip-sampling-textures-in.html), but for some reason integrating into the parallax code returns two errors:
Error [SM5] warning X3570: gradient instruction used in a loop with varying iteration, forcing loop to unroll
Error [SM5] error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (1024 iterations)
I also wanted to remove the channel mask because anything to save on instructions can help, and if you’re using a grayscale map the values shouldn’t matter. Here is my adjustment to the code:
My last gif wasn’t even parallax occlusion, but it does look nice.
I already made a lot of materials with 's parallax occlusion. The expense of framerate is not too bad with lower samples, but with higher samples above 100 it can crash easily… assuming your GPU is only a GT 640. Around 5-20 samples is not too bad, especially if you don’t have too many lights shining in the same place. It’s definitely usable for a game, though.
I tried fixing the silhouetting by increasing the range in the code, but for some reason that still doesn’t work. I can get it to tile more in the X direction, but not Y.
You can’t have shadows with POM in physically based rendering. How do you calculate the shadows of complex light and bounce light? Render an approximation by converting the physically based reflection to vector directions? Get real. You might be able to implement self-shadowing using a hard-coded vector that can change per-instance, but that’s it.
Normal maps with POM currently look great. Pretty soon they will be compatible with dynamic AO and they’ll look even better. Shadowing with PBR is not possible, unless Epic decides to allow a single light vector for a single “dominant” light the way UDK had, but considering all the problems of dominant lights, that most likely won’t happen. Just do it manually.
Oh, I’m thinking too much. If you have to bake lighting, it’s going to take a ton of pixels to get the bounce shadows to work appropriately… but yeah, dynamic shadows and post-process AO would totally work.
It is possible to use UE3’s parallax occlusion method which has self-shadowing implemented, but instead of a light vector, you’ll have to input a hard-coded vector constant for the light/shadow direction, because UE4 doesn’t specify dominant directional lights, and light direction (at least a singular vector direction) is not computed in the deferred shading process. is totally possible to make into a custom function, if someone’s willing to integrate it. If another dynamic light source shines on your POM material, it won’t be able to calculate more shadows for each light, and I’d imagine if it could, at that point tessellation would actually be cheaper.
W. also posted that we’re going to get a new material node that allows us to push back pixels in space, allowing them to work properly with ambient occlusion. That will also help give you some of the more appropriate shadowing you’re looking for.
Hey guys I’ve been trying to implement POM effect into my terrain material. The only thing that is keeping me from using it is that I cannot get layer blending to work properly. I can paint different layers just fine but the pom effect only works for the first layer. Something is going wrong when combining the different height-maps. I have tried various ways of fixing it including using vertex paint instead of the terrain paint and trying workarounds with material functions but the end result is always the same. I would really appreciate if someone had a look at my material or could explain to me why what I’m trying to do doesn’t work.
Same problem we’re all having. At the moment the only way to reference the Heightmap is by defining which one to use in the HLSL code in the custom node, so it gives no **** about what’s actually connected. If Epic would just let us reference 2d sheets in a simple way, we’d all be happy and have POM everywhere. It works if you have only one heightmap, but it’s still hacky and awful.
Yeah.
Also it would be nice if Epic finally made an official POM shader. It’s a commonly used effect as far as I know, so I’m surprised that there is still no official implementation.
Will do!
As far as I know, we have three ways of adding depth to our materials: Tessellation, BumpOffset and POM. The best of the three, in my opinion, is POM.
Great! Hopefully we can finally get an answer from Epic.
Agree, Tesselation Displacement works great for some stuff, but I think POM is more versatile as it works way better with small details, also it’s very cheap.
maybe I don’t fully understand the problem (I haven’t tried POM shader),
but can’t you sample a CustomTexture? i.e. make a TextureObjectParameter and feed to it your heightmap, and then make a Custom node where you sample it
I’ve been able to sample textures in HLSL like in the past, I’m sure it should be possible to do it here