• Content Count

  • Joined

  • Last visited

About hcmetal

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @kcoley, thanks for making it clear. I am wondering, assetsManager aside, is there a more "wholesome" way to cover all the various loading scenarios? For example, we need to load multiple .babylon files and additional texture files (not included in the .babylon files but later used in the scene, such as ao and lightmaps). Is creating tasks for every single asset and counting the number of tasks the best we can do, or with some combination of techniques, a more idea way of calculating loading progress can be achieved. By "idea" I mean evaluate loaded file size and show progress based on it. (for the sake of convenience let's suppose the total file size is known before hand) From the users' perspective, most of the loading time is spent on networking (downloading various files from a remote-server). Maybe this is an issue beyond Babylon and should be solved with some network magic (code) ?
  2. Hello, everyone, I am trying to make a custom loading screen without using the built-in loading UI. So I set up an assetsManager: const assetsManager = new BABYLON.AssetsManager(scene); assetsManager.useDefaultLoadingScreen = false; const meshTask = assetsManager.addMeshTask( "load meshes", "", "/assets/", "hotel.babylon" ); and try to use: assetsManager.onProgress = function(remainingCount, totalCount) { // Some calculation logic and sent the result to other UI components... }; It works but there are two problems: 1. The counting does not take the texture (related to the exported materials in the .babylon file) loading into consideration, so the loading process is not fully covered. Do I need to set up textureTask for every single texture and re-assign them to the respective materials? I cannot wrap my mind around it... The built-in loading UI seems to take texture loading into account and disappears after all the textures are loaded. 2. The counting is based on file number rather than file size. I know in SceneLoader call back function there is an eval object that can calculate file size. Is it possible to do something similar with assetsManager? Hope someone can point me to the right direction. Thanks alot!
  3. @kcoley, thanks! Looking forward to it. or now I just write some code to set the appropriate transparencyMode for each material once they are loaded into the scene.
  4. hcmetal

    How to occlude glow effect

    Ah, silly me. It is unnecessary to use addIncludedOnlyMesh method in this particular case. The glow layer only affects emmisive materials.
  5. Hello everyone, I am trying to find a way to properly occlude the glow effect. Consider: from the other side: The glow effects are not occluded by the walls and other opaque objects. Related code: const lamps = scene.getMeshByName("hotel_lower_lamp"); const glow = new BABYLON.GlowLayer("glow", scene); glow.addIncludedOnlyMesh(lamps); Just to be sure, I have also set opaque materials: material.transparencyMode = 0; Hope someone can point me to the right direction. Thanks alot!
  6. @Deltakosh, thanks a lot for the tip. Seperating the leaves from the stems and setting different material attributes has given me the best of two worlds.
  7. @V!nc3r, this is so cool and thorough! Love it!
  8. After reading the docs: https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered and experimenting with the bamboo, I realized there might be a dilemma here: 1. Transparency mode set to "alpha test" will result in bad anti-aliasing around the transparency borders (which is very obvious from afar), but have no z-sorting or normal-inversion problems; 2. Transparency mode set to "alpha blend" will result in good anti-aliasing around the transparency borders, but have z-sorting and normal-inversion problems, because the model is intersecting with itself and backfaceculling is disabled; Even if I enable backfaceculling and double the faces of leaves with inverted normals (which might cost some performance?), the z-sorting is still problematic. So I am wondering what is the best way to deal with this kind of plant models in Babylon... Is there a better way to break up the model somehow and set proper material types so that the idea combo of "good anti-aliasing" + "correct z-sorting" + "no inverted normals"? Or maybe the alpha channel in the .png albedo map should be somehow premultiplied (or not) to achieve better anti-aliasing? This might be leading to a different issue than the original topic of the post, but I think this is a very important topic nevertheless because plants and vegetation are common in both game and arch-viz. Hope we can work together on this issue and eventually make the bamboo look good Cheers everyone!
  9. Great! So I think the quick solution for the time being is to set "mesh.material.transparencyMode = 1;" like @V!nc3r and @Sebavan suggested.
  10. @Sebavan, thanks! As shown in this PG: https://playground.babylonjs.com/#RXQXIY#5 I changed the .png albedo map's alpha source from "Image Alpha" to "None (Opaque)" in Max and the Z-sorting / face invertion problems are gone. However the transparency of the leaves are gone too... So maybe I have to use alpha-blend?
  11. Wow, thanks so much! I never realized that these are actually two different things in babylon. Will try gltf tomorrow and report back
  12. @V!nc3r, thanks for your help! Re-assigning the material in babylon does solve the problem. However, as I try to understand the docs: https://doc.babylonjs.com/resources/3dsmax_to_gltf#pbr-materials Phyiscal materials (or any exporter supported shader types) in max are converted to PBRMaterials in babylon, and there doesn't seem to be an option of material conversion in the exporter. So my understanding is that materials should be converted to (and only to) PBR through the exporter automatically. Maybe something goes wrong during the export and re-assigning the PBR clears the problem. This provides a partial but nevertheless practical solution to the problem: Even if the export is sometimes problematic and unpredictable, I can always wirte some batch-material-re-assigning code to "refresh" them. Thanks again!
  13. Here is a new PG with problematic mesh faces on the bamboo model, they are inverted and penetrating each other: https://playground.babylonjs.com/#RXQXIY#1 This might be caused by the fact that the albedo map has alpha information to make the leaves transparent. Because the leaves are single faced, I set mesh.material.backFaceCulling = false; If culling is set to true, the invertion is gone but the z-order of the faces are still wrong. This might lead to a new problem with transparent albedo maps... I have also attached the max files and related textures for anyone who is interested in having a look. bamboo_diagnose.zip
  14. I created a PG with only the case and the .jpg file as albedo, the see-through dosen't happen this time... PG: https://playground.babylonjs.com/#AASQVX Notice that Babylon version in the PG (v4.0.0-alpha2) is different from my local project (v3.3.0-rc.4).
  15. Ok, guys. It is happening again, like a ghost. Same story here, change the .jpg albedo map to .png format, the see-through is gone. I will definitely PG this today.