Dynamic Mask Texture

Hi,

I would like to know what is the best way to dynamically update a mask texture. For example: I want to clean a dirty car using my mouse. So, I trace a ray from mouse position to my car´s surface, detect the contact point, and then I want to convert this point to a uv coordinate of a texture that I can dynamically update. Anyone can help!?

Thanks

Daniel

Hey danielvmacedo -

You may want to begin looking at the Location Based Opacity tutorial from Epic Technical Artist Alan Willard, it is a good jumping off point to help drive your material change.

Thank You

Eric Ketchum

Thats interesting, however I don´t see how can I dynamically pass multiple contact points for hiding geometry or the texture. What I was thinking is: Create a blueprint with a sphere component and a decal that I can point to the car’s geometry projecting the dirty texture… when my tracer collide with the sphere I start to change the decal’s parameters until I destroy it completely, what do you think!?

Thanks for the help!

Daniel

Nevermind… I didnt know about collection parameter! I think I can make it to work. Thanks!

The videos of Location Based Opacity are great…
I am wondering if it would be possible to generate multiple sphere masks dynamically.

Hey lucabelluccini -

I haven’t set that up, but it is possible. You would have to use two sets of variables to control the rendering of the two spheres in the world and you would duplicate the sphere mask area of your material and add them together in the material, but it should be possible.

Thank You

Eric Ketchum

Hello,
what I finally did is a predefined set of sphere masks embedded in the material, each one with its radius and position parameters.

Then I access the dynamic material instance each time I want to modify them and I add them up in the opacity node of the material.

It would be great to have some sort of internal buffer in the material itself (once you set the sphere, it is stored internally), but I know the sphere is not a real volume but an operator on the rendered pixels… So this is not possible.

A detail: as parameter, I do not assign the world position but the local position. In this way I can use this mask also for dynamic meshes (I take the local position parameter and add it to the object position). Just rotations are not covered… But that’s temporarly ok.

Hello there:

I was having the same issue with having more than one sphere mask, and your idea really helped! I tried having up to three spheres and it looks awesome.

However, I don’t know how many sphere masks I will end up using simultaneously in each level, and if the number grows big, manually adding the sphere masks escalates poorly. Did you find any solution for this problem? Maybe some kind of automation in the material?

Thanks for your time,
Jaime

Hi Jamie -

Here is a sample of using a single Material with a single set of variables to have a dynamic mask across several assets by using a setup in Blueprints.

Test Project 4.9.1

So this is just a brief setup, but by altering what each Dynamic Material uses you can have multiple masks without the multiple sphere mask setup.

Thank You

Eric Ketchum

Hi,

I am looking into this exact same problem, but in my case I want to mask out the intersecting faces of many spheres overlapping each other. I have arrived at pretty much the same conclusion as Boron91. If I have e.g. 3 spheres overlapping each other, then I need the material they use to add together 3 sphere masks. However if it’s all dynamic and there could be potentially unlimited number of overlapping spheres, then the problem becomes impossible to solve without having arrays in the material, and those are not in… Right now, in my project I can enforce the rule that no two spheres can come closer than the maximum radius of either. This way, mathematically, each sphere can only be overlapped by maximum of 12 other spheres, which become manageable.

Kind regards,

I’m curious if you might be willing to put together a tutorial on how to set this up as I’m looking to create a similar effect to washing a car via materials.