efxlab Posted February 12, 2018 Share Posted February 12, 2018 I have a glTF model imported, but I have no success to get shadow caster visible on ground from model, (my code work from regular GitHub model), I think mine has big proportion. Iam playing with groundShadowLevel but I dont found the good value to have shadow visible on this model, I think it may too soft/big or too small. is a way to get the good value visually with the scene proportion ? Should setup my model size to any babylon unit ? thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted February 12, 2018 Share Posted February 12, 2018 You should try to scale your model to a 1x1x1 unit box with: mesh.normalizeToUnitCube(true) efxlab 1 Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 13, 2018 Author Share Posted February 13, 2018 thanks, I will test that soon and up to you when it works Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 13, 2018 Author Share Posted February 13, 2018 I just tested out, The mesh disapear from screen, I think it become very very tiny invisible my camera is: camera = new BABYLON.ArcRotateCamera("Cam_config", 0, 0, 0, new BABYLON.Vector3(0,5,0), scene); camera.setPosition(new BABYLON.Vector3(-4,10,14)); camera.fov=0.8; I don't know what to do to point camera to this resized model ? Quote Link to comment Share on other sites More sharing options...
Amarth2Estel Posted February 13, 2018 Share Posted February 13, 2018 Hi efxlab ! You may use camera.setTarget(yourMesh.getBoundingInfo().boudingBox.centerWorld) or camera.lockedTarget = yourMesh; If your mesh is still not visible, perhaps is your camera.maxZ too small, then try to increase it. PS : Depending on the transformations you applied, you might need to use the method refreshBoudingInfo() to update the bounding info and to avoid your mesh being considered out of the frustum and therefore not drawn ! Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 14, 2018 Author Share Posted February 14, 2018 Hey all, Iam back... I did a playground with standard camera, shadow working here: https://www.babylonjs-playground.com/indexstable#10D6YT#92 but comment off my code with my own camera setup then run, shadow are killed ! what's happened ? thanks Quote Link to comment Share on other sites More sharing options...
Amarth2Estel Posted February 14, 2018 Share Posted February 14, 2018 Hi ! Your shadows are here. But because of the camera direction you don't see them. Using an arc rotate with control, you can see your shadows are projected, but outside of your original camera view. https://www.babylonjs-playground.com/indexstable#10D6YT#93 You will see that the shadow is not natural.. it is because your character is litteraly flying. There is 2 babylon units between him and the ground (Y componant). Try working on their position https://www.babylonjs-playground.com/indexstable#10D6YT#95 By the way, don't forget to set sizeAuto to false when you create your default environment, otherwise your skyboxSize and groundSize are not taken. efxlab 1 Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 14, 2018 Author Share Posted February 14, 2018 Thanks for your advices @Amarth2Estel I got you from playground, but I can't reproduce in my project with the same value. I dont understand I test with the same model etc ... I set scene.createDefaultEnvironment sizeAuto to false too and My model is well positioned on the ground... no luck, maybe playground have some tips I have not ? Iam Investigating more again... Quote Link to comment Share on other sites More sharing options...
Guest Posted February 14, 2018 Share Posted February 14, 2018 can you make sure to use the latest 3.2 in your project? Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 14, 2018 Author Share Posted February 14, 2018 it's v3.1.1 I built from the website with gltf loader extension, I try with the 3.2 ... I build from http://www.babylonjs.com/versionbuilder/ with 3.2 preview : it doesn't work. is this release is ok ? Quote Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2018 Share Posted February 15, 2018 What do you mean by "it doesn't work" ? You need to tell us what is not working Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 15, 2018 Author Share Posted February 15, 2018 Hey, yeah you are right, but Iam working on another work now. I will test it out soon with a new model replacement for debug (I can't actually share my project for copyright) and I'll post feedbacks here. in No working I was meaning that there is no shadow cast, its very strange. see you Quote Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2018 Share Posted February 15, 2018 If you can repro on the PG I will be able to help Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 15, 2018 Author Share Posted February 15, 2018 ok, so I will export the model in low poly for have real test and avoid copyright with publish. Do you know Where can I store the glTF files for import from PG ? Thanks for your kind word @Deltakosh Quote Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2018 Share Posted February 15, 2018 You can store it in github and use rawgit.com to get a link to it efxlab 1 Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 28, 2018 Author Share Posted February 28, 2018 Hello, ok Guys, Iam back from my shadowCaster issue, I converted the sculpture to something awfull for copyright Shadow works only in playground, here my code: https://playground.babylonjs.com/#T68535 but with the same setting in my code (except the camera setting), shadow are no working: https://bin.fuelphp.com/snippet/view/OW thank you to assist me Guys see you Quote Link to comment Share on other sites More sharing options...
Guest Posted February 28, 2018 Share Posted February 28, 2018 I see difference with light position and direction. Also your code to add to shadow map and to normalize is not called after loading the gltf but before Also you can use Spector.js to see the content of your shadow maps (really helpful to see if light is misplaced) Quote Link to comment Share on other sites More sharing options...
efxlab Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) great its a good indication for me to understand the BJS workflow. Where do you think I can add the shadowCaster ? would like appropriate to put after the loader with: loader.onComplete = function () { addShadowCaster(); }; It work now it was the order: called shadowCaster on the loader complete. Thanks @Deltakosh et tous les BJS users Edited February 28, 2018 by efxlab Just tested 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.