I was wondering if there is a way in THREE Js to get very performant soft shadows for indoor scenes without the need to bake them to texture with a 3D render software.
As I see it SSAO works pretty good in THREE Js to achieve the result I’m after, but needs to calculate every frame. My scenes are static (no animation or repositioning of objects) but the SSAO seems to be dynamic. Not sure if this can be made static as well while the user navigates through the scene.
Another option would be baking the SSAO to texture once when the scene is loaded. But not sure how to achieve this and is dynamic UV unwrap possible to bake the data?
I want the soft shadows to run super smooth on mobile devices for indoor scenes with approximately 20000 tris. Some meshes are textured. So when using a baking technique the effect needs to multiply the existing texture.
If there are better ways in THREE to achieve the result I’m after, please share.
everything i tried is expensive and riddled with limitations, but for smaller models it could work. since your scenes are static i don’t see why you not want to bake them, that is the only truly performant choice and will look better than anything that’s calculated runtime. if you still want to try, here are a few methods you can experiment with, they’re react but the shaders are plain three universal:
they are just shaders. you find both in the official three examples, though you have to untangle them from the example code they’re wired into, they’re not readily usable ootb.
the other one, the lightmap, that’s more complex and needs lots of things functioning around it, it is best abstracted into a component. but i find it pretty much unusable, it has countless of issues depending on your models, uvs and so on.
if you want soft shadow, use a light array with a diameter, obvious … the very attribute of the Sun making soft shadows…the very thing that proves the staged Apollo landing pics - shadows too tight.
If Three does NOT do it, I’d look at POVray code and implement in next release. There ought to be like 3 levels.
I wonder if it could be possible to modify this code, only for static scene, to save the result of this lighting and shadow and be able to reaload it after ?
It could be very interesting for static scene to calculate something like GI and save it (as lighting texture or something equivalent)…
Hello I am also interested in achieving the same effect. The user will upload a gltf model and Id like to add a shadow under the model. The scene is static so the shadow only needs to be calculated once. I want to avoid calculations happening on each frame. Right now I am looking into the threejs progressive lightmap example to try and understand how i can use it for baking the shadow only once, and I came across this post.
I thought it might be helpful to poke you guys again and ask for your current opinion on the matter. Whats the best method to achieve this ? Thank you
it’s not so easy, it wouldn’t work with most models due to missing uvs (i’ve tried). basically the same effort is required as with baking (uv-unwrap), and if you spend 6 hours to unwrap a model then straight up baking isn’t that much more effort.
i’ve created a runtime version of it that accumulates shadows, only for ground shadows though, but it looks fantastic and is perfect for viewer-type applications. it can accumulate shadows frame by frame instead of freezing until completion.
there is also a new pcss implementation by @N8Three which needs fewer samples, with just 6 samples is creates results that look similar to the old impl with 24+ samples. and it’s finally side-effect free, it can be toggled on/off. paired with a performance monitor it can always fallback to normal shadows if the device is too weak.