Here’s a water shaderwhere I used Distance fields and flow maps for dynamic foam. It’s a bit messier than the ones you posted but I always have to play a bit with the numbers depending on how big my uvs/mesh are.
In your first screenshot the distance to nearest multiplier constant seems to be at 1, have you tried lowering it quite a bit? If I remember correctly I multiply with something like 0.01.
The node outputs a sign float value in centimeters, so when you plug you should see a gradient representing the outside of an object and the inside. The reason is that you can easily decide how to bias and clamp the values the way you want. If you look in the second link you provided in your 1st post, the step two is the correct way of do it indeed. The code you showed in the 3rd link is not like it.
As for the hardware, you are all OK, everything works with hardware half the potency you got.
The code from the 3rd link was from another foam material which also worked for my friend and not me. There seems to be something wrong with my version of the engine rather than something wrong with the code.
Regardless of what I do I get these strange bands that move around as I move the camera. You can see that the proper foam effect is there and working, though very sloppy, but these bands also exist. This happens regardless of what version of the material I use.
Would it be too much trouble to see the code for your material? I’m curious to see if this will happen with that one too. It might be something wrong with the distance to nearest surface node.
I just reinstalled the engine and all the versions of it I had. It works in my actual game project but not in the one I use to test stuff in before it gets added to the game. I also tested in other projects I have and have gotten various results from the same banding I currently have to just a solid black or white material. Which project it works in seems to be completely random as 2 projects made in the same version of the engine present 2 different results.
@NilsonLima The banding happens across mulitple meshes so I don’t think thats the issue. I’ve also tested it using the ue4 primitives and that gives me the same results.
This is one of the things that I really hate about game development. Things can just stop working for no reason. It currently works in my actual game project but how long before it randomly doesn’t?
Did the project I posted work at least?
Also there is a way to visualize the distant fields in the viewport: click on top of viewport, Show->Visualize->Mesh Distance Field, and the screen will show how the meshes distance field will look like. If this does not work and all are the same, the only thing that remains that I know is that Distance Fields are disabled at Low and Mid scalability settings, it will only work starting on High settings.
I would not say that in game developments things just stop working, this is accurate. What we can assure right now, is that there is something different between setups that we didn’t catch yet.
Not really. Theoretically with project settings disabled and on mesh editor enabling mesh distance fields for that specific mesh should work, but doesnt. The only way, not a perfect one, is to use the mesh instance position and the mesh bounds multiplied by its scale, to create a sphere mask or box mask and cut it out of the result, at least the cost is quite cheap.
Is that a global setting that applies to all instances of whatever mesh you set it for or can be 2 instances of the same mesh have different DF settings?
I ask because I created a really cool effect for water flowing past rocks as a backup effect if I couldn’t get distance fields to work. I’d like to combine the 2 effects so that Distance fields are used for landscapes, large objects such as rocks, and the player (I don’t think skeletal meshes even have distance fields so that might not even be possible) and then a custom effect for other objects.
It’s a global setting for the mesh,but you can duplicate the mesh since it’s not costly.And skeletal meshes don’t have distance field yet.Once I used a masked cylinder mesh instead in the player BP for interactive grass.