Skip to content

V7 issue with custom points shader (THREE.ShaderMaterial) and default THREE.SpriteMaterial #708

@japhiaolson

Description

@japhiaolson

Description of the bug

When enabling gbuffer normals in the render pipeline, custom Points (implemented with THREE.ShaderMaterial) and default THREE.SpriteMaterial objects fail to render and become invisible.

To reproduce

Enable NORMAL pass to a scene that contains a SpriteMaterial or Points using ShaderMaterial. Everything renders properly except the sprite or points.

Workaround

Adding the following to the SpriteMaterial onBeforeCompile or directly to the custom Points fragment shader make the sprites or points render properly:

// Variable declarations
layout(location = 1) out vec3 gBufferNormal;
// In main
gBufferNormal = normalize(vWorldNormal);

Expected behavior

I made a custom effect to add SSAO to the RenderPipeline which requires the GBuffer NORMAL pass to be enabled, and everything works as expected, except the Points and SpriteMaterials don't render.

Screenshots

Screenshot is with GBuffer.NORMAL enabled and white outlines are without this.input.gBuffer.add(GBuffer.NORMAL) enabled in the effect (and without the noted GLSL fix above).

Image

Library versions used

  • Three: 0.176.0
  • Post Processing: 7.0.0-beta.11

Desktop

  • OS: Windows
  • Browser: Chrome 137.0.7151.104
  • Graphics hardware: NVIDIA

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions