Opacity mask causes problem with shadows

Hello,
Im using simple material setup with two sphere masks (one on actor, second on camera)…
If im using both masks together, it causes shadow problems as shown in video:

If i delete one mask (but that bottom mask, thats broken), then everything works properly (im using dither opacity mask)… I dont know whats with that but that nodes are broken somehow… (edit: all stats at both masks are same… only location of creating mask not)

You are adding two sphere mask. Maybe you should clamp that value between 0 and 1.

I dont know how to clamp that values, but i tried to lerp them… It worked but unfortunately it caused another problem with rendering (ghost effects, i can turn them off with lower AA but then it doesnt looks well)…

Strange is, that two masks worked fine before i rebuilded lightning… also they worked for translucent material well (but not tested yet how after rebuild)…

I have plan C with cylinder mask but i wanted to solve these two masks…

There is clamp node. Default values are 0 and 1. Just use that.

Could you please tell me where to connect which pin? :slight_smile: Im still material amateur and dont have idea how or which value to clamp.

x -> Clamp -> 1 - x -> Opacity Mask.

amazing! clamp 0 - 1 did not worked, bud 0 - 0,99 works perfectly :slight_smile: how strange stuff…

so this is SOLVED

Its not strange, its that you aren’t understanding the math of what is happening.

The sphere masks output a value of 0 outside the mask 1 inside with a transition zone controlled by hardness.

So if you have two sphere masks overlapping you’ll have values from 0-2. Then when you subtract that from 1 you get a range of 1 to -1. Negative values plugged into just about anything in the shading system result in anomalous, often unpredictable effects.

Clamping the values to 1-0 gives you transparent to fully opaque.

I am glad you solved it.