viewer.scene.postProcessStages.add(new Cesium.PostProcessStage({ fragmentShader : fragmentShaderSource}));
viewer.scene.postProcessStages.add(new Cesium.PostProcessStage({ fragmentShader : fragmentShaderSource, uniforms : { customTexture : '../images/bumpmap.png' }}));
uniform sampler2D customTexture;
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}));
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 .
------------------ 原始邮件 ------------------发件人: "Omar Shehata"<omar.sameh.shehata@gmail.com>;发送时间: 2018年12月12日(星期三) 凌晨3:30收件人: "cesium-dev"<cesium-dev@googlegroups.com>;
主题: [cesium-dev] Re: how transport a picture to postProcessStage
You can pass in a uniforms object, see the docs:--For example, I modified the post process Sandcastle here to add another texture:So instead of:
viewer.scene.postProcessStages.add(new Cesium.PostProcessStage({fragmentShader : fragmentShaderSource}));I had:
viewer.scene.postProcessStages.add(new Cesium.PostProcessStage({fragmentShader : fragmentShaderSource,uniforms : {customTexture : '../images/bumpmap.png'}}));
You can then access this in the shader by declaring the uniform:
uniform sampler2D customTexture;
Does that help?
On Sunday, December 9, 2018 at 12:23:27 AM UTC-5, 7737...@qq.com wrote:hi,friend, I want to Transport a picture to uniform sample2D pic in postProcessStage ,now i have rgb array or jpg in textureUnit1
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/9yJ-rkWf5d4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.
my friend, so I need tranport a texture in selfdefine frame buffer to postprocessstage,but I dont have idea
---原始邮件---发件人: "Omar Shehata"<omar.sameh.shehata@gmail.com>发送时间: 2018年12月13日(星期四) 凌晨0:27收件人: "cesium-dev"<cesium-dev@googlegroups.com>;
By the way ,are gl_FragCoord.z and gl_FragCoord.w in postProcessStage the same as raw WebGL ?
do i need bind texture created by webgl to a textureUint? what' the max number of textureUnit used by cesium?
---原始邮件---发件人: "Omar Shehata"<omar.sameh.shehata@gmail.com>发送时间: 2018年12月14日(星期五) 凌晨1:08
发件人: "Omar Shehata"<omar.sameh.shehata@gmail.com>;发送时间: 2018年12月18日(星期二) 凌晨2:25收件人: "cesium-dev"<cesium-dev@googlegroups.com>;
my friend,,the texture object you mentioned is gl.createtexture or class defined by cesium
---原始邮件---发件人: "Omar Shehata"<omar.sameh.shehata@gmail.com>发送时间: 2018年12月14日(星期五) 凌晨1:08
Is there some example code for rendering to FBO, I am still blocked here
------------------ 原始邮件 ------------------发件人: "Omar Shehata"<omar.sameh.shehata@gmail.com>;发送时间: 2018年12月19日(星期三) 凌晨5:58收件人: "cesium-dev"<cesium-dev@googlegroups.com>;