Nabroski

Members
  • Content count

    712
  • Joined

  • Last visited

  • Days Won

    9

Nabroski last won the day on December 10 2016

Nabroski had the most liked content!

1 Follower

About Nabroski

  • Rank
    Advanced Member

Recent Profile Visitors

1,154 profile views
  1. FBO - 2d lighting?

    DumpFrameBuffer http://www.babylonjs-playground.com/#10OY8W#9 Just in case you miss it: https://doc.babylonjs.com/how_to/how_to_use_depthrenderer_to_get_depth_values found via playground search https://www.babylonjs-playground.com/#1TDGFQ#6 Those blocky edges you see in 512x512 Tex Resolution are Reptiles of the past. - Nostalgic, but yeah still fun.
  2. FBO - 2d lighting?

    So my theory is when you take a spotlight an flip the direction model - object - viewer position and project in back on a plane in a custom shader you can archive shadows actually a lot of work https://doc.babylonjs.com/babylon101/lights and then modify the source code to working for your needs. You test against meshes in 3d or 2d texture ? I think your Walls all defined by the Alpha Channel, let's see maybe i can t hack a simple Ray Tracer shadow map. ( I currently working maybe in 2 Weeks ) FBO is in Babylonjs a RendertargetTexture i think, otherwise DumptheFramebuffer never fails. For Shadow map you need also the enable Depth Test - some tutorial, forum post easy to find, but you always and in WebGL1 Mode ends up with 3 different shaders, and then still with blocky edges etc. proof of concept http://thebookofshaders.com/edit.php?log=171101083737
  3. Best method to change pointer on hover

    maybe it's helpful https://www.babylonjs-playground.com/#DSH13I#1
  4. Shader Loop Question

    "Now when I sample a tile I should get a return of [1/255, 0/255, 0/255, 1.0] " No if you want to test against r:1 you should do 255 /254 ~ 1.00390625 https://www.khronos.org/registry/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf mediump - 10 bit, floating point range: -2^14 to 2^14, integer range: -2^10 to 2^10 https://oletus.github.io/float16-simulator.js/
  5. Shader Loop Question

    https://www.google.de/search?q=1.%2F255. if (tile.x ==0.003 ? Also check if the AlphaBlending is On { needAlphaBlending: true, needAlphaTesting: true } https://playground.babylonjs.com/#PYK67E#25
  6. Shader Loop Question

    So the only differenceis the extra blank space ? IDK maybe becourse some camera matrix computation is happening ? vec4 p = vec4( position, 1. ); // vPosition = p.xyz; gl_Position = worldViewProjection * p; so the plane has a depth, babylonjs will also compute all the necessary steps befor it gets to |-1, 1 | coords of your screen, (maybe) it also lead to distortion https://github.com/Pryme8/TileMaster/blob/gh-pages/ani-test.html#L273
  7. Shader Loop Question

    (sorry, for three post in a row, their is kind of short cut that makes you submit ...weird) i'm also no genius here, change some numbers and see what the do, - the main challenge is to equally cut the frames 100/8 = 12.5(1 frame width) rows and 100/5=20(1 frame height) cells we are close
  8. Shader Loop Question

    @Pryme8 i press the enter key to early look at this pic x:y{0,0} is in the left-bottom x:y{1,1} how many frames[cel,rows] 8x4 = 32 length of one image = 4? (.25 ?) vuv / 4. + 100/8 rows = 12,5, - but i guess its smaller you have to figure it out @Pryme8 also this is not an 8rowsx8cells image so you have to cut the last cells (fract(vec2(_t, 3 - _t /FIVE OR LESS )/ALSOABITTRICKY)
  9. Shader Loop Question

    vuv = vector of two components {x , y} /4. the range for x = | 0 - 1 | the range for y = | 0 - 1 | vuv divided by four = 0,25 vuv / 4. + fract (implementation in glsl x-floor(x)) vector of two components {_t , 3 - _t / 4) }/ 4. mod(time,16) = time modulus operator 16 means is the number divisible by 16 ? yes return true : false return flase 3-mod(time,16)-4/4 means step 1 time slower then the x component in the vetcor 3-(mod(0.0)/4 when b = 0 = 0.75 again devide by four and so on http://www.wolframalpha.com/input/?i=({y,x}%2F4.)%2Bfract(({0..16,3-0..16%2F4})%2F4.),x%3D0..1.,y%3D0..1. float how many frames = 16 mod(time,how many frames) float length of one image = 4? so its equal divisible vuv / length of one image . + fract(vec2(_t, 3 - _t /length of one image ) / length of one image ));
  10. Shader Loop Question

    @Pryme8 Yes, i know. I was placing the #version derivative a second time ( it's already done by babylonjs ) becourse gl_FragColor in WebGL2.0 is deprecated and now is is able to have multiple outputs, so you can write directly from shader to shader etc. So my custom shader is compete with babylonjs the default material https://github.com/BabylonJS/Babylon.js/blob/407b2d3f0ffe9d7e80ecc670ebab7fc3f14bae9d/src/Shaders/default.fragment.fx#L420 ( but im not sure about this ) Compatibility Mode Solution 1 (quick and dirty) #if __VERSION__ >= 300 https://playground.babylonjs.com/#PYK67E#17 Compatibility Mode Solution 2 Their a function i forgot like scene.StandartMaterial=null, or scene.hasDefaultMaterial(NO); Ok, so this is a webgl1.0 shader - when i done it right, should work https://playground.babylonjs.com/#PYK67E#16
  11. Shader Loop Question

    OFFTOPIC @NasimiAsl "why you don't use Mod and floor" Whatever works, -works https://playground.babylonjs.com/#PYK67E#13 http://www.wolframalpha.com/input/?i=({x,y}%2F4.)%2Bfract(({0..16,3-0..16%2F4})%2F4.),x%3D0..1.,y%3D0..1.
  12. Shader Loop Question

    @Pryme8 "what If the number of frames is dynamic and they have different timings?" Yes, you need to make a grid[row,colums] and then Access the values. - different timings -> then will be calculated based on grid[row,colums] .length frame: 0 1 2 3 texPos: 0.2,.0.4,.0.8. 1.0 or -> firstpos 0.2 +firstpos 0.2 = frame 1 // prev.pos PLUS=MOVE TO NEXT POSTION float _t = sin(time);if(0.5<=_t)tile.xy += aTile.xy;if(0.25<=_t)tile.xy += aTile.xy; // NEXT POSTION ? if(aS>_t){ for(int i=0; i<maxFrames; i++){ aTile = texture2D(animationMap, aTile.xy); if(aTile.a == 0.0)break; aS = aTile.b; if(aS>_t){ tile.xy = aTile.xy; break; NasimiAsl vec2( mod( (p.x*4. ),1.)/4. /*take one column */ + _t * 0.25 /*move columns (t = frame )*/ ,p.y) + make a grid on a texture + specify a singel element(char) [width,height] + move the singel element position along the grid to get the next element :
  13. Shader Loop Question

    So i did a little shader, this is not what you are looking for ... so i would do everything in a singel shader test for color and the print the nummbers. i wrote some notes maybe you find something usefull https://playground.babylonjs.com/#PYK67E#5
  14. @Sebavan can you also add more bits (ANGEL== RGBA8) to the environment.dds, i'm into photography and the HDr looks a bit crunchy (chrome latest dev-build 64bit, firefox latest)
  15. Shader Loop Question

    function recursion an that is all webgl 2.0 stuff. you need to do and if statement in a while loop becourse in your shader the while loop never exits (has no real logical exit condition) sin(t)<5&& is repetitive https://stackoverflow.com/questions/872996/immediate-exit-of-while-loop-in-c