Adamkob12 / NovaCraft

17 stars 4 forks source link

Areas that should be dark are brightly lit instead #45

Open aylamz opened 9 months ago

aylamz commented 9 months ago

What you did

Dug a small tunnel

What went wrong

The tunnel should be dark but is brightly lit instead

Additional information

nodark

Adamkob12 commented 9 months ago

That's pretty much intentional 🙃

You're welcome to add a sun, and decrease the brightness of the ambient lighting tho.

I'll accept a PR!

aylamz commented 9 months ago

So I looked into this a bit and I'm a little confused.

It seems there already is a DirectionalLightBundle with Sun component. And a day-night cycle? Except it doesn't work?

// ...
    if timer.0.finished() {
        let t: f32 = 1.0;
        atmosphere.sun_position = Vec3::new(0., t.sin(), t.cos());

        if let Some((mut light_trans, mut directional)) = query.single_mut().into() {
            light_trans.rotation = Quat::from_rotation_x(-t);
            directional.illuminance = t.sin().max(0.0).powf(2.0) * 2000.0;
        }
    }
// ...

atmosphere.sun_position, light_trans.rotation, directional.illuminance are all set based on t, but t never actually changes, so day-night system doesn't work.

Also tried removing AmbientLight and directional light, but it's still not completely dark, there's still some ambient light coming from somewhere...

Adamkob12 commented 9 months ago

Oh yeah there used to be a sun a day-night cycle but I disabled it. I forgot about it. The additional light probably comes from the 3rd party AtmospherePlugin from bevy_atmosphere.