owl-project / NVISII

Apache License 2.0
327 stars 28 forks source link

Directional Light Source #124

Open jonathangranskog opened 3 years ago

jonathangranskog commented 3 years ago

Hey,

Would it be possible to support a directional light source? I'm working on a research project and would love to use ViSII. If there is one already, please let me know. I didn't find one when looking at least.

Thanks, Jonathan

natevm commented 3 years ago

I’m not opposed to the idea (many scene formats include directional lights)

The issue I have with directional lights is that I’m not sure what an API for directional lights would look like. We don’t really support analytical lights, as it’s confusing to end users why there might be two different ways to make eg a quad light. Instead, we only support mesh lights, since that’s more clean and intuitive.

Creating an entity with a light and transform but no mesh currently assumes the light is a hard point light. That seemed to be intuitive enough.

Do you have any ideas on how a directional light API would work? I’m still on the hunt for a more intuitive solution.

natevm commented 3 years ago

The only reasonable thing I can think of at the moment is to allow light components to optionally be “directional”, where the direction points along the forward direction of the connected transform component. (Can be easily controlled using the transform.look_at function).

For now, we can just make the directional modifier only effect point lights, cast hard shadows, and not be effected by falloff.

jonathangranskog commented 3 years ago

Yeah, I think a directional modifier on point lights would be fine. I don't need anything advanced. :)