Skip to content

Sample Wanted: Cursor-Responsive Shader Interaction #527

@yashrajbharti

Description

@yashrajbharti

I’d like to propose a cursor-interaction WebGPU sample that demonstrates fragment shader logic reacting to cursor input in a visual way.

Core idea (Basic sample):

A single 3D model where the fragment shader changes texture/material under the mouse cursor. This would teach:

  • Uniforms or buffers for passing cursor position
  • Simple fragment logic for region-based effects
  • UI-to-shader pipeline interaction

Optional advanced extension

This may be too much for a sample but we can -
Stack two models and use the same shader logic to "reveal" one under the other, like a square-cut mask beneath the cursor.

Example / Inspiration

apple.mp4

(Credits: Amin Ankward)

But we can keep this separate unless it’s of interest.

Why?

There aren’t many visual WebGPU samples showing real-time interaction with shaders. This could make fragment shaders feel more intuitive for beginners, while giving room for deeper exploration such as this reveal effect advanced use case.

UPDATE: We now have two options to choose from #530 and #534 (happy to move forward with the one team aligns with! 😄)

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