Jump to content

Project Spherical Panorama on Mesh from Viewpoint


randomdog
 Share

Recommended Posts

Hey folks,
first of all: thank you for this great forum. It came to the rescue a few times, now. So, thanks everyone, who's participating.

I'm currently working on an idea, where I would like to project a spherical panorama texture to a mesh from inside (meaning from the viewpoint). Similar to a standard VR-Viewer, where the texture is mapped on a sphere from inside.  But in my case I would like to map it on the actual scene-mesh which I get from 3dsmax. 
Now, I know, that I could create the UV's or bake the texture in 3dsmax, but I want to switch between two camera positions and therefore change the projected texture and the center of the spherical projection.

I already got camera mapping to work with a planar image like this: http://www.babylonjs-playground.com/#203BJM#2 but that's not exactly what I need. My image has to get spherical wrapped around the camera AND stay in position, while the camera moves around.

Is this understandable?

I could provide a small scene, which I need to create, first, as my actual scene is way too big and consists of too many elements. But maybe someone already got a solution or an idea. I'm not even sure, if this is possible with babylonjs-coordinates modes or has to be solved with a custom shader.

thanks

Link to comment
Share on other sites

I already tried this, but as it is not one mesh, with a spherical uv-mapping, but several meshes with different mappings, just changing the mapping mode, won't work.

Here are some pictures of the problem. First is the rendering, second the mesh in babylon and third the mesh with a diffuse-texture, set to spherical_mode.

What I really want to archieve is a look like the rendering, but projected on the meshes, so when I move a bit to the side, the Panorama gets realistically distorted.

rendering.jpg

meshes.jpg

mapping.jpg

Link to comment
Share on other sites

Thank you @Deltakosh. I already tried that.

It took me a while, but I created a Playground for this issue.
http://www.babylonjs-playground.com/#IDGHBP#5

As you can see, the reflection doesn't bring the right result as it moves with the camera and is mirrored.

What I actually want, is the projected Texture on the meshes to look exactly like the spherical panorma itself, as if there wasn't any geometry at all and so when you move a bit with the arrow-keys, you can see, that the texture is actually just projected on the surfaces from the initial point of the camera.

Link to comment
Share on other sites

This line does nothing:

panomaterial.emissiveTexture.coordinatesMode = BABYLON.Texture.SPHERICAL_MODE;

as only reflectionTexture can have special reflection mode 

Regarding your other point it is a bit tough ;) as you want spherical projection on non spherical surface. I have no good answer here

 

I tried with PROJECTION_MODE but this is not correct either

Link to comment
Share on other sites

Hi @Deltakosh,

yes, I'm biting my teeth on this one, for a while now.
I already considered texture-baking, but in my actual scene I will have a few camera-points which the user can move between and I need to change the spherical mapping to a different texture and center point on the fly.

I also tried to solve it with a glsl shader, where I was getting close, but not 100%. Problem there was to spherical wrap the texture around the viewpoint and that I actually don't have any knowledge of glsl. :D

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