meteoritool Posted February 14, 2016 Share Posted February 14, 2016 Hi, I find instances of a groundFromHeightMap mesh reacting funny : http://playground.babylonjs.com/#25K1LA#0 Is it a bug ? Or what is the best way to create instances of grounds from height maps ? Thank you guyz for your help ! Quote Link to comment Share on other sites More sharing options...
jerome Posted February 14, 2016 Share Posted February 14, 2016 what is the problem ? Quote Link to comment Share on other sites More sharing options...
meteoritool Posted February 14, 2016 Author Share Posted February 14, 2016 the instances "glitch" disappear when moving the camera this behavior is the same on every navigator i've tested, on OSX. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 15, 2016 Share Posted February 15, 2016 Wooot...this looks like a bug to me! I'll check it tomorrow Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 15, 2016 Share Posted February 15, 2016 And it is.............not a bug This comes from the fact that CreateGroundFromHeighMap is asynchronous because it needs a texture. SO you have to create your instance when the ground is ready like this: http://playground.babylonjs.com/#25K1LA#1 Wingnut and meteoritool 2 Quote Link to comment Share on other sites More sharing options...
meteoritool Posted February 15, 2016 Author Share Posted February 15, 2016 Thank you ! This perfectly solves the problem ! If I understand right, the height map image must be already loaded in order to create good instances,w hat I don't understand: why do they still display in my wrong version? It seems they disappear "too soon", as if they were considered off-screen in the wrong way... this must be webGL engine getting coordinates for the instanced textures wrong, maybe ??? So now it leads to another question : The "CreateGroundFromHeightMap" function asks for an "url" parameter to load the height map image. My textures were already loaded by my assets manager, so how do I tell the function to get an already existing texture instead of an url ??? it is a bit "newbie question" I guess :/ Thank you !!! Quote Link to comment Share on other sites More sharing options...
meteoritool Posted February 15, 2016 Author Share Posted February 15, 2016 Another trouble : I added shadows to the scene, and even though the ground instances are ok, now the shadows react weird when moving the camera too :/ http://playground.babylonjs.com/#25K1LA#4 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 16, 2016 Share Posted February 16, 2016 Not sure to understand what you are trying to achieve here but I can say one thing: same is FAR too large for shadows. You will lose all precision with such a scene. Regarding your previous question: why do they still display in my wrong version? because they were created when the ground was just a small box and thus they received a wrong bounding box Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 16, 2016 Share Posted February 16, 2016 It works well with a limited distance: http://playground.babylonjs.com/#25K1LA#5 Quote Link to comment Share on other sites More sharing options...
meteoritool Posted February 17, 2016 Author Share Posted February 17, 2016 Hello, So, if I compare our two examples, I understand that shadow emitting meshes should be clones rather instances ! Am I right ? They seem to behave different: //move the camera up and down to see what happens with shadows:http://playground.babylonjs.com/#25K1LA#4 // Shadows emitters are instances of a boxhttp://playground.babylonjs.com/#25K1LA#6 // Shadows emitters are clones of a box On 2/15/2016 at 9:42 PM, Deltakosh said: Not sure to understand what you are trying to achieve here but I can say one thing: scene is FAR too large for shadows. You will lose all precision with such a scene. I'm trying to build a very long corridor where i=the corridor length Is there an improvement in computing/details if I use a short light range ? Is this the good way to go ? Should I consider creating multiple ShadowGenerators or is it only: one scene = one shadowmap ? I will also try to add fog later but that's another story >_< Thanks for your answers you rule ;-) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 17, 2016 Share Posted February 17, 2016 I used clone but it is the same as instances in this case (instances are even better actually). regarding your question: the best way is to generate the corridor on demand. Or at least add only near objects and not all objects. 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.