Skip to content

[p5.js 2.0 Bug Report]: [WEBGPU] Rendering multiple instances of a model doesn't work yet #8343

@davepagurek

Description

@davepagurek

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.2-rc2

Web browser and version

Chrome 143

Operating system

MacOS 15.2

Steps to reproduce this

Steps:

  1. Create a WebGPU canvas
  2. Create a shader that moves vertices using the instance id
  3. Create some custom geometry
  4. Draw the geometry using the shader + an instance count

Nothing renders in WebGPU mode, but it renders correctly if you switch back to WebGL.

Snippet:

Live: https://editor.p5js.org/davepagurek/sketches/FBR7lqDXS

let geom
let sh
async function setup() {
  await createCanvas(400, 400, WEBGPU)
  // This works
  // createCanvas(400, 400, WEBGL)
  
  geom = buildGeometry(() => sphere(10))
  sh = baseMaterialShader().modify(() => {
    getWorldInputs((inputs) => {
      inputs.position.x += instanceID() * 30
      return inputs
    })
  })
}

function draw() {
  background(100)
  
  push()
  noStroke()
  shader(sh)
  model(geom, 5)
  pop()
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions