fenomas / noa

Experimental voxel game engine.
MIT License
616 stars 91 forks source link

Lights and Shadows #19

Closed Nesh108 closed 7 years ago

Nesh108 commented 7 years ago

Hello!

Is there a way to change the intensity of the lights in the world? I found params for the colors but nothing concerning their intensity.

Also, I found the component/shadow.js which a disc for the player's shadow, how about having some global shadows for all the blocks as well?

I tried adding some of my own lights but I didn't notice any appreciable difference (I was checking the brightness of each block).

fenomas commented 7 years ago

Hi,

There is basically nothing in the engine yet about lighting or shadows. The shadow component just adds and manages a disc below entities, it doesn't have any real interaction with the scene or lights. And the scene gets initialized with a standard Babylon hemispheric light, which the client could remove, or add more, etc.

Basically, I don't know much about it and haven't done any serious thinking about it. Certainly happy to hear from anyone who does :)

Nesh108 commented 7 years ago

So, to access the light component and change/remove it, do I just go straight to noa.rendering._light or is there a proper getter for it?

Anyway, I will look into it and try some stuff with shadows. From my experience with Three.js, shadows seemed to slow down drastically the whole scene quite a lot.

fenomas commented 7 years ago

You could get it that way, or just through Babylon APIs - I think there's a scene.lights or scene._lights array, or some other accessor.

For performance, yes, I assume that just turning on shadows for everything would be very hard on performance, but I don't know any details, or if there are smart ways to do it.

Nesh108 commented 7 years ago

Thanks, I will look into shadows later on. Being able to access the lights is already great :)