Jump to content

Troubleshooting ShaderMaterial [Solved]


Raitch
 Share

Recommended Posts

So I'm trying to recreate this panoramic view generator from Three.js (https://github.com/spite/THREE.CubemapToEquirectangular/blob/master/src/CubemapToEquirectangular.js) that can generate a 360 view from the point.

With everything I've read up on, I've so far managed to recreate most parts here: http://www.babylonjs-playground.com/#8HXI0G

However applying the ShaderMaterial to my plane, it simply disappears (commenting `plane.material = myShaderMaterial` brings it back). There are *very* many reasons I can imagine to be the cause but I can't think of many ways to troubleshoot it. It uses the same vector and shader code as the Three.js one at least so I guess that shouldn't be the issue.

Does anyone have a clue on where I could go from here to reach the next step on my ShaderMaterial?

pano-CubemapToEquirectangular - Unmanaged-1496917388967.png

Link to comment
Share on other sites

If you don't mind, do you know how I achieve this in Babylon? (https://github.com/spite/THREE.CubemapToEquirectangular/blob/master/src/CubemapToEquirectangular.js)

this.quad.scale.set( this.width, this.height, 1 );

this.camera.left = this.width / - 2;
this.camera.right = this.width / 2;
this.camera.top = this.height / 2;
this.camera.bottom = this.height / - 2;

I thought setting: (http://www.babylonjs-playground.com/#8HXI0G%231)

plane.scaling.x = canvas.width;
plane.scaling.y = canvas.height;

camera.orthoLeft = (canvas.width / - 2);
camera.orthoRight = (canvas.width / 2);
camera.orthoTop = (canvas.height / 2);
camera.orthoBottom = (canvas.height / - 2);

Would do it, but it doesn't seem to "zoom out". Is there perhaps some other nice way to make a plane cover the entire camera? Am considering to use Canvas2D but I doubt ShaderMaterial works well with it since it's a material and not texture.

 

Nevermind; apparently `camera.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA;` is a thing!

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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