Skip to content

WebGPU: UV flips Y on WebGL fallback when a texture node is reused #31750

@shotamatsuda

Description

@shotamatsuda

Description

Using WebGPURenderer with WebGLBackend, reusing a texture node to assign a RenderTarget texture flips the Y texture coordinate. This can be reproduced with nodes in the examples such as GaussianBlurNode.

This might be caused by some internal state for texture coordinate abstraction not being updated or relying on a wrong assumption, but I'm not sure where.

Reproduction steps

  1. Render a texture using a texture node.
  2. Assign a new texture to the texture node to reuse it.
  3. Render the texture.

Code

const textureNode = texture(null)
const material = new NodeMaterial()
material.fragmentNode = textureNode
const mesh = new QuadMesh(material)

// First pass:
textureNode.value = image
const rt1 = new RenderTarget(100, 100)
renderer.setRenderTarget(rt1)
mesh.render(renderer)

// Second pass:
textureNode.value = rt1.texture
// Uncommenting the line below doesn't change the result, but uncommenting it
// and commenting out the above line does change the result.
// material.fragmentNode = texture(rt1.texture)
const rt2 = new RenderTarget(100, 100)
renderer.setRenderTarget(rt2)
mesh.render(renderer)

See also the fiddles below.

Live example

Screenshots

WebGPU:
Image

WebGL fallback:
Image

Version

r179

Device

Desktop

Browser

Chrome

OS

MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions