Jump to content


  • Content Count

  • Joined

  • Last visited

About SpaceToast

  • Rank

Recent Profile Visitors

863 profile views
  1. I've been working on an open world project that involves a lot of loading and unloading of assets. (A virtual museum of Earth history.) SceneLoader.LoadAssetContainerAsync() seems to be the only means of tracking which and when new assets have been loaded, as SceneLoader.LoadAsync() returns only the current scene. Where I'm running into trouble is the end of the life cycle. AssetContainer does not have a dispose() method. My attempts to manually create one have thus far ended in halt & catching fire. The removeAllFromScene() method will dispose of the assets* but I'm still left with a
  2. Hi Kosh, I tried looping through all the imported meshes, looking for one with mesh.animations.length > 0, but nothing comes up. Am I looking in the wrong place?
  3. Hi Nikita, EDIT: I was wrong! See below. BJS does indeed provide an easier method. This should be quite doable (I believe the Playground performs a similar trick.) but Babylon doesn't provide a method by itself. Mine the code in these examples to upload the file to browser memory. You may then need to call window.URL.createObjectURL() on the uploaded file to attach it (invisibly) to the DOM first. After that, you can pass the object URL the browser generates to the AssetManager as the rootUrl for Append() or AppendAsync() -- the sceneFilename property can be ignored. Sorry
  4. Is importing animations (in this case, from Blender) in an assetContainer currently supported? I can see the animation data in the .babylon file, but scene.animations, container.animations, and all mesh.animations arrays come up empty.
  5. That's not a drawback in this case. Unfortunately, after 6 hours trying to understand the source code, I'm no closer to figuring how to inject a new uniform into the StandardMaterial object at runtime. It's just too amazingly complicated. Afraid I'll have to go back to my previous method. 😔
  6. I was 100% wrong about that last comment. Replacing the StandardMaterial's shaders is as simple as: BABYLON.Effect.ShadersStore["defaultVertexShader"] = ` //Copy the StandardMaterial's vertex shader code in here, and modify away. //Template literals are your friend. `; BABYLON.Effect.ShadersStore["defaultPixelShader"] = ` //Copy the StandardMaterial's pixel shader code in here, and modify away. `;
  7. Thanks @Pryme8, @Sebavan and @NasimiAsl. CustomMaterial looks like exactly what I need. Unfortunately, it doesn't seem to be production-ready just yet, based on the other forum threads. I could see saving a bit of trouble by replacing the StandardMaterial object with a custom version at runtime--one containing my changes. I'm not really familiar with JavaScript modules, however: They seem to be designed specifically to prevent code from tinkering around inside their scope.
  8. I'm picking up an older project again, and moving it to the current version of BJS. This is a pain, though, because I'd been extending the StandardMaterial shader within a copy of the BJS framework itself. The project made extensive use of noise and shape functions to simulate textures within the GPU by altering the diffuse, specular and normal values of the StandardMaterial, based on a flag hacked into the framework. The advantage of this method vs. ShaderMaterial was getting unlimited resolution textures at no bandwidth cost without having to reimplement all the goodies in the StandardM
  9. I'll migrate over to the 3.2 preview and experiment with it! Looks like a great tool.
  10. What is the best way to get the results--the appended bits--from BABYLON.SceneLoader.Append() ? The function for a single model, BABYLON.SceneLoader.ImportMesh(), and the function to load a new scene BABYLON.SceneLoader.Load(), both return their result, but Append() seems to only return the existing scene. I believe I understand the concept in this thread--mark everything that's already loaded before calling BABYLON.SceneLoader.Append(), at which point everything that's not marked can be assumed to come from the file load. The trouble is, if multiple files are being loaded, there's no gua
  11. Sorry to "bump" an old topic, but is there a better way to get the results--the appended bits--from BABYLON.SceneLoader.Append() ? I believe I understand the concept above--mark everything that's already loaded before calling BABYLON.SceneLoader.Append(), at which point everything that's not marked can be assumed to come from the file load. The trouble is, if multiple files are being loaded, there's no guarantee that all of the new meshes, lights and cameras came from the same file when this append's onSuccess fires. (This is assuming file loading happens async.) I suppose it would b
  12. (Edited out into its own post, because, messiness.) A further discovery I'd love to have verified: It appears that the uniforms above do not need to be declared when creating a shaderMaterial -- Babylon.js supplies them for you. So rather than declaring: var shaderMaterial = new BABYLON.ShaderMaterial("shader", scene, {vertex: "custom", fragment: "custom"}, {attributes: ["position", "normal", "uv"], uniforms: ["world", "worldView", "worldViewProjection", "view", "projection"]} ); You can omit the attributes section, unless supplying your own custom data to the shader: va
  13. Kosh's link. Based on the CYOS examples, I can verify that the following are available: // Attributes attribute vec3 position; //vertex x,y,z attribute vec3 normal; //normal x,y,z attribute vec2 uv; //uv (texture map) 2d coordinates // Uniforms uniform mat4 world; //convert from model space to world space uniform mat4 view; //convert world space to camera-relative space uniform mat4 projection; //flatten camera space to frame view uniform mat4 worldView; //world and view, pre-multiplied for you uniform mat4 worldViewProjection; //world, view & projection pre-multiplied uniform sampler
  14. Dead link. Has this been added to the documentation? I wasn't able to find it. If not, maybe someone wouldn't mind pasting the relevent information into this thread for posterity's sake?
  15. I'd love to see any of the following: LOD enhancements: LOD blending. Not sure what the "cheapest" method to reduce pop-in is. 1-bit pattern masks? Load and dispose at LOD. A "set it and forget it" method to load a model/scene file into the current scene when needed, then dispose of it when no longer needed. This would be quite helpful for building large/streaming type worlds, but useful even for small scenes to reduce load times. (Everyone hates a loading screen!) More user-friendly shaders: Built-in primitives. Rather than Road, Fire, Brick, etc. a
  • Create New...