Author Topic: DeferredMaskWrite support for objects using cutout shader ?  (Read 47 times)

frozenempire

  • Full Member
  • ***
  • Posts: 235
    • View Profile
    • The Frozen Empire
Hey, it's been a while !

Is there any simple-ish way to modify the mask writing shader to accept the main texture of the object being rendered and avoid writing to the mask if the alpha is below some cutoff value ?

Cheers

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 6851
    • View Profile
Re: DeferredMaskWrite support for objects using cutout shader ?
« Reply #1 on: April 08, 2021, 09:56:03 PM »
In deferred, right?
Yes, it could be added.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 6851
    • View Profile
Re: DeferredMaskWrite support for objects using cutout shader ?
« Reply #2 on: April 08, 2021, 11:34:34 PM »
Added already. Please check latest beta. You will find a new "Exclusion Cut-Off" slider in the Global Snow Coverage Script (it's per object).

frozenempire

  • Full Member
  • ***
  • Posts: 235
    • View Profile
    • The Frozen Empire
Re: DeferredMaskWrite support for objects using cutout shader ?
« Reply #3 on: April 09, 2021, 10:57:07 PM »
Many thanks for the addition!

It gave me what I needed to actually implement a variant of that since I have custom exclusion logic implemented (from previous discussions) that is excluding based on exclusion layers within LODGroup objects, rather than using IgnoreCoverage scripts.

Adjustments I made:
- Checked for the presence of _Cutoff rather than _MainTex and passed the value of _Cutoff from the renderers material to the mask shader (rather than take from IgnoreCoverage script)
- Resort to the default mask shader if there is no _Cutoff property in the renderers material
(So there are 2 variants of mask shader - the original and the one with cutoff)

Seems to work nicely - many thanks for the hints :)

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 6851
    • View Profile
Re: DeferredMaskWrite support for objects using cutout shader ?
« Reply #4 on: April 10, 2021, 10:28:42 AM »
That's great!