• Content count

  • Joined

  • Last visited

About sable

  • Rank
    Advanced Member

Profile Information

  • Location
    New Zealand

Recent Profile Visitors

1,006 profile views
  1. sable

    BabylonJS render slower thanThreeJS?

    It seems odd that there is not much of a performance boost when setting all meshes to alwaysSelectAsActiveMesh = true, but a big boost from freezing active meshes. Intuitively I'd think they'd have similar results.
  2. sable

    BabylonJS render slower thanThreeJS?

    I agree that evaluate active meshes seems unreasonably slow, especially in the case where all the meshes in the scene are marked as always active. The difference between having all the meshes marked as always active, and freezing the active meshes array is 30 -> 45 fps for me.
  3. sable

    BabylonJS render slower thanThreeJS?

    You can make up most of the performance difference just by freezing the material. Though the techniques above (instancing or sps) perform far better for scenes like this. It's certainly worth investigating these sorts of things though.
  4. sable

    Coloring backface

    If you're ok using BABYLON.CustomMaterial, you can do this like so: It's probably a bit faster doing the dot product in the vertex shader though: You would probably want to pass in the desired color as a uniform instead of hard coding it.
  5. sable

    Babylon shows a different result

    Would you be able to make a pg showing that behaviour? It might though be easier to just export the model as left handed as per @brianzinn above,.
  6. sable

    alphaIndex occurs depth problem.

    Actually pretty sure it's your sort function, needs to return a -ve number, +ve number, or 0, not true or false. If you log out the position.z of each mesh after sorting the way it was you'll see that they're not in the correct order. It would be less work just using the pos.z - campos directly as the alpha index though, unless there is some other reason you need to sort them.
  7. sable

    alphaIndex occurs depth problem.

    Thought I'd just chime in here to confirm that I get the same effect as @klaude, blinking and wrong order. Interestingly it works fine though if I use the distance to the camera as the z-index.
  8. I've just done something similar for 3ds files, which while not removing a dependency on blender, makes it really easy to batch convert models using the babylonjs blender exporter. I'm sure other formats could be converted using a similar method. import os import bpy import sys # see # make sure scene is empty bpy.ops.wm.read_homefile(use_empty=True) path_to_3ds = sys.argv[5] file_list = sorted(os.listdir(path_to_3ds)) autodesk_list = [item for item in file_list if item.endswith('.3ds')] for item in autodesk_list: bpy.ops.wm.addon_enable(module="babylon-js") path_to_files = os.path.join(path_to_3ds, item) bpy.ops.import_scene.autodesk_3ds(filepath = path_to_files) bpy.ops.bjs.main(filepath= os.path.join(path_to_3ds, item.replace("3ds", "babylon"))) # bpy.ops.export_scene.obj(filepath= os.path.join(path_to_3ds, item.replace("3ds", "obj"))) bpy.ops.wm.read_homefile(use_empty=True) And then call this using: "$BLENDER_LOCATION" --background --python ./ -- "$PATH_TO_MODELS" Some fixing up afterwards (due to 3ds models not having a diffuse colour, and a few other things) is done using sed on the .babylon files after this, but what (if anything) needs fixing would depend on the input format. For the models I've been converting, it's been taking less than a second for each one.
  9. sable

    Babylon shows a different result

    The model might be right handed. You could try: scene.useRightHandedSystem = true;
  10. sable

    Hide a sprite

    Looks like lines 252 and 257 need to be adjusted to take into account sprites that have been made invisible.
  11. sable

    Unable to get mesh on click event

    Hi @Varsha Kamble I became far too interested in how to go about implementing this, and ended up making an improved pg based on your one above: I changed the dragging implementation to use mathematical planes as projection targets (as opposed to just mesh picking). This has the advantage of not needing the pointer to always be above a mesh when dragging, and also means that all three axis should get a nice 1:1 mouse movement to screen movement in the given axis direction. Hope the above is useful and/or interesting to someone.
  12. sable

    Label above the mesh See lines 134-144. Uses two methods suggested above; modifying linkedoffsetY each frame, or using an empty mesh parented to the desired mesh. What @Gijs suggested is basically what the GUI module is doing internally anyway, so is no heavier than relying on that. Regarding linkedOffsetY calculation each frame being too heavy, you're going to run into performance issues with projecting positions to screen space each frame long before performance of such a simple calculation is a concern.
  13. I've noticed that when using an action manager with sprites, both the OnPick and OnPickUp triggers are fired twice. This can be seen in the example (here), linked to from the documentation (here). Looking at the code, this seems to because scene._initClickEvent calls it's callback twice (here and here, cb being defined here). This could be solved by checking if clickInfo.ignore is true before doing all the sprite checking, unless there is a good reason this wasn't done in the first place.
  14. sable

    Instancing bug

    Thanks. Would you be able to link me to the fix?
  15. sable

    Instancing bug

    There seems to be an issue with instances in the preview version (stable is fine). Moving an instance too far way from the camera causes the original mesh to vanish (and also sometimes causes black artifacts to appear in the scene when moving the camera).