Skip to content

Question: Luma v9 way to use color picking #2321

@Aystein

Description

@Aystein

I did not found another channel for questions, so I created this issue as it may be interesting for other people too.

I am trying to implement object picking using the inbuilt picking module of luma.gl, (https://luma.gl/docs/api-reference/shadertools/shader-modules/gpu-picking#usage) but the documentation is not quite clear on how the actual picking process works.

The example that uses picking (instanced cubes) seems to not do anything with it (no highlight). I tried something similiar

      this.shaderInputs = new ShaderInputs({
          picking,
      });
      this.picker = new PickingManager(this.device, {
          // @ts-expect-error example
          shaderInputs: this.shaderInputs,
      });

and then after my main pass

        this.picker.clearPickState();
        const pickingPass = this.picker.beginRenderPass();
        model.draw(pickingPass);
        pickingPass.end();

        const info = this.picker.getPickInfo([mouseX, mouseY]); // mouseX, mouseY are pixel coordinates from top-left

which does not return anything and throws this warning

Image

my vertex shader has this as last line
picking_setPickingColor(vec3(0.5, 0.5, 0.5)); // some constant color for testing purposes

and my fragment shader
picking_filterPickingColor(fragColor);

Is there a working example or a documentation page which could help me resolve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions