Jump to content


  • Content Count

  • Joined

  • Last visited

About georage

  • Rank
    Advanced Member

Recent Profile Visitors

1067 profile views
  1. Is there any way to create a dynamic texture from a noise function? I thought this was possible and created a function to generate a 2D array of color values but it seems from my searched that dynamic textures require an image. I guess I could make an image from the array, but that seems like a step that could avoided.
  2. Hey, maybe try this? save your vertex data as a file and load it with this function. function loadMesh(directory, fileName, scene){ var rootURL = "json/" + directory + "/"; BABYLON.SceneLoader.ImportMesh("", rootURL, fileName, scene, function (newMeshes) { console.log(newMeshes); camera.target = newMeshes[0]; }); } here is an example of a loadable mesh file. It will take some time to load so wait for it. skull.babylon
  3. you can import vertex data to create or modify a mesh/shape. I can give you some working code in a bit, but check this thread
  4. You are trying to create a 3D shape that looks like a diamond? This may help. http://www.babylonjs-playground.com/#21QRSK#1 Tutorial on shapes: https://doc.babylonjs.com/tutorials/mesh_createxxx_methods_with_options_parameter
  5. Hey, I am not great with Babylonjs, but have managed to put together a few timesaving functions. I am sure you have too. If you have any that you thought were clever, please share them. None of mine are clever, but they are useful. Here is the humblest of all to get the ball rolling. All it does it output to the console for development. But once you go into production you can turn off all the console messages by commenting out one line instead of hundreds or thousands. function log(msg) { console.log( msg ); } I set and get global values with the following. There may
  6. Thanks, this seems to work quickly ... not sure about memory issues but can tweak later. I won't have more than 250 simple meshes in memory at a time either way, I don't think. function disableAllMeshesExcept(star, scene){ log(scene.meshes.length + " meshes detected"); var countMesh = 0; for (var i = 0; i < scene.meshes.length; i++) { if(scene.meshes[i] != star){ //log(scene.meshes[i].sName); scene.meshes[i].setEnabled(false); countMesh++; } } log(countMesh + " meshes disa
  7. Does anyone have any evidence (anecdotal even) on which method would be quickest? Scenario A: Dispose of 200 static meshes and create 12 new ones. Scenario B: Dispose of the whole scene and create a new scene with 13 static meshes. Scenario C: Not sure this is possible, but can you make babylon.js not render meshes? I could "turn off" the 200 static meshes so they do not interact with lights and player input. This would be the preferred method, I think, since it would minimize object creation, which in C is an expensive process. I can test it, of course, but was wondering
  8. No, a great PC will always outperform a great phone. My crummy 4-year-old laptop is better than my new S7, and my desktop PC blows them both out of the water. There is only so much magic a phone can pull off. A PC can have much better graphic cards, memory, cpus and the motherboard has much greater I/O bandwidth. BUT ... you can do some amazing stuff on phones ... just keep the mesh/vertices count down and be judicious and much is possible. As a benchmark my PC has no prob with animating 3,000 cloned shapes at 60 FPS but my phone has 10 FPS and my "business" laptop about 40. Wife's
  9. here is how i pick a mesh. maybe try that instead? feel free to change the "change position" bit of course. scene.onPointerDown = function (evt, pickResult) { if (pickResult.hit) { console.log(pickResult.pickedPoint.x); console.log(pickResult.pickedPoint.y); console.log(pickResult.pickedPoint.z); var pickInfo = scene.pick(scene.pointerX, scene.pointerY, function (mesh) { return mesh; }); var star = pickInfo.pickedMesh; //
  10. are you throwing an error? your console.log line does not end in a semi-colon. Not sure that will help but give it a shot.
  11. Well I'm as dense as a neutron star but I finally got it to work! Thanks wingy! for those who may find such things useful, this onclick function targets an arcRotate camera and toggles godrays on selected/previously selected objects. My star meshes are overloaded with custom names (sName for star name) which I check to make sure the mesh exists before trying to remove the godrays effect, so if you use this function be aware of this line ... if (prevTarget.sName). It will work without the check but throw an error the first time you select a mesh since no prior mesh/camera target
  12. do they pay you wingy? i hope so. and well! thanks again. I searched for hours and never hit the right links. but i did see you helping many people. i particularly liked this one. http://playground.babylonjs.com/#MX8Q6 (cool colored spotlights) and this one ... http://playground.babylonjs.com/#5R8A1 (layered fog) I feel like WE owe you many beers.
  13. Is it possible to remove the effect? Is it possible to check if the effect has been applied to a mesh (other than an independent variable)? I have an onClick event that adds the effect to the clicked mesh, but it seems to multiply the effect every time the mesh is clicked and it starts to look crazy. I'd like to remove the effect from non-targeted meshes to save gpu cycles, and be able to check if the effect even needs to be applied. Thanks for any tips. Here is an old playground I made if someone wants to play with it. http://babylonjs-playground.com/#AX6IZ#3
  14. On a semi-related topic, how would one go about delaying javascript functions. I can't find anything like sleep and all the stuff I googled doesn't seem to delay the function at all. I was trying "async await" and even timeout wrappers but it doesn't seem to block anything. Or perhaps this is too off-topic. I have a JS script populating a DB and was wanting to throttle it a bit.
  • Create New...