CesiumGS / CesiumGS/cesium

Custom Shaders: Implicit Tile Coordinates as a built-in uniform?

Open
#9,736 1 comment 0 reactions 0 assignees View on GitHub
category - custom shaders category - model/gltf
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

While working on #9725, I observed that it would be nice if the (level, x, y, [z]) coordinates from the [`3DTILES_implicit_tiling`](https://github.com/CesiumGS/3d-tiles/blob/3d-tiles-next/extensions/3DTILES_implicit_tiling/0.0.0/README.md) implementation were available in custom shaders.

This should be easy to implement, if the `ModelExperimental` has a pointer to `tile.implicitTileCoordinates`, I think this would be implemented by creating an automatic `uniform ivec4` with value `ivec4(level, x, y, z)`. Actually... `ivec4(x, y, z, level)` would be better, then `coordinates.x == x`, and so on.

Based on the existing limitations with index sizes, the x, y, and z components are under 16 bits, so they could fit in either an `ivec4` or `vec4`

@lilleyse @sanjeetsuhag any opinion on which data type to use for this?

Contributor guide

Open the contributing guide

Research direction

Start by tracing ModelExperimental and the custom shader automatic-uniform handling, then inspect how tile.implicitTileCoordinates is exposed. The issue is complete when the implicit tile level and coordinates are available to custom shaders in the agreed uniform representation; the payload names no files or tests, so those must be located first.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.