[SOLVED] How to achieve "mask overlay texture" effect?

Playground link


What I’m trying to do is overlap a texture over a rotating mesh.

So far, I’ve achieved a similar effect by creating a plane mesh between the box and the camera with the MULTIPLY blend mode applied to its material, but it works only because the scene’s background is black.

What’s the proper way to do this?

Thanks!

I guess your idea is great and you could use a stencil buffer to limit the mask to only the position of the cube ?

Thanks, @sebavan, I had a look at stencil buffers in other playground examples, but I can’t understand what’s the logic behind them :confused:

Could you please explain? :pray:

You know what I will do a playground for you later tonight :slight_smile: cause I love those kind of PGs.

It is end of school time so busy for a couple of hours.

1 Like

https://playground.babylonjs.com/indexStable.html#7LCQQ3#6

Here you go

1 Like

Thank you @sebavan, for both the help and the explanation, you saved my day! :pray:

1 Like

Actually you do not even need to tweak the depth:
https://playground.babylonjs.com/indexStable.html#7LCQQ3#7

1 Like

Good to know! Thanks again! :pray: :pray: