Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changing sunlight? #2

Open
helxsz opened this issue Oct 24, 2014 · 0 comments
Open

Add changing sunlight? #2

helxsz opened this issue Oct 24, 2014 · 0 comments

Comments

@helxsz
Copy link

helxsz commented Oct 24, 2014

@Maurizzzio I am now experimenting to add a changing sunlight to the city scene, so it means when it is enabled, the changing sunlight would dynamically change the shadow of the tree and building and car.

so instead of using createSceneLights() in the Application.js, I have added this function to the World.js. and more than that,

    World.lightChangingEnabled = true;
    changeSunLight:function(){
        var light = T3.ObjectManager.get('directional-light-3');
        var angle   = Date.now()/1000 * Math.PI;
        // angle    = Math.PI*2
        light.position.x    = Math.cos(angle*-0.1)*20;
        light.position.y    = 10 + Math.sin(angle*0.5)*6;
        light.position.z    = Math.sin(angle*-0.1)*20; 
    },

    render: function () {
        if(World.lightChangingEnabled)  this.changeSunLight();
        World.renderer.render(scene, T3.World.activeCamera.real);
    }

so far, now it enables the random sunlight, what I am going to do is to simulate the changing sunlight as a sunlight in the day from sunrise to sun down, it is important to make sure the directional light 's position. I am trying to figure out, if you have any further ideas to simulate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant