POM material

Ok. I’ve figure it out that it only crash if I apply material to the “SM_MatPreviewMesh_02” mesh work well on a plain surface,
So is not working on complex meshes?

Best regards

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.

iterativeparallax.gif

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. :frowning: