Rodrix3

Members
  • Content count

    142
  • Joined

  • Last visited

About Rodrix3

  • Rank
    Advanced Member

Recent Profile Visitors

488 profile views
  1. Rodrix3

    mergeMeshes Automatic Optimization

    Awesome Let me get into it. Before I do the PR I am doing tests on my side to make the code more robust. @Deltakosh, I need one thing: how can I get the unique indentifier of a material? Not the material name, but a string or number that can be used to uniquely identify this material. Does there exist such thing? material.id is unique? (If not, not a problem I can handle this otherwise) UPDATE: I have run into a much more important issue. There seems to be a bug with BABYLON.Mesh.MergeMeshes() function when the meshes to merge have more than 65536 vertices (even though the flag allow32BitsIndices is set to true). I have isolated a test case for this, but I don't how to have a sandbox with external gltf, bin, and multiple texture files. The error happens only with particular meshes of the same material, evidently those with more than 65536 vertices: var disposeSource = true; var allow32BitsIndices = true; var meshSubclass = undefined; var subdivideWithSubMeshes = false; BABYLON.Mesh.MergeMeshes(meshList, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes); TypeError: this.indices.push is not a function at q.merge (babylon.js:1) at Function.p.MergeMeshes (babylon.js:1) I am thinking it might be appropriate to open an issue on Babylon source code. We need this fixed before I can proceed. Shall I open an issue on git and attach all files? UPDATE 2: Done! I have created a completely isolated full test suite showing that by merging multiple meshes with more than 65536 and allow32BitsIndices on, Babylon crashes. Here is the issue with full test suite attached: https://github.com/BabylonJS/Babylon.js/issues/4859
  2. Rodrix3

    mergeMeshes Automatic Optimization

    Thanks @Deltakosh for the reply. Yes! I see you have something similar and that you and @Sebavan are the main contributors on the mesh merging optimization. Good! Too bad I missed it.. However, I also see that currently implemented code at Scene Optimizer passed does not implement multi material as further optimization, as I did on my quick proof of concept function. Using a multi-material reduces the mesh count, which could lead to a performance increase. Don't you think it would be a nice addition to merge all merged meshes into one single multi-material (or several of them) as I did as an extra step of the optimization algorithm? What do you think? :) If this is a bad idea, please let me know - I am just trying to contribute to make the library better IMPORTANT IDEA: Also I would like to take this even further. I think that once the optimization is done, we should serialize the result of all merged meshes and export as babylon file. In this way, the optimization will be done ONLY once (by the developer) and not every time (by the end user). We could make this into a webpage where our users load the main babylon file, the scene gets optimized by using merge mesh, and returned as a new babylon optimized file they can use on their production projects (or we could make it part of the Inspector, under a new tab called "Optimize")
  3. Thanks so much @klaude! I appreciate it.Could I ask you one more thing please? Could you please post your code into a working playground so I can see it in action and fully understand it (or into a codepen if you need to make further adjustments?) I would really appreciate it. Thanks!
  4. Rodrix3

    mergeMeshes Automatic Optimization

    I am done. Result => SUCCESS @Deltakosh I think you will enjoy this (and you may also share it with the guys working on Scene Optimizer, or optimization on Babylon, and tag them - I haven't met everyone yet - if you find this interesting .. which I hope you do!). I have created a function called optimizeSceneByMergingMeshesAutomatically(scene) which you can see at the top of the playground, which analysis all the meshes on scene and automatically: merges all meshes with the same material. merges all merge of meshes with same material, into one big multi material mesh. The result: BEFORE: 152 meshes; 152 draw calls AFTER: 1 mesh; 4 draw calls ...with exactly the same render results. Playground and demo: https://playground.babylonjs.com/#S7E1DT#1 My idea would be to be able to integrate this script into current functionality so others can use it; and have the community chip in and add any extra optimizations to my code. Hope you all like it! I have been working the last two hours on this, so please let me all know what you think!
  5. Hi guys I will be spending the next few hours (attempting to) creating a code snippet that optimizes meshes, by doing automatic merging. My objective is to: 1) Automatically identify meshes that share same materials, and merge them into a single mesh. 2) Merge all meshes that don't share material into one single mesh all meshes, by using submeshes and multimaterial, automatically. The idea is to have an automatic optimization based I have spent a long time researching on forum and reading docs. However, if something like this has already been done, and I didn't find it.. please let me know Meanwhile.. I'll be coding and making tests the next hours
  6. Rodrix3

    DOF

    Thanks a lot! I really appreciate it Should I play with focusDistance and Focal length and leave fStop intact? (I have no idea what is fStop..) @brianzinn To be able to get blurry on near and sharp on far I am looking for a small number on focal length and a big number on focal distance, correct? Thanks
  7. Rodrix3

    Load gltf display exceptions

    I am glad I helped! I struggled myself and a lot with this issue until I discovered how to fix it! Success on your project
  8. Hi guys! The initial code posted and ccapture was from my thread. @klaude have you used ccapture or the playground I posted? I wasn't able to fully port ccapture into Babylon and test to be able to specify the target fps and be in sync. Were you finally successful? and if so can you please share your PG? @Deltakosh and @Sebavan does the solution in implementation allow recording to mp4/ webm/ or photo frames in a constant fps without lost frames? I am interested in recording high quality video. With ThreeJs and ccapture library I was able to render at 4K at 60fps, if I wanted (script would render every frame in slow motion locked at the target fps) Looking forward to the news
  9. Rodrix3

    DOF

    I am trying to use the dof postprocess which has the following parameters: pipeline.depthOfField.focusDistance pipeline.depthOfField.focalLength pipeline.depthOfField.fStop My scene is about 1000 units long and I would like to have all near objects in blur, and all distance objects completely sharp (bokeh effect). I tried many combinations of parameters, but unfortunately none render the result I want; and since I have zero knowledge on professional photography I would love to have some help! Could anyone advise me or at least explain how those parameters work (on babylon or on a real camera)! Thanks in advance
  10. Rodrix3

    Load gltf display exceptions

    I believe I am familiar with this problem. Manually open your GLTF file and set "alphaMode":"OPAQUE" (search for alphaMode and set to that value) That should fix the issue. If you are exporting from 3ds Studio Max ensure that your textures are not using alpha mode which is set automatically every time you load a png, even if it has no transparency. Hope it helps
  11. I am really confused about: pipeline = new BABYLON.DefaultRenderingPipeline(...) VS pipeline = new BABYLON.StandardRenderingPipeline(...) VS postProcess = new BABYLON.ImageProcessingPostProcess(..) To me all of them are post processing. So I don't understand.. When should I use each? Can I combine all three together? I see that the standard has things that the default pipeline doesn't have. I also see that the standard is "no longer mantained" but it has awesome features like volumetric light, dirt camera, adaptive HDR. How am I supposed to do all that with the default rendering pipeline? I see no explanation of that.. I also see the var ssao = new BABYLON.SSAORenderingPipeline(..)... making things even more confusing What is the best practice if I want to combine most of the effects? I want to combine: Dirt Adaptive HDR Bloom Vignette MSAA Grain ColorCurves LUT color correction Vignette DOF Lens Flare Volumetric lighting is gone from default pipeline too? (I had almost all these postprocessing effects in place in ThreeJs, and I need them now in my Babylon Project) Thanks in advance P.S: I am looking at these pages: https://doc.babylonjs.com/how_to/using_standard_rendering_pipeline https://doc.babylonjs.com/how_to/how_to_use_postprocesses https://www.babylonjs.com/demos/standardrenderingpipeline/
  12. Rodrix3

    Advanced Baking of Reflections Script

    Here is an update with some tweaking: https://www.babylonjs-playground.com/#J0D279#14 The results seems to be pretty GOOD and now reflections are making more sense: . I think this idea has a lot of potential; however, I really need the community's help. I can't do this alone. Deltakosh is always there on every post - and I thank you! ..but could others chip in so you can help me solve this faster? IMPORTANT: Even if you are not an advanced Babylon user and you are reading this you could help me with some basics (I come from ThreeJs): How can I get the size of a bounding box that wraps a mesh (I need a vector3 with x,y,z sides of the box)? mesh.getBoundingInfo().boundingBox.extendSizeWorld <= Correct? How can I get the world position of a mesh? mesh.position <= correct? Or is this local position in relation to root? How can I get the size of a mesh by wrapping it with a sphere in world coord? meshes.getBoundingInfo().boundingSphere.radiusWorld <= correct? Is there any way to apply blur to a cubeTexture object? Or is there any way we can make the reflection appear blurred? reflectionTexture.blurKernel and reflectionTexture.adaptiveblurKernel => do nothing (specs says this applies to mirror texture, but nothing about cubetexture). Is there any shader expert who knows how to do this via shaders? Or is there any other way to it? Could we convert it to equirectangular, blur it, and then reconvert it into a cubetexture? Is there a simpler way? We are on PBR, but roughness doesn't seem to blur the reflection texture. Is there any way to convert a cubeTexture to a equirectangular format (so it can be seen on 2d) and saved to disk? or easier question: is there a way to save a cubeTexture (from a reflection probe) to disk? In dds format or whatever format. The purpose would be to save the cubeTexture to disk, and not have it generated. We could create a tool to bake all reflections, and then save to disk. So we would calculate all reflections once, save to disk, and on deployment just provide the textures that would be loaded as cubemaps from equirectangular / spherical / or any other projection that can be saved in one file. Is there any way to get callbacks on BABYLON.ReflectionProbe and know when each has finished rendering? I am using probe.refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE; .. I would like to have on the load screen (Babylon loader) a text that shows how many probes are pending to render. Is there any way to integrate the Reflection Probes into the Babylon Loader? Is there anyone who can explain more about reflectionTexture.boundingBoxSize? I can't find any information about it. I tried setting it to mesh.getBoundingInfo().boundingBox.extendSizeWorld() and I get bad results (reflections appear too small): Arbitrarily I set it to getBoundingInfo().boundingBox.extendSizeWorld.scale(6) and now results are better; but I need to really understand what it means and what I am doing, so I can set this value dynamically for all objects on scene correctly. If you can't answer any of the questions but you like what I am doing, also please let me know! And if you are an advanced user and you think my concept is a bad idea, please also let me know so I don't lose so much time in this investigation, or so we can together make it different and better! Thanks everyone!
  13. Rodrix3

    Advanced Baking of Reflections Script

    The results are much better than not using local reflection probes, but I hope we can improve it. I want to test this for a bigger scene. Is there any way I can put make each reflection probe to load one at a time instead all at once and put be able to display on loading screen the progress for each probe? This is the comparison between local and non local reflection probes. There is an improvement, but I am quite sure most likely I haven't set the position or size of bounding box correctly, so please help me double check it.
  14. Rodrix3

    Advanced Baking of Reflections Script

    Thanks @Deltakosh I updated it! https://www.babylonjs-playground.com/#J0D279#11 I added these two lines and added a cube on the center to test reflections on a flat surface: scene.meshes.material.reflectionTexture.boundingBoxSize = scene.meshes.getBoundingInfo().boundingBox.extendSizeWorld; scene.meshes.material.reflectionTexture.boundingBoxPosition = scene.meshes.position; (Are they ok?) The results don't seem as expected....Also after changing to extendSizeWorld the reflection on the floor disappeared. Maybe we are not measuring the box size correctly or the position? (Is the position world coord?). Thanks! ..I hope we can make this work. It would be really interesting.
  15. Rodrix3

    Advanced Baking of Reflections Script

    @Deltakosh, any thoughts? ..and any idea how to set the boundingBoxSize properly? I am not sure how to get the actual size of the mesh, and so if you look at my demo the reflections don't look as they should..