KevinBLT

Members
  • Content Count

    77
  • Joined

  • Last visited

Everything posted by KevinBLT

  1. Hello, I don't know if this is something that could be merged into github but we had some projects (and therefore customers) that were highly loaded with objects, thus a bit slow in rendering. The camera inertia was then to long lasting to control the camera if you know what I mean. This is what I've changed to handle this: // Inertia var engineDelta = Math.min(this.getEngine().deltaTime,100), inertiaFactor = Math.min(1,16.66666 / engineDelta); if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) { this.alpha += (this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset) / inertiaFactor; this.beta += this.inertialBetaOffset / inertiaFactor; this.radius -= this.inertialRadiusOffset / inertiaFactor; this.inertialAlphaOffset *= this.inertia * inertiaFactor; this.inertialBetaOffset *= this.inertia * inertiaFactor; this.inertialRadiusOffset *= this.inertia * inertiaFactor; if (Math.abs(this.inertialAlphaOffset) < BABYLON.Engine.Epsilon) this.inertialAlphaOffset = 0; if (Math.abs(this.inertialBetaOffset) < BABYLON.Engine.Epsilon) this.inertialBetaOffset = 0; if (Math.abs(this.inertialRadiusOffset) < BABYLON.Engine.Epsilon) this.inertialRadiusOffset = 0; } // Panning inertia if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) { if (!this._localDirection) { this._localDirection = BABYLON.Vector3.Zero(); this._transformedDirection = BABYLON.Vector3.Zero(); } this.inertialPanningX *= this.inertia * inertiaFactor; this.inertialPanningY *= this.inertia * inertiaFactor; if (Math.abs(this.inertialPanningX) < BABYLON.Engine.Epsilon) this.inertialPanningX = 0; if (Math.abs(this.inertialPanningY) < BABYLON.Engine.Epsilon) this.inertialPanningY = 0; this._localDirection.copyFromFloats(this.inertialPanningX / inertiaFactor, this.inertialPanningY / inertiaFactor, 0); this._viewMatrix.invertToRef(this._cameraTransformMatrix); BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection); this.target.addInPlace(this._transformedDirection); } It rotates by the given inertia amount depending on the time that proceeded during the renderings. The var engineDelta = Math.min(this.getEngine().deltaTime,100) is to avoid big camera jumps on frames that last longer than 100ms. In our project the render loop doesn't run continuesly. If someone likes to test this and/or push it into babylon I would be glad to have contributed a small thing :-) If not it's also completely okay as it's only needed in our project(s)! ;-) Best regards Kevin
  2. Has this been fixed? :-) I didn't find it in the change log.
  3. Ah that's why the ghost shadows will stay in my case. Becaue the shadow map doesn't get updated very often. So, good to know. For now I will have to remove them manually. Thanks and keep us on track.
  4. Hello, is it the correct behaviour that instances that are being disposed doesn't get removed from ShadowGenerator.getShadowMap().renderList ? I have the refreshrate set to 0 and only render with shadow on demand. if (_renderShadow && this._manuallyShadowRender) { this._shadowGenerator.getShadowMap().refreshRate = 1; this._scene.render(); this._shadowGenerator.getShadowMap().refreshRate = 0; } else { this._scene.render(); } Is this a problem i this case? I just want to know (maybe it's a bug). Shouldn't ShadowGenerator check the Mesh.isDisposed attribute? Have a nice day Kevin
  5. Thank you. I didn't find this in the documentation
  6. Hey, just a small question. What am I doing wrong, that text is not filled in my case? var text2D_X = new BABYLON.WorldSpaceCanvas2D(scene, new BABYLON.Size(sizeTX, 12), { id: "Measure - " + sizeX, worldPosition: new BABYLON.Vector3(0, 0, BB.minimumWorld.z - 6), worldRotation: BABYLON.Quaternion.RotationYawPitchRoll(0,Math.PI/2,0), enableInteraction: true, children: [ new BABYLON.Text2D(checkRound(sizeX).toString() + "cm", { fontName : "6pt Arial", marginAlignment : "h: center, v: bottom", fontSuperSample : true, }), ] }); Thanks
  7. This is fantastic! Can I use this with the current Babylon version? I don't understand these exactly: renderTarget.onBeforeRender = function () { for (var index = 0; index < renderTarget.renderList.length; index++) { renderTarget.renderList[index]._savedMaterial = renderTarget.renderList[index].material; renderTarget.renderList[index].material = renderTarget.renderList[index].helperMaterial; } } renderTarget.onAfterRender = function () { for (var index = 0; index < renderTarget.renderList.length; index++) { renderTarget.renderList[index].material = renderTarget.renderList[index]._savedMaterial; } } Why do you have to do something with private members ? Or is this just a temporary workaround? Also, would it be possible to keep the lines the same thickness independet from the camera distance? You're really a shader god!
  8. I know. However, how would I start an implementation? Do I absolutely need TypeScript? To do a contribution? And also another question: Wouldn't the edgedetection be possible via shader?
  9. Hello everyone, I would like to know if it was possible to do the work of "Edges Renderer" in a worker thread? It's working really well for our projects but for some objects it can take really a lot of time in which the scene is completely stopping to respond. Any suggests?
  10. So someony already had this pain in his ass? And this "openjscad csg" is more like an updated version of the current one used in BabylonJS?
  11. You saved me from a lot of pain, thanks!
  12. Ah... this doc was exactly what I needed. I love you all! And Babylon of course!
  13. Has this problem been solved? I also need dynamic texture with transparent background.
  14. Hello, after using csg there are two edge lines that shouldn't be there I think. http://www.babylonjs-playground.com/#1MH4BF Can this be corrected somehow? Thanks!
  15. This works for me! I think I will have to do a csg union for all meshes at first to get every correct edge. Thanks. With this parameter it's working
  16. Because I would have to create these textures for a lot of objects. Also, many objects are created using CSG. I don't know how I would have to create the appropriate textures before the calculation? This is an example of how it can look in the end:And this is not a static object or something. You can build this 2cm bigger for example. The balcony wood, for example, is made from CSG. But I have found out in another thread that edges renderer works for me with an additional parameter. So I'm getting closer. I may have to union all meshes for this view. But I am not time dependent in this moment I am creating the print view (side and front). Nevertheless, thanks for your advices!
  17. Hello, I have found the following bug: When you use "convertToFlatShadedMesh()" and then enable EdgesRenderer it will render the triangles instead of the edges. This even happens with a simple cube also. Playground: http://www.babylonjs-playground.com/#1WVZLV
  18. I think this would be a more difficult solution than my current one I don't know. I just wonder how Blender is doing this? Unfortunately I don't have the skills to write a super fancy shader doing everything awesomely smart. Maybe some 3D god will put in a suitable solution For the Edges Renderer problem I have found the problem. Look at this thread in "Bugs" section Thanks and best regards Kevin
  19. I think I've found it. I sometimes had leaks while cleaning up (disposing). I had similar problems some minutes ago while using CSG. I would highly appreciate to throw an error when the object is disposed or _geometry is null. For example: ________________________________ Babylon.js - CSG.FromMesh - Starting column: 31193 var indices = mesh.getIndices(), positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind), normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind), uvs = mesh.getVerticesData(BABYLON.VertexBuffer.UVKind); // ============> If indices,positions, normals or uvs are null or there aren't any submeshes there will be unforeseen results Better would be to throw an error // <============= var subMeshes = mesh.subMeshes; for (var sm = 0, sml = subMeshes.length; sm < sml; sm++) { for (var i = subMeshes[sm].indexStart, il = subMeshes[sm].indexCount + subMeshes[sm].indexStart; i < il; i += 3) { vertices = []; for (var j = 0; j < 3; j++) { var sourceNormal = new BABYLON.Vector3(normals[indices[i + j] * 3], normals[indices[i + j] * 3 + 1], normals[indices[i + j] * 3 + 2]); uv = new BABYLON.Vector2(uvs[indices[i + j] * 2], uvs[indices[i + j] * 2 + 1]); var sourcePosition = new BABYLON.Vector3(positions[indices[i + j] * 3], positions[indices[i + j] * 3 + 1], positions[indices[i + j] * 3 + 2]); position = BABYLON.Vector3.TransformCoordinates(sourcePosition, matrix); normal = BABYLON.Vector3.TransformNormal(sourceNormal, matrix); vertex = new Vertex(position, normal, uv); vertices.push(vertex); } polygon = new Polygon(vertices, { subMeshId: sm, meshId: currentCSGMeshId, materialIndex: subMeshes[sm].materialIndex }); // To handle the case of degenerated triangle // polygon.plane == null <=> the polygon does not represent 1 single plane <=> the triangle is degenerated if (polygon.plane) polygons.push(polygon); } } var csg = CSG.FromPolygons(polygons); _________________________ I had some troubles to find the problem. In this case "polygons" is an empty array and will lead to some "funny" errors in the result mesh (after subtract, union, whatever) ;-) Thank you and best regards Kevin
  20. Normally the meshes wouldn't be white and have different textures. I think I cannot merge them in this case? Also, why is that, even the bars are triangulated? They are simple boxes? Am I doing something wrong? keyDebug.registerKey("T","Test für verdeckte Kanten Ansicht",function() { var m = g3DScene.meshes; for (var i = 0, mat; i < m.length; i++) { if (m[i].material && m[i].material.diffuseColor) { mat = m[i].material; mat.diffuseColor.r = 1; mat.diffuseColor.g = 1; mat.diffuseColor.b = 1; mat.diffuseTexture = null; console.log(mat); } m[i].enableEdgesRendering(); m[i].edgesWidth = 100.0; } //g3DCamera.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA; g3DCamera.orthoTop = 50; g3DCamera.orthoBottom = -50; g3DCamera.orthoLeft = -50; g3DCamera.orthoRight = 50; RenderWithShadow(); }); I use a lot of instances if this is important. Also is the "ArcRotateCamera" capable of being BABYLON.Camera.ORTHOGRAPHIC_CAMERA ? I'm not able to create a sideview with it :-/ Thanks for help :-) Kevin
  21. Hello, I have the following error when I try to clone an object. Uncaught TypeError: Cannot set property 'references' of null What can I do? Why does this happen? Best regards Kevin
  22. Outline would not be enough. It's like you said I need every edge depending on its angle. I already thought this must be done via shader but I am not able to do so. I mean this: I cannot use a dedicate render endgine because the entire scene is created dynamically from cubes. I think if no 3D professional adds this into Babylon I have no chance :-/ Thanks for you answer Kevin
  23. 1: EdgesRender would work with the ortigraphic camera I think but in my case it shows the triangulation? :-( I think this view would be more a global camera setting than one for each object. Some 3D-Viewers have this for example with an object called: "Hidden lines". And how is it done in blender for example? The have the views from each side just with the lines. I don't know if I describe it well enough. 2: I already use the shadow map with refresh rate 1 but I thought it would be possible to get even better results in terms of lightning (global illumination?) Thank you.and have nice day! Kevin
  24. Hello everybody, I have two requests for features. I would like to know if these were possible? 1. Hidden lines view Would there be any possibility to create something like this: So like defining a view point and create a flat image with only the edges visible (The faces, not the triangles) ? Best for me would be a list of polygons and their points but a static image would be great either. 2. Create shadow map (and more?) with a raytracer In our application we have a static scene most of the time. It may change every 10 seconds (if the user wants so) and the recalculation time is not a problem (could be 3+ seconds for example). So for this case the best possible quality is more important than the fastest calculation. I don't think I would be the only one who needs some like these features. Thanks and have a great day! Kevin