playcanvas / playcanvas/engine

Support 9-slice and pixel-perfect on UI custom shader example

Open
#3,883 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: examples area: ui
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

Description

The current UI custom shader example uses this line to generate screen position of the vertex: https://github.com/playcanvas/engine/blob/ab73ebbf1c9eda8a41aca73eb2336b8b33f412be/examples/src/examples/user-interface/custom-shader.tsx#L32 which is based on this line: https://github.com/playcanvas/engine/blob/ab73ebbf1c9eda8a41aca73eb2336b8b33f412be/src/graphics/program-lib/chunks/transform.vert.js#L86

Perhaps it would be better to have it support 9-slice and pixel-perfect use-cases too. This might be easier to do once standard refactoring is done.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/src/examples/user-interface/custom-shader.tsx at the screen-position calculation and compare it with src/graphics/program-lib/chunks/transform.vert.js. Read the surrounding transform logic and any standard refactoring related to these paths first. Done means the custom shader example supports both 9-slice and pixel-perfect UI use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.