All Activity

This stream auto-updates     

  1. Today
  2. Run without rendering (for online game)

    The server's logic will differ from the client's. There's no escaping developing them separately. Just think about what you want for your server side game loop and go from there.
  3. TypeScript strictNullChecks

    @Deltakosh - Just noticing a lot of checkins lately for strictNullChecks - are you working towards having the entire library compatible? It seems like a good idea (and it is), but it's a lot of cascading tedious changes
  4. Shader Loop Question

    Ok I finally got to look at your example with: float _t = sin(time); if(0.5<=_t)tile.xy += aTile.xy; // 1 if(0.25<=_t)tile.xy += aTile.xy; // 2 ; if(-0.25<=_t)tile.xy += aTile.xy;// 3 ; if(-0.5<=_t)tile.xy =tile.xy;// 4 ; And that is fine, for hard coding the animations in, but what I want is to sample the blue channel from aTile check if its > then _t and if so stop on that tile. I know this seems weird to do but there is a really good idea behind this that I just don't feel like explaining at this juncture. The proccess that I am looking for would be like: 1) Check the layer texture for what sprite to reference; 2) With the X:Y value of tile, check the value on that sprite on the animation sheet; 3) If the alpha is 0 on the animation sheet do nothing but return the base sprite; 3a) Else if the Alpha is > 0 on the animation sheet get the blue value and test; 4) if its > then _t if so, set the red and green channels (or the xy) of the aTile to the tile.xy and output that sprite. 5) if its < then _t get the current aTile.xy and re sample it to get the tile that it points to on the animation texture; 6) repeat steps 3-5 as necessary until the blue channel meets the requirements or you run into a 0 alpha tile. you need to shift the _t into a range of 0-1 though because the blue channel is in that range. This will make it so any tile can reference any other tile on the sheet for animations and once I put together the editor it will be seamless I am hoping if I can figure this one part out.
  5. Shader Loop Question

    OK. I understand, this can turn out a time consuming project. But also a very interessting one. I think what you are looking for is kind of text font rendering technique using shaders, some good implementations here: https://www.shadertoy.com/results?query=font
  6. Good day / night guys , i think i solved it ! @jerome you were totally right , i noticed some of the meshes were loading before the heighmap load completely , that's why i needed to reload many times so all items appears on the scene : This was the way i was creating the ground : var ground = BABYLON.Mesh.CreateGroundFromHeightMap("groundterrain", "img/heightmap.png", 1024, 1024, 100, 5, 80, scene, true); I solved it this way , correct me if i am wrong please , first of all i used the : onReady method , as i told you before , i am using the "assetsManager" , at the beginning , i was doing this : ground.onReady = function () { var stones = assetsManager.addMeshTask("stones", "", "assets/stones/", "stones.babylon"); stones.onSuccess = function(task) { task.loadedMeshes.forEach(function(mesh) { mesh.isVisible = false; var range = 1024; var count = 40; for (var index = 0; index < count; index++) { var newInstance = mesh.createInstance("j" + index); var x = range / 2 - Math.random() * range; var z = range / 2 - Math.random() * range; var y = ground.getHeightAtCoordinates(x, z) ; // Getting height from ground object newInstance.position = new BABYLON.Vector3(x, y, z); } }); } } But i noticed the meshes were not appearing with that way, any ideas why ? So , ... i solved it this way instead , adding the assetsManager.load() inside onReady method: ground.onReady = function () { assetsManager.load(); } Now everything loads completely without issues or delay. Btw as you can see i am using the assetsManager , but i also tried using the SceneLoader.ImportMesh this way: ground.onReady = function () { BABYLON.SceneLoader.ImportMesh("SmallTree1", "assets/SmallTree1/", "SmallTree1.babylon", scene, function (newMeshes) { }); } This method also load perfect too , as you can see in the code above i can include the BABYLON.SceneLoader.ImportMesh inside the onReady method , and in this case it works perfect not like the assetsManager.addMeshTask that were not loaded. what do you think guys about this methods ? , i don't think it will impact on performance . don't it ? , and sorry if this question is noob but which method on importing objects is the best assetsManager or SceneLoader.ImportMesh ? , in which case do you think is the best on using each? , thanks for your support guys ! i am really grateful to have a great comunity on babylon !
  7. Yesterday
  8. Shader Loop Question

    What if I don't know the number of frames I'll take a look at what you got when I get home.
  9. Keep in mind that Adsense for Games requires 1 million games views per month to participate.
  10. Could work: http://playground.babylonjs.com/#J89UGC#1 I wonder what the performance gains are, compared to using a physics-engine.
  11. extend Phaser.Text overwrite "text" property

    @samme have you any clue is that possible to overwrite setter of object instead of class? To keep file list relatively small and do not call my own doAfterTextUpdate() method every time I change text value p.s. I am very tired or Phaser works very weird. When I call alingIn outside of the class everything works fine, but when I call it within class, it no longer calculates alignIn according to game.world but instead regarding object itself.
  12. cannot apply gray filter to sprite

    @samme I am not sure if it will work for my particular case (my question was simplified) but I like clipping path, which may come up handy for weird clip masks, I should bookmark that page, thanks! @samid737 The getImageData() method seems to be native HTML5 method as it works with canvas context (the text actually has both canvas and context public properties). Probably it would be nice to have small wrapper function to quickly access line and get each pixel as array/object (in win32 development, working with canvas is hundreds slower than bitmap and bitmaps are another hundreds slower than scan line, which is something similar what getImageData() method returns). I just finished auto_fit_bounds method and should have time to give a shot for a custom gray scale converter (I will update topic if I have success)
  13. extend Phaser.Text overwrite "text" property

    That's way strange but seems like if you try to overwrite property then you should do both getter and setter... here is working solution: export default class MyTextClass extends Phaser.Text { get text() { return super.text; } set text(value) { super.text = value; } } @samme I was trying to do only setter and I was getting unclear error message, so finding this solution is pure luck. BTW updateText() method is awesome solution too, as it's called every time text is changed, thanks! =)
  14. Ahh firefox properly outputs the error: Error: WebGL warning: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one. How am I exceeding 16 live webgl contexts with a single copy? EDIT: Nevermind, that doesn't relate to this error, I don't get this error in Chrome or Edge.
  15. extend Phaser.Text overwrite "text" property

    That would be it, but it has no effect since the existing property is marked nonconfigurable. You might overwrite the Text#updateText method instead. Or you can extend the whole Phaser.Text class with your own and add your own get/set.
  16. THREE.MultiMaterial has been removed. Use an Array instead

    You can export your model to JSON from 3D Editor by exporter and load it like this: var loader = new THREE.JSONLoader(); loader.load('./models/warehouse.json', function (geometry, materials) { var wareHouse = new THREE.Mesh(geometry, materials); scene.add(wareHouse); });
  17. Shader Loop Question

    Hello @Pryme8 let my rephrase, for my own understanding, the goal - deserved look is to loop through the nummers 1 -4, - more generally speaking through a specific area and simpel if statment : http://musician-elephant-31700.bitballoon.com/ is not enough, you want to test for a specific color value in an area, and when it's present, then cut out the object, - like in photoshop select area by color ?
  18. P2 body polygons

    Hello! I am starting to build a new stickman fight game, and I'm learning how to use P2 physics. I could find just one program to set the polygons and export it to a Json file, but is paid (PhysicsEditor). I'm looking for a free alternative, but I don't know very much about it, I tried Physics Body Editor but I didn't understand how to use it..... Does anyone knows any free license alternative or even web service? Thanks.-
  19. I'm trying to test out morphtargets, so I load up a scene and try to create a copy of the original mesh to then scale it and morph between the two, but for some reason the original mesh isn't being rendered anymore, plus the copy isn't hidden with setEnabled(). If I remove all of the copy code, the original mesh starts being rendered fine again. var scene; var mesh; var meshCopy; if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("assets/2/", "untitled.babylon", engine, function (newScene) { newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); scene = newScene; mesh = scene.meshes[0]; mesh.convertToFlatShadedMesh(); meshCopy = mesh.clone("1"); meshCopy.x -=10; // meshCopy.parent = mesh; meshCopy.setEnabled(false); meshCopy.position.y =+ 1; meshCopy.scaling = new BABYLON.Vector3(1.1, 1.5, 1.0); meshCopy.bakeCurrentTransformIntoVertices(); var manager = new BABYLON.MorphTargetManager(); mesh.morphTargetManager = manager; //var target = BABYLON.MorphTarget.FromMesh(meshCopy, "instance1", 0.25); engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { }); }
  20. cannot apply gray filter to sprite

    ProcessPixelRGB does some work by calling internal functions, so it might be slower than using getImageData. If you run the code once I don't think execution time will matter too much. Im also not familiar with scan line, is it part of the canvas API?
  21. [Phaser] Animal Connect

    hmm....strange. Thanks for checking the game Which device/browser are you using?
  22. cannot apply gray filter to sprite

    CANVAS blendMode is just globalCompositeOperation so it really might be faster. But wouldn't it definitely be easier?
  23. Hello, How can one overwrite property of object, what's the syntax? Object.defineProperty(Phaser.Text.prototype, 'text', { get: function() { return this._text; }, set: function(value) { if (value !== this._text) { this._text = value.toString() || ''; this.dirty = true; if (this.parent) { this.updateTransform(); } } } }); I would like to extend Phaser.Text, so I need to handle the moment when text is changed. Of course I can overwrite setText() method but what if by mistake in future I will access .text property? Thanks in advance
  24. cannot apply gray filter to sprite

    @samid737 what about processPixelRGB method, is it significantly slower than scan line? As far as I now, JS works faster with one dimensional arrays... when I got inside of processPixelRGB method, I can see that it does many calculations and conversions. However, if that's just 10-50msec then I would prefer cleaner (readable) code with processPixelRGB over faster getImageData
  1. Load more activity