回复:[cesium-dev] Re: how transport a picture to postProcessStage

or the way below will work?

my fuction(){

1.render scene, add postProcessStage1 ,


2.camera fly to some place,

3.add postProcessStage2. and postProcessStage2

}

The default input sampler2D uniforms ( colorTexture and depthTexture) of postProcessStage2 can be postProcessStage1 output.

or it is the same as postProcessStage1 input colorTexture .

Yeah all you have to do is just add a second post process stage. The output from the last one will be the colorTexture. So for example, these two:

var fragmentShaderSource = `

uniform sampler2D colorTexture;

varying vec2 v_textureCoordinates;

void main(void)

{

gl_FragColor = texture2D(colorTexture, v_textureCoordinates); 

gl_FragColor.r = gl_FragColor.g;

}`

viewer.scene.postProcessStages.add(new Cesium.PostProcessStage({

fragmentShader : fragmentShaderSource

}));

var fragmentShaderSource = `

uniform sampler2D colorTexture;

varying vec2 v_textureCoordinates;

void main(void)

{

gl_FragColor = texture2D(colorTexture, v_textureCoordinates); 

gl_FragColor.g = gl_FragColor.b;

}`

viewer.scene.postProcessStages.add(new Cesium.PostProcessStage({

fragmentShader : fragmentShaderSource

}));

``

The first shader sets the red to green, and then the second sets the green to blue. If you reverse the order you add these two shaders in the output is different. Here’s a Sandcastle link where you can try that.

I’m curious to hear, what kind of application are you working on that uses this?

I try to analysis the visibility form a view ,shows the result in the another view.

or render result to entity like mirror.