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"

Need help with material based liquid in a container

I've been researching using a material to fake a liquid in a container and there's been some great work done by various people that have all come close to the solution but never quite got there.

The general approach is using the Z plane to drive a mask as shown here:


This method is fine for block colour since it hides the fact there's no surface plane on the liquid due to the nature of the opacity masking, but I'm after a solution which ends up with a surface.

alt text

There was also an approach which takes it a step further shown here:


that tried to use world position offset, essentially looking down and finding the silhouette of the object at that point from above then pushing the top verts down but it falls apart when rotating and the approaches I've tried to fix it haven't yielded any results.

alt text

I was wondering if anyone has any ideas on how to fix the method shown above or maybe any other approaches to fixing this problem?

Product Version: UE 4.17
liquidstill.png (172.4 kB)
liquidstill2.png (291.8 kB)
more ▼

asked Mar 13 '18 at 05:34 PM in Rendering

avatar image

1 1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Use local position instead of world position for your calculations.

more ▼

answered Mar 13 '18 at 10:01 PM

avatar image

7.9k 130 31 293

avatar image Alphawolf154 Mar 14 '18 at 02:37 AM

When I use local position instead of world position, it does move up and down within the container correctly but since it's local space it doesn't have the same motion of water in a container that you get with the world space method, see the two below:

Local WorldWithoutSurface

Also when you rotate it and move it about with local position it's affecting the material negatively in the ways shown below(ran out of upload limit on here so have to use external links):

Here and here

It's quite possible I have just implemented this wrong but this is the effect I would expect to see. Ideally a way to somehow combine these methods would be great but I'm at a loss if it's actually possible. I'm also not sure on what other material approaches I can take with this since world offset seems to be the only possibility.

liquidlocal1.gif (2.3 MB)
liquidlevel.gif (2.7 MB)
(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