Can you please share the code?
thanks
Can you please share the code?
thanks
Yeah, I was working with it in 4.6.1 and it crashed a few times working in the editor. I think happens if you make changes to the shader and hit âapplyâ instead of âsave.â I hit save all the time now and it doesnât crash anymore.
Ooh, missed ! Yeah, iterative method is a nice, cheap way to handle better parallax, but as you attempt viewing the material with a more oblique angle, that depth completely dissipates. 5 samples (+12 instructions) removes a lot of artifacts that appear with using bump offset alone. The Gif below compares a basic bump offset to caner_ozdemirâs iterative parallax.
OK, back to the parallax occlusion:
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:
float CurrRayHeight = 1.0;
float2 CurrOffset = float2( 0, 0 );
float2 LastOffset = float2( 0, 0 );
float LastSampledHeight = 1;
float CurrSampledHeight = 1;
int CurrSample = 0;
while ( CurrSample < (int) InNumSamples )
{
float4 Temp = InDisplacementMap.Sample( InDisplacementMapSampler, InTexCoord + CurrOffset, 0.0 );
CurrSampledHeight = ( Temp.r );
if ( CurrSampledHeight > CurrRayHeight )
{
float Delta1 = CurrSampledHeight - CurrRayHeight;
float Delta2 = ( CurrRayHeight + InStepSize ) - LastSampledHeight;
float Ratio = Delta1/( Delta1 + Delta2 );
CurrOffset = ( Ratio ) * LastOffset + ( 1.0 - Ratio ) * CurrOffset;
CurrSample = InNumSamples + 1;
}
else
{
CurrSample++;
CurrRayHeight -= InStepSize;
LastOffset = CurrOffset;
CurrOffset += InStepSize * InMaxOffset;
LastSampledHeight = CurrSampledHeight;
}
}
return CurrOffset;
Brilliant. will look gorgeous in games.
Indeed, parallax looks very good.
Did anyone made some tests with that material to check how expensive is in terms of frame rate?
Same here. I didnât figure it out how use that tooâŚ
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.
Iâll give it a try today, currently I am baking some special displacement maps for testing .
its still not proper POM. it doesnt have self shadows and without shadows the results will be always dull and unrealistic.
is proper POM. im still very disappointed that is missing in UE4. and possibility of mirror materials.
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.
Well you can just output depth on the shadow map and it should cast and receive shadows properly:)
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.
Cool thing, but quite unstable and very very demanding. Mesh copied 4 times, in the end if they all fall into the chamber of your computer tightly
Agree, CE3 got nice parallax shaders, also Unity, I am waiting for a solid official implementation for .
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.
Hereâs the graph: http://i.imgur.com/NlSgyAt.png
Hereâs an example of the problem Iâm having: http://i.imgur.com/NgvPnIZ.png
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.
Everyone and their mom just calls everything similar to , âtesselationâ, so POM doesnât really get much credit and attention. POM is definitely great, and should be focused on, itâs so cheap and adds so much. Please write here, where I ask Epic for a word on the many of us are having with the current POM setup: A better way of referensing 2d sheets through Custom node (fix POM plz) - Feedback & Requests - Epic Developer Community Forums