JohnK Posted July 8, 2016 Share Posted July 8, 2016 Have made this http://www.babylonjs-playground.com/#20OAV9#20 trying to understand the whys and wherefores of the four coordinatesMode(s). You can see the differences as you rotate the camera. Some obvious differences are PROJECTION_MODE uses part of the whole image, PLANAR_MODE uses the image repeated 4 times, CUBIC_MODE repeats of the image depend on the size of the image, SPHERICAL_MODE works best on spheres (surprise surprise). Question when would you use each mode and why? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 9, 2016 Share Posted July 9, 2016 https://www.cs.unc.edu/xcms/courses/comp770-s07/Lecture12.pdf This will help a little... maybe. Quote Link to comment Share on other sites More sharing options...
JohnK Posted July 9, 2016 Author Share Posted July 9, 2016 Thanks Wingy I was going to give up but the lecture has given me some ideas to think about. When I can explain it with an example in PG I will know I understand it. Will hang in there for a while longer. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 9, 2016 Share Posted July 9, 2016 OFFTOPIC: That looks just amazing! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 10, 2016 Share Posted July 10, 2016 Hey hey! Interesting question, let me try to provide some insights here: Planar mode is used when you want to simulate a big screenwide plane as source for the coordinates. The reflection coordinates comes from the projection of the mesh coordinates onto the plane: https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/reflectionFunction.fx#L35 Projection is used by shadows or mirror: it simulate the projection of the texture onto the mesh itself: https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/reflectionFunction.fx#L51 CUBIC_MODe is designed for cube texture where coordinates are computed using normal and view direction as well: https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/reflectionFunction.fx#L42 (note that here only direction is used unlikely what we do for planar which turns to be really similar. You can consider that planar is the cubic for 2d textures Spherical mapping...well..is for sphere (oh??) where we compute a spherical projection: https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/reflectionFunction.fx#L23 JohnK, Nabroski and Wingnut 3 Quote Link to comment Share on other sites More sharing options...
JohnK Posted July 11, 2016 Author Share Posted July 11, 2016 Thank you Deltakosh am getting the idea. Have created a PG that shows their effects on planes, boxes and spheres. Cubic needs a bit more thinking about. http://www.babylonjs-playground.com/#20OAV9#21 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 11, 2016 Share Posted July 11, 2016 You need a cube map for the cubic mode: http://www.babylonjs-playground.com/#1HENJL 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.