Skip to content

halfRes compositor renders sky pixels as AO color (black) when scene.background is a texture #51

@ashconnell

Description

@ashconnell

In src/EffectCompositer.js:179-180, the halfRes path handles sky pixels
(depth == 1.0) by setting texel = vec4(0.0, 0.0, 0.0, 1.0). Since only
texel.r is read downstream as the AO value, this makes
finalAo = pow(0, intensity) = 0, and the final

  mix(sceneTexel.rgb, aoApplied, 1.0 - finalAo)                                                                                            

collapses fully onto aoApplied — i.e. the AO color (black by default).
The result is that when scene.background is set to a texture, the sky
renders solid black. The non-halfRes path has no such branch and works
correctly.

Repro: three.js r180, postprocessing 6.39, N8AOPostPass with
configuration.halfRes = true and scene.background = someEquirectTexture.
Disabling halfRes or using an in-scene sky sphere (which writes depth < 1)
both avoid the issue.

Suggested fix: texel = vec4(1.0, 0.0, 0.0, 1.0)texel.r = 1 gives
finalAo = 1, so the mix leaves sceneTexel untouched on sky pixels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions