distance field doens’t work well if you have meshes scaled in a non proportional way. Could it be the cause?! Also I don’t think multiplying the distance to nearestSurface is a good way to get contrast. Value close to 0 get a 10x boost, probably not what you want to do?!
You are right. I’ve tested a lot the past days and I’ve noticed this as well. I 'm now using a lot of Cubes and other meshes in a 1x1x1 scale. But I am still experiencing the same issue.
I’ve made some changes to the materials. Maybe now you understand better what I am trying to do?
Still the biggest problem is, that the MDF is perhaps not dense enough(?). I’m not sure what is causing the issue with the self-moving faces. As you can see in the gif, the deformation of the faces, which are close to each other, is working. But when I move the couch for instance, the deformation (mask) is changing itself. That should not happen.
A few moments later in the gif you can see that the sphere which is getting close to the surface is deforming as it should. Maybe it needs some tweaking, but it is working well for a early stage version. But the self-moving surface/mask is still a big issue. I have no clue, how to get rid of it.
I think probably what is happening is you are limited by the resolution. AFAIK distance to nearest surface samples from the global distance field, it’s much lower resolution than mesh distance fields.
You can try increasing the global DF resolution with this command:
r.AOGlobalDFResolution
By default I believe it is set to 128, try increasing it to 256 or 512 and see if it changes the result. Should probably go without saying but I think it is safe to assume this will have an impact on performance. In what way though, I am not sure.
I’ve found a post where someone was describing the same behavior. The global distance field is used for the “DistanceToNearestSurface” note.
So I lowered the value of the “Global DistanceField View Distance”. After that, the behavior of the shader/material is more in the direction of what I’m expecting.
I will also try your suggestion with the
command.
Finally, I can go on and work on the details of the shader/material. The basics were the problem. I can think about the performance issues once everything is working.