• Content Count

  • Joined

  • Last visited

About lesterhaus

  • Rank

Recent Profile Visitors

702 profile views
  1. Funky is a good way to describe it Well looking at your babylon file, there already seems to be a shadowGenerator included with a shadowMap size of 1536. So you are loading the scene which already has the light and the shadowGenerator for it, and afterwards you create a new shadowGenerator for that light. Since you are doing all this in the "onLoad" callBack maybe this causes some side effects? (Just a wild guess, I don't know if that is really a problem) So one thing you could try is to call all your setup functions (doShadows, doCamera, etc.) in a newScene.executeWhenReady(function(){ .. }); I don't know if this solves any problems, but that way at least you can be sure that everything is loaded from your babylon file into the scene before you finish setting it up with your code. Just to make clear what I mean: BABYLON.SceneLoader.Load("assets/","fog_test.unity.babylon",engine,function(newScene){ scene = newScene; newScene.executeWhenReady(function(){ //CAMERA doCamera(newScene,canvas); // FOG doFog(newScene,canvas); // SHADOWS doShadows(newScene); // RENDER LOOP engine.runRenderLoop(function(){ newScene.render(); update(); }); }); });
  2. Hey there, if you want your meshes to drop and receive shadows at the same time you cannot use variance shadow maps (neither blurred nor normal). You will have to stick to shadowGenerator.usePoissonSampling in that case. On another side note, the shadowGenerator properties are per generator, so you can set these outside your forEach loop.
  3. Hey, don't know if this will earn me a "no shit einstein!" .. but I'm going to write it regardless I'm transforming a lot of DXF files to .babylon files and had quite some playtime with this. Since the initial load and the file size was one of my biggest issues I ended up to only include positions and normals in my babylon scene file and calculating UVs in the loading callback. that basically stripped over 1/2 of my filesize. I'd strip the normals too if I could, but I need them for some server side analysis of the meshes. Granted, I'm mainly importing architecture models, so I'm dealing with many "flat" face normals and larger but fewer meshes so I only need to do planar mapping. But the additional time computing the UVs compared to loading a file with UVs at least felt about the same. Anyways, if your use case is remotely close to mine and if it is an option for you, I'd really recommend to compute UVs and even normals on load to reduce the file size.
  4. Hey, hey! Just stumbled over this thread in my search for.. well a CSS3D render possibility with BJS. Would it be possible to create something like a placeholder plane in a scene, let BJS take care of all the transformation goodness when moving the camera and set my CSS3D transformations for a stinky old <div id="superCSS3Dawesome"><!-- your html content here --></div> accordingly in my runRenderLoop? Well, since no one (except maybe the overall performance gods) can stop me to write weirdest stuff into the renderLoop I guess my question is not if it is possible, but rather how do I get the current transformation of a mesh out of BJS when a frame is drawn on the canvas? So I'm not talking about the position or rotation in the current scene, but the resulting 2D projection of it?
  5. Glad you got the shadows working! The scene looks very nice already, and who wouldn't like a good 3D Tower Toppler
  6. Hey, Could you post the part of your code where you push the mesh (or meshes) into the shadowMaps renderList? Mostly dealing with .babylon imports - but I usually do this inside the callback of e.g. my SceneLoader like this: BABYLON.SceneLoader.Load(modelPath, modelName, engine, (scene) => { // Wait for textures and shaders to be ready scene.executeWhenReady( () => { for (var i = 0; i < scene.meshes.length; i++) { let mesh = scene.meshes[i]; shadowGenerator.getShadowMap().renderList.push(mesh); mesh.receiveShadows = true; } }); });
  7. Hey, Since this sounds almost too straight forward I'm pretty sure it is wrong.. but in the hope of learning something new I'm still gonna suggest it.. Shouldn't this be a case for scene.executeWhenReady which you can call inside the scene loaders callback function?
  8. Hey! Mr Palmer beat me to an answer, so I delete most of what i wrote ... and just focus on the part of the westeros.babylon file which causes your problem "subMeshes":[{"materialIndex":0,"verticesStart":0,"verticesCount":165,"indexStart":0,"indexCount":642},{"materialIndex":1,"verticesStart":165,"verticesCount":110,"indexStart":642,"indexCount":396},{"materialIndex":3,"verticesStart":275,"verticesCount":21,"indexStart":1038,"indexCount":60},{"materialIndex":3,"verticesStart":296,"verticesCount":0,"indexStart":1098,"indexCount":0}] he Plane mesh has 4 subMeshes. The last one, which is the one with the multimatID 3 (which also has the bumpmap) has neither a vertexCount nor an indexCount. Without fixing the whole subMeshes I just tested by assigning the mutlimatID3 to the 3rd submesh and the bumpmap is being displayed just fine Love the wall up north btw
  9. As I learned from other threads you can set the pivot manually after loading your obj. Just be aware that this displaces your mesh together with the pivot point, so you'd have to compensate this by resetting the position accordingly let pivotCenter = mesh.getBoundingInfo().boundingSphere.center; mesh.setPivotMatrix(BABYLON.Matrix.Translation(pivotCenter.x, pivotCenter.y, pivotCenter.z)); mesh.position = selectPlaneMesh.position.add(new BABYLON.Vector3(-pivotCenter.x, -pivotCenter.y, -pivotCenter.z));
  10. As Samuel pointed out moving the box shows that it is casting a shadow. usePoissonSampling - which is your go to option when having meshes casting and receiving at the same time - can result in pretty crude shadows at times. So for your playground you could also try to tweak something like the shadowGenerator.bias like here (line 29) http://playground.babylonjs.com/#MPBTA#3
  11. Well thank you very much for those welcoming words Since I decided to move entirely to babylon.js for my projects (was using three.js before) I'll be around here more often indeed. Actually this forum is one of the reasons for me switching to babylon.js - never got any meaningful answers over at three.js (apart from the good ol' "Off to stack overflow ya go lllandrrrrat!") Here I get answers from the engine's godfathers directly, so I guess I won't end up in a dead end so frequently. Being able to port all my scripts over to babylon.js while saving somewhere around 40% lines of code per script, having a full functional playground thingy and getting many functionalities I had to script for myself in three.js neatly packed in 1 line function calls.. also helped.. and my never ending hope to get nicely blurvariance shadowmaps working for self-shadowing meshes in a later version of bjs *hint*
  12. Hey! I don't think there is anything wrong in particular. I just didn't know that there was some kind of a subMesh auto-push happening .. and was rather glad that it was the same case in this PG (which I just copied from a multiTexture example somewhere here on the Forum) and not one of my silly mistakes. I guess I just commented here for myself so when at some point in the future I have to switch back to using subMesh.push() I can remind myself why I didn't use it in the first place
  13. I was just going to ask about this in a new topic (glad I found this and may now escape the shaming for not searching the forum properly ) I'm working on a little script to create new subMeshes from a selection of faces of a complex mesh (selected via onClick) so that I can use MultiTexture for those subMeshes. Now I noticed that mesh.subMeshes.push() seems to result in 2 subMeshes being pushed to the mesh. Since the first suspect of such strange behaviour is always the non-coding-legend which is I (!), I also crosschecked with an existing example on the PG: http://www.babylonjs-playground.com/#YPL6T The engine doesn't seem to be bothered by this, but in my script I need to keep track of the exact number of existing subMeshes. A new selection could include faces of existing subMeshes which I have to alter in the process. For now I'm just assigning it to a short lived temp. While assigning it to temp is not needed ... it just felt wrong to have new BABYLON.SubMesh() standing there all alone.. without "=" or anything .. and actually I'd really love to push() it let temp = new BABYLON.SubMesh(0, 0, verticesCount, indexStart, indexCount, mesh); Results in exactly 1 subMesh
  14. Ah I see. Thanks a lot for the quick answer! So basically if I know that my ribbon will end up with a cubic or curve-less polygon shape I convert to flat shading. Well that's what you get if you put powerful tools like babylon js into 3D rendering newbie hands like mine
  15. Hey everyone! Apparently I didn't quite understand how ribbons work, even after reading the extensive tutorials. I've set up a playground with a very basic ribbon made from 2 Vector3 arrays (base and heights) gave the whole thing a material and set a box next to it to further illustrate my problem. http://www.babylonjs-playground.com/#1HLWTQ#4 Since I'm not a 3D programming crack, could any of you explain what causes that weird lighting? Is this be a face- or vertex-normal problem? Does it happen because I build the ribbon the wrong way? Where did I go wrong? Cheers, Lesterhaus p.s.: Please forgive the weird xyz-coordinates used - I'm working on a demo where I send batches of drawcommands to babylon js for extrusion and just copy/pasted it into the playground for tests