CesiumGS / CesiumGS/cesium

PostProcessStageComposite inputPreviousStageTexture doesn't work in some cases

Open
#9,812 0 comments 0 reactions 0 assignees View on GitHub
category - post-processing
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Sandcastle example: https://sandcastle.cesium.com/#c=pVVdb9owFP0rFi8NEjUkA6pRiiYF7WnTqlHtZanATW7AmmNHtpOOTfz3+QNaPoK20RdIru89555z8SUVXGlUU3gGie4Qh2cUg6JVgb+5WJC0UvceC64J5SCTVvs24Qn3NTglBUiCc7Z+EMHvhCOUgdKUE00FH+3AYiK1eSL8Hc6lKKawlAAquL7p4154Mxx2UL+Hh+8Hg8g+9dodCyQkBUPqgRw0QisgGeXLF+DPRK+wFl9NlHAV9PC2FqGS6nR1Lu86HOwyN+Zz07aKUucFF6KcrUjm/FgkvOI0F7JAihQlAxlNUSqYkA/wU1cSjBU1kWvTEqohjVA91/4gFkJm1gZQNkfQDBXGv8AwOSlLNv8oyTK2WIZoWxVNg330TiOe9X+T8MVrz0qTJYSH87sXSt9LYaanZvbYD4ebcY3QlSuYh1fOgdz0URinverRngNH1riqKPx/omgeniNb+GkdGGQD23mfGGVc7gehGd6tT9jYr0Vzo9FlnUb/bMwhW3QhW3TZGP5CF4uiFIrqs7ye1QXUCH1/8azzKuixmflNxM20e6yPDeZeYu1ltr5BW7OynTCnCyHKy8pAQk1F5TG3d32EcsIUNDWl7O/er1uVAgdcHrWlEu4TMcmywG+D9mksarc6rbHSawaT3fX6QI0iqVElWYBxV4PZcnbJdJ+q9AdonCq1u2rj7n7pOKM1otldwx8EShlRypzkFWMz+guS1mTcNfknpUy4df6lBsnI2qatwsknH8QYj7vmtblSC8GeiDxC/gM

The core code:
```js
const noopShader = `
uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = texture2D(colorTexture, v_textureCoordinates);
}
`

const stage1 = new Cesium.PostProcessStage({
name: 'stage_1',
fragmentShader: noopShader,
})

const stage211 = new Cesium.PostProcessStage({
name: 'stage_2_1_1',
fragmentShader: `
void main()
{
gl_FragColor = vec4(1.0);
}
`,
})

const stage2121 = new Cesium.PostProcessStage({
name: 'stage_2_1_2_1',
fragmentShader: noopShader,
})
const stage2122 = new Cesium.PostProcessStage({
name: 'stage_2_1_2_2',
fragmentShader: noopShader,
})

const stage212 = new Cesium.PostProcessStageComposite({
name: 'stage_2_1_2',
stages: [stage2121, stage2122],
})

const stage21 = new Cesium.PostProcessStageComposite({
name: 'stage_2_1',
stages: [stage211, stage212],
})
const stage22 = new Cesium.PostProcessStage({
name: 'stage_2_2',
fragmentShader: noopShader,
})

const stage2 = new Cesium.PostProcessStageComposite({
name: 'stage_2',
stages: [stage21, stage22],
inputPreviousStageTexture: false,
})

const stages = viewer.scene.postProcessStages
stages.add(stage1)
stages.add(stage2)
```
Although the `stage2` create with `inputPreviousStageTexture: false`, the `stage22`'s input is the output of the `stage21`, the map turns to white

Browser: Chrome 92.0.4515.159

Operating System: macOS 10.15.7

Contributor guide

Open the contributing guide

Research direction

Start by running the linked Sandcastle example and tracing the PostProcessStageComposite setup for stage2, stage21, and stage22. Read the inputPreviousStageTexture handling in the post-process stage entry points and verify the expected texture flow. Done means stage22 receives stage21's output while stage2 has inputPreviousStageTexture set to false, without the scene turning white.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.