x

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"

Hiding an actor partially

Hello everyone! I was wondering if there was a way to stop an actor from rendering partially when for example it enters a volume. In my level i have a mesh for my water and ive made a ripple effect with a particle system for when i collide with it(still working on it) and i ran into a problem where if the character enters the water near the water meshes edges the particle effect kind of expands out of the area i want it to be in. So i was wondering if it was possible to sort of border out the water area with volumes surrounding it that would stop the particle effect from expanding out of the water. This wouldnt be a problem with normal water but mine happens to defy gravity a bit since it has no physical edges, its just a box. Thanks for any help!

Product Version: Not Selected
Tags:
more ▼

asked May 06 '15 at 08:38 AM in Rendering

avatar image

EliasPa
89 22 22 23

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Hi EliasPa,

There is currently no CubeMask function but it is fairly straight forward to make. I will add this to a future UE4 release, probably 4.9:

alt text

Works slightly different from spheremask. You set the edge falloff in units rather than 0 to 1 hardness. Making it work with hardness would require some more math and not worth it IMO.

box_mask.jpg (64.4 kB)
more ▼

answered May 06 '15 at 10:00 PM

avatar image

RyanB STAFF
2k 55 24 118

avatar image EliasPa May 07 '15 at 08:36 AM

Thank you so much! I tried it and i got it working. I control the bounds with a ParameterCollection and i tried setting the size of the bounds via a blueprint ( a blueprint based on my waterbox static mesh), but i was wondering if there was a way to set the size the same as my waterbox's scale? I tried using Get Relative Scale 3D and Get World Scale and setting that as the new parameter value but I didn't seem to get the right results with those. I can, however, control the size with just a variable of the vector type but that requires changing the values manually.

avatar image EliasPa May 07 '15 at 03:28 PM

Also this is probably stupid but is it possible to move the location of the mask like with the SphereMask since now it's located in the origin of the world? And is it possible to add multiple instances of this if I wanted to have a few of those waterboxes? EDIT: I got two of them by duplicating the nodes and adding their output with the 1-x node. But i dont think thats the best way since i have to manually adjust the size. I don't have the location control yet though.

avatar image RyanB STAFF May 07 '15 at 03:42 PM

Yup, to move it just requires one subtract at the very upper left of the above screenshot.

Do "Absolute Worldposition" minus "Location Center" just before the ABS node.

Getting the size is possible. Try using the "Object Bounds" material node. There are a bunch of nodes about getting object scale all which might be useful depending on the exact case.

ObjectRadius: the bound-SPHERE radius with scaling

ObjectLocalBounds: this is the size of the mesh without scaling with additional min/max positions

ObjectBounds: bounds in the world

ObjectScale: this gives you just the scaling factor on the component.

You can see that using some of the above you can create the others in different forms etc.

avatar image EliasPa May 07 '15 at 06:07 PM

Thanks! It works fine with one instance of the water but i get this weird problem when i add the two together:

alt text

And the color changes when i scale or change its position but it doesn't change when rotated.

alt text

The problem is with the way i add them here:

alt text

Do you know anything about this?

borderproblem.png (256.6 kB)
borderproblem2.png (275.9 kB)
ripplematerial.png (151.7 kB)
avatar image EliasPa May 07 '15 at 06:25 PM

Apparently I just had to build the lighting and it seems to be working now. Thank you so much for the help!

avatar image RyanB STAFF May 07 '15 at 07:12 PM

np. Minor note but technically using "max" instead of "add" as the final node gives you a more accurate intersection between the two distance fields. I doubt it matters in your case, but if you are ever trying to build a specific shape out of many such fields combining with max will generally be better.

avatar image EliasPa May 07 '15 at 07:51 PM

Ok great thanks!

avatar image EliasPa May 09 '15 at 07:52 PM

I kind of ran into to a new problem with this. The ripple effect uses refraction, (it's basically a modified version of the cave effects project's ripple particle system), so that doesn't get masked out. So is there a way to hide that too or do i have to give up refraction on my effect?

avatar image RyanB STAFF May 18 '15 at 08:16 PM

You just need to lerp the refraction value using your same mask. the only difference is refraction of 1 means do nothing so lerp it so that when your Alpha is 0, the refraction lerps to 1, and when the alpha is 1 lerp to whatever your refraction network is.

avatar image EliasPa May 21 '15 at 02:58 PM

Sorry it took me a long time to report back to you, but yea it works perfectly, thanks!

(comments are locked)
10|2000 characters needed characters left

You can do this inside the material.

Make a material and give it some instance parameters representing the box edges. (This will be easiest if the box for your water is axis-aligned -- meaning that it's straight-edged along X and Y and not rotated at all. If you need it to work some other way, let me know).

The material would basically do this: get the world position. If the world position is between the upper and lower limits for your box, set the opacity as usual. Otherwise, either set it to zero (for a hard edge) or fade out (you can use a lerp to blend out as the world position approaches the boundary).

I don't know how much you know about materials so if you need more info, let me know.

more ▼

answered May 06 '15 at 10:27 AM

avatar image

kurtrussellfanclub
421 19 12 36

avatar image EliasPa May 06 '15 at 02:47 PM

Thanks for the answer! I'm quite a newbie when it comes to materials so additional assistance indeed would be great! I can't access my real assets at the moment so these placeholder assets will have to do for now. Here's my setup: alt text

The red one's the waterbox and the blue is the ripple effect i want to border out. The advice you gave sounds like it would work really well except i don't really know how to start. Here's the new material(or should it be in the waterbox's or the ripple's material?), it isn't much but there's some parameters that don't do anything right now:

alt text

The ripple effect's material just has a parameter plugged into the opacity input.

waterandripple.png (348.7 kB)
thenewmaterial.png (324.2 kB)
avatar image EliasPa May 06 '15 at 07:00 PM

I experimented with a sphere mask and it got me to a good place but do you know if there is a way to get a "CubeMask" of some sort since the waterbox is essentially a cube and i think that might solve my issue?

(comments are locked)
10|2000 characters needed characters left
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