Displacement map with sharp edge

Hi

As a follow-up of detected a bug with displacement, I came with the scenario that I need to create a sharp edge with a displacement map.

https://playground.babylonjs.com/#9SY040#6

This is the next version of my PG and my question is:

Now the displacement map creates a mesh that is similar to the one on the right from the image above. Is it possible to have a sharp edge with a displacement map to have the mesh that looks like the one on the left?

Regards
Peter

Hello, it should be possible but only if you have a lot of vertices where you want the sharp edges

You see that’s the problem. I got a very limited amount of vertices. And I got a wall next to the ground drop off. And part of the ground is sticking out not nicely at all near the bottom of it.

I need a sharp edge on it in some places but without additional verts. a sharp edge marked with png alpha or something similar like a threshold per displacement to create a sharp edge like that, if the color difference is more than 20 shades, for instance, make a drop of sharp?

And I’m using ground I forgot to mention. so there is no option to make part of it higher resolution in mesh.

then displacement map is not what you need as it is happening at vertex level :frowning:

So what do you recommend? I cant have mesh loaded in unfortunately. So what else can I try with?

Do you guys have some chat to talk about problems like that? Forum has to much of delay :slight_smile:

Really?? The response time is less than 24h !

1 Like

To your point I would recommend maybe thinking about a pixel shader to do it?

You want to compensate the number of vertices and the only way is why pixels :slight_smile:

I know it’s great but sometimes you might need a chat super fast conversation and a small midstorm that can have a totally different outcome.

About Pixel Shader. Will ray collision detect proper mesh position form displacement or from pixel shader position?

OK. Pixel shader works but still creates a mesh density depended cut out. So it’s pixel-accurate from the displacement and mesh subdivisions. So it still creates the same effect. Just tried it.

Even a solution that my mesh will look like below will sort me out. Opening the mesh where the steep edge should be.

unfortunately no. If you add this constraints then adding vertices is the only way