Jump to content

postprocess in 3d view


Recommended Posts

Hi there


is that normal  when I switch to :


camera.setCameraRigMode(BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH, rigParams);


all postprocess effect is missing !



and I realize background is black if do not have any skybox - is there any chance to change it ?

Link to comment
Share on other sites

It works when I call:

camera.setCameraRigMode(10,{interaxialDistance: 0.0637}); // 10 is anaglyph

What camera are you using?  Clear color is set by:

scene.clearColor = new BABYLON.Color3(1,1,1); // for white

I am not even sure what you are asking to change.  Can you do a playground?

Link to comment
Share on other sites

So in playground

that simple version:


last 2 lines  add postprocess and 3d camera 

You right about camera you can use clearColor , but can it be Color4 - with transparency as I will like to keep background picture ????

and is look like post process make problem with background - is look like this same ignore Color4 - so mask transparency ??? -

IS there chance to keep clearColor in Color4 - so we can keep picture in background with postprocess and real 3d view???

Link to comment
Share on other sites

Did double check gl.clearColor does take an alpha value, so ok at an OpenGL level. SetCameraRigMode clears all post processes. Could be smarter about it & only clear its own. the Oculus thing with vrmetrics I mentioned did not work on github . DK could not reproduce on 2.2

If you want, you can make changes if you know typescript. then PR.

Link to comment
Share on other sites

  • 3 weeks later...

I do not know if the answer yes.  I know that the shader that combines the 2 camera pieces, always write 1.0 in the alpha channel, forcing no alpha.  Here is anaglyph.fragment.fx:

#ifdef GL_ESprecision highp float;#endif// Samplersvarying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D leftSampler;void main(void){    vec4 leftFrag = texture2D(leftSampler, vUV);    leftFrag = vec4(1.0, leftFrag.g, leftFrag.b, 1.0);	vec4 rightFrag = texture2D(textureSampler, vUV);    rightFrag = vec4(rightFrag.r, 1.0, 1.0, 1.0);    gl_FragColor = vec4(rightFrag.rgb * leftFrag.rgb, 1.0);}

I am not sure what you would change it to.  Multiplying the leftFrag alpha with the rightFrags is definitely wrong.  To see if anything other than 1.0 did anything, you could just arbitrarily change to 0.2 in the last line.  


If you did not want to bother setting up to do your own builds, you could probably do a text editor replace against the debug .js file and get away with it.  Assuming it works, & does not look bad, you might think about forking the repository to put in a more formal change for your needs. 


Personally, I suspect it will look bad, & make it harder to visualize a 3D image.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...