Open Aerizeon opened 3 years ago
This is not a bug, just the way light cookies work. For them to work properly you need to always use the Clamp mode and have some clearance at the edges of the texture to prevent banding.
Even though it only affects Toon and reflections, and not PBR materials?
I'm re-opening this one. Largely so I can do a bit of quality of life investigation on it.
It affects PBR materials as well, though not always, you will sometimes get the effect randomly popping in and out. This is based on Unity's light cookie rendering, we're not doing anything special there.
Typically in Unity you'd set the texture to "Cookie" type, which sets the wrap mode to clamp and adds black edges around the texture to prevent banding. See their documentation here: https://docs.unity3d.com/Manual/TextureTypes.html#cookie
I'm re-opening this one. Largely so I can do a bit of quality of life investigation on it.
Hmm- I'm almost wondering if a mechanism similar to how normal maps are treated could be beneficial?
E.g. normal maps when placed in the NormalMap field of a material will be marked IsNormalMap
.
Perhaps a mechanism to mark a texture as a 'Cookie' type that forces the wrap mode to clamp/adds black edges around the texture as Frooxius noted, @Geenz?
@shiftyscales @Frooxius Honestly, having done a bit of a refresher with Unity's rendering pipeline around pixel lights, cookies, and so on - I'm seriously considering a general light cookie pass to make them more flexible (such as supporting "color" light cookies - useful for things like caustics, projectors, and so on). It's probably not a bad idea to improve the light cookie authoring flow generally as a result. I'll go ahead and make an epic on the graphics board to track this.
Describe the bug
When using a spot light with a light cookie, an unusual banding effect is seen on Toon materials, and the reflection of Toon and PBR materials in a mirror, even when they are outside of the cone of the spot light.
Additionally, when the light cookie is not set to
Clamped
mode, the effect will show a tiled version of the light cookie instead of the banding.The appearance of both of these are affected by the current MipMapBias setting of the lightcookie texture.
Relevant issues
[Did you find any existing issues relevant to this one? If you found the same issue, please contribute to that one instead of making a duplicate.]
To Reproduce
Expected behavior
Lighting should not show on items outside of the spot cone, and should not have visual artifacts.
Screenshots / Video
With WrapMode Repeat
Settings: Effect:
With WrapMode Clamp
Settings: Effect:
Bug information (please complete the following information):
Reporters:
Reddragon Epsilion