5
$\begingroup$

hope all is well!

I was wondering how I would bake shadows and import the model with these shadows into three js. I would also like to change the material of the model in three js dynamically while retaining the shadows.

Thanks for any help, really appreciate it!

Thanks, Ed.

$\endgroup$
3
$\begingroup$

There are a couple ways of doing baked shadows that you can use with three.js:

An AO map can be embedded in the model in formats like glTF (see https://github.com/KhronosGroup/glTF-Blender-IO), which three.js can load via THREE.GLTFLoader. I'm not aware of a way to export the lightmap as part of your model, so you'd probably need to load it separately via THREE.TextureLoader.

In either case, the material can be modified independently of the AO or lightmap.

Finally, you could also bake the shadows directly into a base color texture, but then you lose the option of modifying the material in three.js.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.