thrice

Members
  • Content Count

    119
  • Joined

  • Last visited

About thrice

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    jasonayre

Recent Profile Visitors

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

  1. Could also maybe create a ribbon and update that as the sphere moves, and use that to track the spheres path, if that's what you are trying to do? (i'm assuming you're going for a 2d fog of war effect i.e. warcraft/diablo?) idk: https://doc.babylonjs.com/how_to/ribbon_tutorial
  2. Eh, not like that at least, you def can't store variables within the fragment shader itself. Part of your question sounds like maybe it could be solved with vertex shader, which is mostly outside my knowledge domain, but maybe not. However It also sounds like there might be a better way of doing what you are trying to achieve. You could probably use a custom render target to essentially bake the image as the sphere moves through it, or something to that effect? Then you'd just pass the baked image as a sampler to the main shader and use that to diff it? IDK I don't have much experience with render targets, but that is essentially how I would try to approach the problem, baking the image as some sort of 2d map of the fog of war as it's lifted, then you'd only need to update it as the circle is moving. (And you'd probably simulate that in another shader, in which you could pass the heightmap texture, and draw a circle on it, at the same scale of the main sphere / ground ratio, then you'd move the sphere by just passing in a xy offset to the circle, as the sphere moves, which would be drawn on top of the height map, which would be the thing you'd be baking)
  3. Ya so, you'd either have to do the calculations on the javascript side, and pass it to the shader as a uniform, or something else, but you can't store computed variables in the shader for the next pass if that's what you are asking. Are the sphere / background 2 different textures you're passing into the shader?
  4. It's possible, just not directly from within the shader. Instead you pass the data to the shader on the JS side of things, i.e. assuming you have an instance of shader material, pseudocode: shader_material.setVector3('inputColor', new BABYLON.Vector3(1,0,0); shader_material.setFloat('time', 0.0); Then after event occurs you can do something like current_time = 0.0; time_step = 0.01; scene.onBeforeRenderObservable.add(() => { shader_material.setFloat('time', current_time + time_step); });
  5. Hey Delta. I'm stuck on an older version of babylon atm (3.1) so no glow layer for me, but also I don't think glow layer works with shader materials? (all my effects are shader materials)
  6. Also, I tried using multiple cameras / layer mask, but the issue I am having is the pipeline knocks out the layer below it when it is applied. So in this PG, I am trying to make the shape mesh on top of the board have bloom applied, but the board underneath not bloom. (uncomment line 50 to see the issue I am having with this strategy, but I am hoping there may be a better way anyways?) https://www.babylonjs-playground.com/#4PG77U#2
  7. Basically looking to use the bloom post process but only for effect type meshes, which have baked illumination (projectiles and such), and maybe my main game board mesh. Anyone know an easy way to do this?
  8. thrice

    Question about isVisible

    The reason (or at least one of) is because isVisible=false can be used to group meshes together, so that the children meshes are still active in the scene (like a transform node in newer babylon versions). If you setEnabled(false) instead the child meshes will be removed from the rendering loop also. I believe there are other uses I've encountered as well just can't think of off the top.
  9. You should be able to make a custom shader material for this purpose, at least that is what I do. I use it when I want the material to appear exactly as is. Something like: BABYLON.Effect.ShadersStore['noLightFragmentShader'] = ` precision highp float; uniform float time; varying vec2 vUV; uniform sampler2D textureSampler; void main() { vec4 texture_color = texture2D( textureSampler, vUV ); vec4 final = texture_color; gl_FragColor = final; } BABYLON.Effect.ShadersStore["noLightVertexShader"]= ` precision highp float; // Attributes attribute vec3 position; attribute vec3 normal; attribute vec2 uv; // Uniforms uniform mat4 worldViewProjection; // Varying varying vec4 vPosition; varying vec3 vNormal; varying vec2 vUV; void main(void) { gl_Position = worldViewProjection * vec4(position, 1.0); vUV = uv; }`; this.babylon = new BABYLON.ShaderMaterial('blah', this.scene, { vertex: 'noLight', fragment: 'noLight', }, { attributes: ["position", "normal", "uv"], uniforms: [ "world", "worldView", "worldViewProjection", "view", "projection" ], }); `;
  10. thrice

    Video Texture / createInstance issues

    Hmmm. I'm on OSX 10.2 sierra. - Chrome v70.0.3538.110 - Also seeing issue on my macbook pro/chrome. Also seeing issue in my actual game which is running an older electron/chromium version (not sure which exactly). What are you running?
  11. thrice

    Video Texture / createInstance issues

    Sorry, use this playground instead for the broken version https://www.babylonjs-playground.com/#CAAXS7#3 In the one I posted originally, it was broken, but I was doing dumb stuff to try and work around it which makes it more confusing
  12. thrice

    Video Texture / createInstance issues

    Sure, though hard to demonstrate via SS due to flickering. Here are videos of: chrome version (broken) https://www.dropbox.com/s/b5e8zkv0vjl6be4/video_bug_chrome.flv?dl=0 safari version (working) https://www.dropbox.com/s/jx5jrl17a5es8vb/video_safari.flv?dl=0 Are you seeing the working version or the bugged version?
  13. thrice

    Video Texture / createInstance issues

    Just opened 2nd example on my iPhone X and runs flawlessly however. So maybe bug with engine? Or something with auto play? Though I don’t see why that would be the case when the first example is working in chrome
  14. So I am having issues with videoTextures and createInstance. I thought it was related to alphaBlending/mode and what not, but I am able to get it working perfectly if I just use clone or without createInstance. So I am wondering if it's an issue with video texture, or just my createInstance implementation in my custom shader (though I use the same code elsewhere for createInstance with non video textures and as far as I can tell it works correctly.) Anyways here is a working playground version, or what should be happening, using clone. https://www.babylonjs-playground.com/#TQUA6H Here is the fubar version. It really is quite fubar, all sorts of different glitches. Like sometimes there is a big blue plane blocking one of the textures each time, sometimes the videos go at superspeed and don't seem to recognize where they are supposed to stop playing, sometimes one vid will play and not other, and ONE time, got it to work perfectly but couldn't reproduce after that. So I am at a loss. https://www.babylonjs-playground.com/#CAAXS7 Anyone have any ideas? (also make sure to hit run after you load playground, on both of them. and left click to play the videos);
  15. thrice

    video alpha channel approaches

    In case anyone else stumbles on this thread like I did yesterday, here is a working example on how you can faux do this. Basically rather than use a transparency channel I discard black pixels, and allow a discard threshold to be set, which will call discard on any pixel whose sum of r.g.b < discard threshold. https://www.babylonjs-playground.com/#TQUA6H I am however having some issues with video textures/instances but going to open a separate issue for that.