gamefan

Members
  • Content Count

    47
  • Joined

  • Last visited

Everything posted by gamefan

  1. Or is it? Hi again, Today I finally decided to question this error that firefox has been bugging. There is no rendering glitch or run time error. Everything runs as expected but ff spams the console with this: Error: WebGL warning: drawElements: This operation requires zeroing texture data. This is slow. Error: WebGL: No further warnings will be reported for this WebGL context. (already reported 32 warnings) I narrowed it down, seems its related to creating reflection probes. (Or may be any render target cube texture). Of what I could amass from the internets is that this occurs when an "out-of-viewport" pixel is read and rendered - This question in pixi.js subforum - but I couldn't figure where and what method is accessing out-of-viewport pixels. If this is just a browser thing, can this be safely ignored? because chrome does not log these errors. https://www.babylonjs-playground.com/#KA93U#243 Thanks
  2. Hi everyone, I was wondering if there is a way to show a mesh hidden behind another mesh other than by setting its renderingGroupId. I want to always show a highlighted mesh which is being interacted by user even if its blocked by other meshes. Drawing it over everything using renderingGroupId sort of confuses depth perception. Is there a best of both worlds? Perhaps by setting some transparency to the blocking meshes, but how to get the list of meshes blocking a mesh's visibility? Thanks
  3. Yes, Just got lazy there ๐Ÿ˜…, but yeah its unsafe to use non public variables Yes, can have something like Mesh.prototype.isVisiblyBlocking = function(targetMesh, fastcheck, camera) fastcheck true uses bounding box, otherwise mesh vertices. Happy to make PR if need be. ๐Ÿ˜‰
  4. @Dad72 Nevertheless an interesting feature. Today is good. ๐Ÿ˜€ So if I understand it right, the engine will automatically discard meshes outside the camera frustum in the render cycle. But has to draw everything that is inside because it cannot decide before hand about the depth? We can thus use occlusion queries to disable render of a mesh hidden by an opaque mesh. This is neat, wondering why its not internally used in the engine. Perhaps because its asynchronous or slow?
  5. Great Idea. I made rays from bounding box corners to camera's position. Something like this: var boundingInfo = activeObject.getBoundingInfo().boundingBox.vectorsWorld; for (var i = 0; i < boundingInfo.length; i++) { var ray = pickingRays[i];//pre defined rays for reuse ray.origin = boundingInfo[i]; scene.activeCamera.position.subtractToRef(ray.origin, ray.direction); ray.direction.normalize(); ray.length = BABYLON.Vector3.Distance(scene.activeCamera.position, ray.origin); for (var j = 0; j < scene.activeCamera._activeMeshes.length; j++) { var mesh = scene.activeCamera._activeMeshes.data[j]; if (ray.intersectsMesh(mesh, true).hit) { mesh.visibility = 0.5; } } } I never knew there was a multiPick, its there as scene.multiPick and scene.multiPickWithRay. This helped in other areas. So double thanks for the bonus ๐Ÿ˜‰ The above solution works just right, but I would love to see if there were a better/efficient solution.
  6. Hi, Started using compressed textures in our projects. Came across three possible bugs, not sure about the last one. PG: https://www.babylonjs-playground.com/#RK0W5S#2 1 and 2 are demonstrated in the above PG. Comment line #5 to compare results when not using compressed textures. 1.) Incorrect texture returned when Engine is set to use a ktx format texture and Texture is made via Texture.CreateFromBase64String. Possibe fix: bypass textureFormatInUse when buffer is available in Engine.CreateTexture 2.) Callback passed to Texture is not fired when CreateTexture falls back to url passed on not finding its ktx counterparts. Need this to finish a "change texture" flow. Possible fix: Ignore fallback argument and create onLoadObserver in Engine.CreateTexture 3.) When engine is set to use ktx format , CubeTexture looks for one ktx file instead of 6. I don't know if the cubeTextures in ktx formats are to be composited into a single file. I use this gulp task to create compressed textures. Got a work around for 1 and 2 but 3 is beyond me. Want this to support 360 tours on low spec devices.
  7. @JCPalmer I think I will get my hands on the doc repo.
  8. @JCPalmer Got CubeTextures to work with a small change. Interestingly they do not require y flipping.
  9. No!!!! Thank you, sir. Wow, ๐ŸคฉUncontainable happiness. Feels so nice.
  10. @JCPalmer @Deltakosh I made a PR ๐Ÿ˜Š. Fixed 1 and 2 with as little change as possible. Tested both cases, I hope this addresses the issues correctly.
  11. @JCPalmer 1.) Yes, createFromBase64String not usable while compressed Textures being enabled. I will see if I can make a PR, will be my first. ๐Ÿ˜€Exciting. 2.) Even when onload from original call is passed, onLoad is not added to the loaded observable in case of a fallback. But I am guessing allowing this is not straightforward, and could affect other cases. 3.) Will try the pvrTextTool. Actually I have the gulp task run through all my folders to make these compressed textures. This treated the cubeTextures the same way it treated other images. @Deltakosh I have 1 and 2 working with some changes (not sure if they are fool proof).
  12. Hi, I find renderTargetsOptimization very helpful. Is there a way a renderTarget frame can be cleared so that the last frame before render targets are disabled doesn't stay? I can set ReflectionTextureEnabled = false, but I want to have reflection textures that don't use render targets. http://www.babylonjs-playground.com/#1YAIO7#37 In this playground I have disabled render targets after 3 seconds but the ball reflection remains static Thanks
  13. My head says no, but it probably is ๐Ÿ˜…. I am fine with your solution but wonder why no one else came across this? ๐Ÿค”
  14. Man!! I was afraid of this ๐Ÿ˜…. Any chances this will be incorporated in a future release?
  15. Reflections made by MirrorTexture and ReflectionProbe. We want something like what material.reflectionTexture = null would do. (As disabling render targets won't update the reflection texture in the next render frames) StandardMaterial.ReflectionTexturesEnabled = false is the right thing to do but I don't want to disable reflection textures that aren't using render targets. I think scene.renderTargetsEnabled should render/hide the render target texture. What affect this has now is equivalent to (an imaginary) scene.pauseRenderTargets.
  16. Hi Deltakosh, Thank you for your reply but this is not what I want. I want the render targets textures to disappear after renderTargets optimization is done. The scene looks awkward when the render target textures just stay there at their last rendered frame. It looks awkward even for renders at intermittent frames with the use of refreshRate. I want a result similar to what "StandardMaterial.ReflectionTextureEnabled = false" does. Thanks
  17. Firstly, Congrats for completing 3.2 . We were looking forward to quite of a lot of features implemented here. This isn't a bug, but in my opinion I think the merge meshes should continue merging the rest of the meshes in the list when it encounters an invalid mesh instead of throwing an error. We have a model load workflow which on load finds the center and extent of the model using mergeMeshes. Few of our models have empty container like meshes that are parent of meshes that have real vertex data. And this breaks our App when vertexData.validate() throws "Positions are required". There is an easy fix for this - I made a pass before mergingMeshes like so: for (var i = 0; i < meshes.length; i++) { //only pass meshes that have valid position data if (meshes[i].getVerticesData(BABYLON.VertexBuffer.PositionKind)) clones.push(meshes[i].clone("clone" + i)); } var combinedMesh = BABYLON.Mesh.MergeMeshes(clones); This is potentially a breaking change as it works right with 3.1
  18. Hi, I am planning to update from 3.1 and was trying the latest preview. Some of my babylonjs files did not render because I checked that the shader material did not override isReadyForSubMesh and the base class's method always returned false. This made my app stuck here because the scene would never be ready: scene.executeWhenReady(function() { engine.runRenderLoop(function() { scene.render(); }); }); Please help.
  19. Hi Deltakosh, I should have done this earlier: https://www.babylonjs-playground.com/#D6VHKG#1 There is an alert that fires on scene ready. If you comment out the lines specified, executeWhenReady triggers the alert but not when shader material is applied to a submesh.
  20. Hi, We have been using babylon2.5 (oddly, an alpha release) in our projects because it served our purposes. Now we want to update to 3.0.7 for various reasons. We have lots of meshes that are imported into an existing scene that have to be logically combined under a parent based on a predefined config. I used this following code to arrive at combination's size and center. var getCombinationData = function(meshes) { var clones = []; for (var i = 0; i < meshes.length; i++) { clones.push(meshes[i].clone("clone" + i)); } var combinedMesh = BABYLON.Mesh.MergeMeshes(clones); var boundingBox = combinedMesh.getBoundingInfo().boundingBox; var size = boundingBox.extendSize.scaleInPlace(2); var center = boundingBox.center; //dispose off the clones; for (var k = clones.length; k > 0; k--) { clones[k - 1].dispose(); } combinedMesh.dispose(); return { size: size, center: center }; }; Using babylonjs 3.0.7, the boundingBox.center is different from that obtained using 2.5, which I am assuming is right , because a box made with size and center got from the above method, neatly encapsulated the meshes. Has anything changed since 2.5 or An easy fix to doing this? The meshes can have parents ( but not different ones). Thanks.
  21. I can confirm (with much relief) , that this is case with 3.0.7 but the current preview (3.1-beta2) renders correctly. I will have to check everything before continuing with this preview release, but it looks great. Moreover , we have nearly doubled the potential FPS. What a win!!!!. 1000 points to everyone.
  22. Hi @Deltakosh, No luck with computeWorldMatrix. I already tried centerWorld, but using that also causes offsets. I would be needing the center in world space but sometimes the meshes that are combined have a parent, in that case the center should be relative to the parent. I will see if transforming worldCenter to parent space would work. And its strange because I tried my code in playground and it seems to work right. I guess there is something else.
  23. Hi, Don't know if this is intended behavior but ActionManager executes actions on disabled meshes too. Don't want it run on disabled meshes. Also actions registered with a parent mesh are not executed by children. Got children to execute parent action by registering action to each end child. For meshes disposed/created actionManager to toggle action execution when they are disabled/enabled. So found a way around both, if anyone is looking for it. If there is a better way, please tell. Would love to see ActionManager handle this internally. Thankyou And yeah pg: http://www.babylonjs-playground.com/#IJKYDQ
  24. Hi, I want to offer user to disable reflections in my application so that there is gain in fps if he/she wishes to. I set ReflectionTextureEnabled in standardMaterial to false, the reflection is disabled but there is no performance gain. Removing the reflection texture from the mesh's material does increase the fps count. But I don't want to remove the reflection texture completely as user can toggle this back on again. Any strategies on how to do this? http://www.babylonjs-playground.com/#DHPSEM#1