Download

Near plane as mask

Hello. Its possible to use nearplane as mask for post process material and if yes then how ?
i just want to have white color on nearplane and black on everything else.

As I understand - you want to interpolate scene texture with something, and use near clip plane as mask for that?

But there is a question - how do you want to understand which object is culled, and which one is not?

It is possible to calculate it for one particular (flat) polygon or plane, if you know its vertices locations.

And what about using this for water plane but with waves ? I could use custom stencil as second mask to know which object is culled or not but still… I dont have idea how to get nearplane position or create function which is working like nearplane

I also tried to use camera depth fade function beacuse i think its working similar to nearplane but… it wont work in post procces material for translucent mesh.
Below u can see what im trying to make.

If you want to make a kind of water edge, you can easily calculate it in material.


ClipPlanePosition = CameraPosition + CameraDirection * ClipPlaneDistance (usually = 10)

Make DotProduct with WorldCoordinates and ClipPlanePosition, and you’ll get mask. Then modify ClipPlanePosition and mask softness to get desired results.

For example:
material.jpg

Here is how it looks on camera edge:

edge.jpg

if you want to make calculate a mask of underwater color like this, well… welcome to this thread - Under water / above water split view, is this possible? - Rendering - Unreal Engine Forums

It could be ok but it wont work for translucent material, same like pixel depth.
As u can see below mask works only for ground etc but not for water material.

Maybe this thread could help me but I have no idea how to write this custom node I cant even understeand it… Just how u can convert vector 2 screen position to vector 3 world position it doesnt make any sense for me

It looks like world position wont work for all translucent material.

well looks like i cant make it with this method but i think i could make it with your method from other post.
I saw this SS 3f7fc57a973970d449ab2a8aa589581b2cfcd2eb.jpeg&d=1532567230
Can u explain me how exacly this is working ? Its getting polygons position or something to create this fog effect under water ?
I created fog already with a little bit easier way but I need it to create this meniscus effect on camera. So i would be glad if u could explain this code from this screen.