Pryme8 Posted October 30, 2017 Share Posted October 30, 2017 How does one go about doing FBO's with BJS? I have never used one and am trying to replicate https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows **EDIT** I think if I read up on this https://doc.babylonjs.com/how_to/how_to_use_postprocesses Ill be able to handle it! **EDIT AGAIN** So I have figured out how to create a custom post process using the shaderStore inline and am now looking to how to set up what I need to do the 2d lighting, will hopefully figure this out. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 31, 2017 Share Posted October 31, 2017 Love this thread Quote Link to comment Share on other sites More sharing options...
Nabroski Posted November 1, 2017 Share Posted November 1, 2017 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 concepthttp://thebookofshaders.com/edit.php?log=171101083737 Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 1, 2017 Author Share Posted November 1, 2017 I cant not effectively make the renderTargetTexture do anything...https://playground.babylonjs.com/#NL9S8A#2 Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 1, 2017 Share Posted November 1, 2017 Hi, this is a workaround https://playground.babylonjs.com/#NL9S8A#3. I don't know if is what you need, but works Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 1, 2017 Author Share Posted November 1, 2017 Yes and no! This does help with some stuff thank you. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted November 1, 2017 Share Posted November 1, 2017 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 searchhttps://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. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 1, 2017 Author Share Posted November 1, 2017 yeah I think I am working this out slowly thanks for your help recently. I’m pulling all the stuff I’ve been asking togeather and have next week off so I’m going to go at it hard I’m just trying to get all the prices togeather first. Thank you tons! Nabroski 1 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 2, 2017 Share Posted November 2, 2017 About RenderTargetTexture, you can simply add meshes to their renderlist and place them in the customRenderTargets list of the scene: https://playground.babylonjs.com/#NL9S8A#6 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 2, 2017 Author Share Posted November 2, 2017 Thats pretty cool, now I need to figure out how to take all this information and generate and occlusion map per frame. Once I get that figured out, I want to pass two more textures to the shader to handle the lights where the first one will have the structure on each pxl of red and green for x:y position of the light and blue for its size/radius and alpha for what 2d "layer" its in. Then the second texture to where the pxl structure would be red blue green values of the light, and alpha for the intensity with both pxls indexes being the same on each texture. Then I will iterate through the pxls until all the lights are calculated. I am hoping with this method I can get the lights to render in a single call. I do not know how optimized this will be though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.