Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Water foam using distance fields

I'm having trouble getting my water foam to work. I planned on using distance fields to create foam for my water but I get a very strange result. The lines look blocky which could just be a quality setting I need to change but there is also this large white square that appears if I get too close to my water making the entire surface white.

In the screen shot below I have a plane with the foam material on it and as you can see the white square is appearing. The material is displayed at the bottom. Can someone explain what I am doing wrong.

alt text

Product Version: UE 4.18
waterhelp.png (1.2 MB)
more ▼

asked Mar 02 '18 at 01:01 AM in Rendering

avatar image

218 13 12 24

avatar image KrunkFu Mar 02 '18 at 07:53 PM

I added more planes just so I could see the effect over a larger area and it seem as if there is a large square that follows the camera. I've taken a screen shot of the corner of it. I've also noticed other strange behavior with the material. I made a change to a parameter that wasn't even hooked up to anything and the whole material went white. I am really confused.

alt text

waterhelp2.png (389.9 kB)
avatar image KrunkFu Mar 02 '18 at 08:36 PM

If I play with the numbers a bit more weird things start to happen.alt text

waterhelp3.png (301.9 kB)
avatar image KrunkFu Mar 02 '18 at 08:36 PM

This is what the "distance to nearest surface" node looks like plugged directly into base color. alt text

waterhelp4.png (234.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I'm not sure how to advise on using distance fields, but have you considered using the Depth Fade node in your material instead? Depth Fade returns 0 where two surfaces intersect and "fades" to 1 as the surfaces get further and further apart. You can use this to drive a Lerp between two values or just as an input to some other logic. It's very useful for shoreline effects or force fields that get more intense as they get closer to the ground, as just two examples. It only works with translucent materials, though.

more ▼

answered Mar 02 '18 at 08:22 PM

avatar image

825 27 15 57

avatar image KrunkFu Mar 02 '18 at 08:33 PM

Thats my backup if this doesn't work. Currently my material isn't translucent and changing that would change the look of the game so I'm holding off on that. Thanks for the suggestion.

avatar image KrunkFu Mar 07 '18 at 10:05 AM

Still no clue what is causing this strange behavior. There is more info about it here if anyone is interested. https://forums.unrealengine.com/development-discussion/rendering/1437124-water-foam-using-distance-fields

If anyone else has this issue just migrate your stuff over to a fresh project in the newest version of the engine and it should fix it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question