Download

Over-riding shader inputs with another object - similar to a decal

Hello - I am trying to over-ride certain shader inputs (specifically base color and roughness) by overlapping one object over another in world space.

Example:

  1. Flat ground plane, base color white, roughness 1
  2. overlap a sphere, where the overlap happens, change base color to black, roughness to 0

I have been playing around with a number of different things but I can’t quite seem to figure it out, and the documentation doesn’t seem to mention anything like this. I feel like I need to end up with something like this:

However it feels overly complicated.

Does anyone have any ideas or could point me in the right direction for what I am trying to do? Would be very much appreciated, thanks!

I’ve been trying to do the same thing. It’s possible to do this with postprocess materials because they have access to world space locations for pixels, and you can check whether the pixel falls inside of the specified radius… But that’s super complicated, and it seems like there OUGHT to be a way to achieve it with ordinary materials.

If it’s only a Sphere you want to use, just create a Sphere Mask in the material, and drive the location via a Material Collection Parameter. You can use it like any other mask.

mask.JPG

There is a caveat to this, anytime you want to add another sphere, you have to add another entry to the collection parameter and another copy of the above the the material. There’s no way to dynamically add this on the fly either, and every material that you want to be effected by this has to read this ALL the time. That’s going to be expensive. The more masked areas you want to add, the more complex the material becomes.

If you want to do anything more advanced than that like areas of destruction like Frostbite has, you will have to go into engine code and write your own Volume Texture, and a special sampler for materials that allows them to read that volume texture. There’s no exposed volume texture system you can just plug into.

This is the effect of the above material applied to the default level floor.

Capture.JPG

That’s a very interesting solution, TheJamsh! Thanks for being so detailed with your response :slight_smile: