![]() Very random example, TexMesh pro ask for one bit to do some stuff in their shader, and a TextMeshPro can be Lit, unlit or simple Lit. But have in mind that it will come sooner than later that you will require a bit per Material (i.e not based on the Material type but a bit for any kind of Material). How do you expect thing to work at all if users can change stencil function? It mean you have no guarantee that your Material bits will be written, or I missed something?īut I would like to keep setting stencil state centrally (via C# code) for the material types (or whatever we use stencil for in the future), as it avoid code duplication and is more maintainable long term (also this would prevent users from hard-coding our constants in their shader code).Īvoiding to have Material bits everywhere is a good thing, I am agree. At the moment, the user can not only change the stencilRef but also actual stencil functions. Probably the structure would be GfxStencilState or DeviceStencilState. ![]() But maybe I miss a usage you have that I haven't noticed? This doesn't require any change in shader graph, no problem with messing with the tag with custom shader, HDRP will be more happy to use it and it is more future proof. This is cleaner from my point of view and more efficient. Ref = enableStencilUsersMak ? (currentRef | StencilUserRef) : currentRef ĬurrentRef &= ~StencilUserMask to remove any garbage Mask = enableStencilUsersMak ? (currentMask & StencilUserMask) : currentMask // Enabled users bits When enableStencilUsersMak is true, we combine any stencil state of Material with the one from the user. of course we should use a struct or something cleaner) What we should do instead of adding a custom tag option to DrawRenderer is to add an option specifically for this cases of reserved bit.ĭrawRenderer(., bool enableStencilUsersMak, StencilUserMask, StencilUserRef). What about instead providing the stencil mask we want to apply to the pass?īoth URP and HDRP have a concept of users reserved stencil bit. Mean a loop of 32 for every objects to looks for stencil state. For HDRP using the tag system required 32 variant of the stencil settings (because our stencil bits aren't exclusive each other, it can be a combination of them). However, with time and more feature (in particular decal, object motion vector, SSR etc.), you will start to use more stencil bit and you will need more tag. So you end with few combination for your tag. My worries is that right now the system work because URP use a minimal set of bits in stencil. Hey, I have been thinking about this after Kay-chang talked about this PR.
0 Comments
Leave a Reply. |