jscastro76 / threebox

A Three.js plugin for Mapbox GL JS, with support for animations and advanced 3D rendering.
Other
549 stars 145 forks source link

why my pointlight has no effect on my model #378

Closed gisonjourney closed 1 year ago

gisonjourney commented 1 year ago

I used peterliu's version,pointlight could effect on model like this 1

but when i use your version,this could not effected,like this

image

what shoud i do to get pointlight effection

jscastro76 commented 1 year ago

Hi @gisonjourney! This fork has +2 years of development on top of the fantastic work by Peter, so 90% of the code has changed to enable new features such as sun light illumination. Concretely about light sources are now defined in Threebox.js

    defaultLights: function () {

        this.lights.ambientLight = new THREE.AmbientLight(new THREE.Color('hsl(0, 0%, 100%)'), 0.75);
        this.scene.add(this.lights.ambientLight);

        this.lights.dirLightBack = new THREE.DirectionalLight(new THREE.Color('hsl(0, 0%, 100%)'), 0.25);
        this.lights.dirLightBack.position.set(30, 100, 100);
        this.scene.add(this.lights.dirLightBack);

        this.lights.dirLight  = new THREE.DirectionalLight(new THREE.Color('hsl(0, 0%, 100%)'), 0.25);
        this.lights.dirLight.position.set(-30, 100, -100);
        this.scene.add(this.lights.dirLight);

    },

Are you assigning the lights to these as defined in the documentation? otherwise it won't obviously work as expected.

gisonjourney commented 1 year ago

Thank you very much, it's very useful.

image