Hello Everyone!
Note: I’m new to using three.js so I’m not very good with thing like Lighting, Camera, Renderer
So, I’ve made a model and have imported to the scene, and I’ve also wanted to have a constant lighting all around the object, so I’ve tried AmbientLight() and it worked to some extent. But as soon as the camera move far out the object, there’s an area that’s darker. Is there any way to make the light always constant even if the camera move far out?
I would suggest to change strategy and modify your materials instead
This way you don’t need any lights. It prevent issues coming from over-lighting (> 1.0 intensity) and frustrum/shadows at far distance.
Try dropping the model in here, opening the editor in the sidebar, and then running the script below. It should become MeshBasicMaterial automatically when loaded, after that.
import { MaterialsUnlit } from '@gltf-transform/extensions';
const unlitExtension = document.createExtension(MaterialsUnlit);
const unlit = unlitExtension.createUnlit();
for (const material of document.getRoot().listMaterials()) {
material.setExtension('KHR_materials_unlit', unlit);
}
I guess after that, I just have to press export. Although the exported file is way smaller than the original one, and it said that there’s no Drago decoder loaded.
Yes, I’d run that script — and nothing else — and then just export the file.
If you want to run the of the original script, too, to reduce filesize that’s OK, but you’d need to do additional steps to install the Draco loader (see three.js docs).
Run the script you provided only, save the draft, export the glb file and it loaded into the scene with no need of light, altho the weird color on the far region is still here.
Sorry, what I mean is that I can’t tell you why that is happening just by looking at the image. You’ll probably need to share a demo or the model. Comparing whether the model looks the same way in online glTF viewers may also be helpful, to see if there’s an issue in your code or in the model.