randomdog Posted October 26, 2017 Share Posted October 26, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 26, 2017 Share Posted October 26, 2017 Is the SphericalMode something that can work? https://www.babylonjs-playground.com/#203BJM#7 Quote Link to comment Share on other sites More sharing options...
randomdog Posted October 27, 2017 Author Share Posted October 27, 2017 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 27, 2017 Share Posted October 27, 2017 You have to use the reflectionTexture and not the diffuseTexture as only the first one can have different texturing mode Quote Link to comment Share on other sites More sharing options...
randomdog Posted November 3, 2017 Author Share Posted November 3, 2017 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 3, 2017 Share Posted November 3, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 3, 2017 Share Posted November 3, 2017 Only option I can see: do the mapping in a tool like blender or 3dsmax and bake it directly into the material itself Quote Link to comment Share on other sites More sharing options...
randomdog Posted November 3, 2017 Author Share Posted November 3, 2017 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. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.