Skip to content

Unintended Bloom Flare from Gradient Shader #2

@SeraEris

Description

@SeraEris

I noticed this while using a simple assembly composed of a basic sphere and cylinder; when the objects are floating in the void with just the gradient skybox, with colors set to non-emissive values, there's unintended 'flaring'.

This does not happen with Hemisphere, even when it's values are cranked, leading me to believe this is a shader math issue.

Flare Example

Inspector Config

It looks like the issue is ( probably ) in the frag() function of Gradients.shader, as I've band-aided it with a couple of clamps to 'fix' the problem.
I worry this may affect HDR color, so I don't want to advocate this is the 'real' fix, but it does resolve my problem, so I figured I'd file a Git Issue.

half4 frag(v2f i) : SV_Target
{
    half3 d = normalize(i.texcoord.xyz);
    half3 c = _BaseColor;
    c += _Color1 * clamp(pow((dot(d, _NormalizedVector1) + 1) * 0.5, _Exponent1),0,1);
    #ifdef _SWITCH2_ON
    c += _Color2 * clamp(pow((dot(d, _NormalizedVector2) + 1) * 0.5, _Exponent2),0,1);
    #endif
    #ifdef _SWITCH3_ON
    c += _Color3 * clamp(pow((dot(d, _NormalizedVector3) + 1) * 0.5, _Exponent3),0,1);
    #endif
    #ifdef _SWITCH4_ON
    c += _Color4 * clamp(pow((dot(d, _NormalizedVector4) + 1) * 0.5, _Exponent4),0,1);
    #endif
    return half4(c * _Exposure, 1);
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions