dsman Posted October 14, 2017 Share Posted October 14, 2017 Unity has this. Good if Babylon can have it. Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 14, 2017 Share Posted October 14, 2017 In short: It's not easy and maybe not practical. You can bake lightmaps in Blender or other 3d editor. I tried and experimented with lightmaps, even contributed some lightmap function to combine baked lightmaps and dynamic lights/shadows.https://www.bitofgold.com/lightmaptest/ But after researching a while I realized that I cannot make lightmap baking fast enough in browser. I tried to render depth maps from every light source and calculating every lightmap texel for every light in 3d - but I can only do this on CPU. It would take several hours on a fast machine. (for just a plane!) And there is a mapping problem, easy to do on a plane but if you have a complex scene with many static objects, just optimally placing lightmap UV -s can be a really intensive probem. So someone has to invent something to do this with shaders. It's too much for me so I decided to abadon it. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 14, 2017 Share Posted October 14, 2017 One other thing comes to my mind but it is the same problem as the cascading shadows. If there would be more shadow generators per light(one for static objects, updated only when light changes (baked!), one smaller high detail map for dynamic objects, updated every frame) and, there would be an adding or a smooth transition between maps... that would solve shadowing without lightmaps. Maybe in the future Quote Link to comment Share on other sites More sharing options...
dsman Posted October 16, 2017 Author Share Posted October 16, 2017 Consider me naive here but I am not sure why it would be so processing intensive. Because we aren't talking about ray tracing or multiple light bounce here. Babylon can comfortably render lights + shadow in real time at multiple fps. So instead of rendering to screen, we have to render light to a texture based on UVs of given mesh (the algorithm used to render bake maps), right ? Archilogic has developed such baking (Now 3d.io , look at their App Creator service). They are using Threejs. And I don't think it takes hours for them too. Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 16, 2017 Share Posted October 16, 2017 If you do it with babylon vectors and ray tracing in javascript, it is intensive. Lightmap and AO map, I think it involves ray tracing, distance fields and multiple light bounces. But, maybe not. I did not say it is not possible in webgl... Just that I gave up. But even playcanvas has lightmap baking, if someone understands it, it is surely possible in Babylon:https://github.com/playcanvas/engine/blob/master/src/scene/lightmapper.js Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 16, 2017 Share Posted October 16, 2017 I understand some part of it (not all) the recipe is: - for each light, from the light's viewpoint (with a camera!) render theese maps: - UV and normal direction map - depth map and combine theese into a RGBM (rgb with magnitude) maps. and then some processing of theese maps into textures. Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 16, 2017 Share Posted October 16, 2017 The most intreresting part of it is where they render the UV-light direction map:https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/fullscreenQuad.vert They just need to know at each lightmap texel, where it is in the direction of the light? So, it renders XYZ position in UV space. I've got now an itch do start again... Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted October 16, 2017 Share Posted October 16, 2017 BabylonJS Toolkit 3.1 Alpha... Coming Soon... Looking for partners to help finish up the details and get released... FYI... Check out this screen shot with shadows... I am asking for support of ambient occlusion WITH light map support: Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted November 3, 2017 Share Posted November 3, 2017 Toolkit Ready GameMonetize and HeadClot 2 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.