Moguri/panda3d-gltf

Lights are imported with the default 1 meter near clip plane

Opened this issue · 5 comments

... which is expected, I suppose, but this should probably be called out in documentation or something, since things closer than one meter then often end up rendering strangely.

Light clip near/far is not something that glTF specifies (as far as I know), but we could expose some settings to allow the user to control the near and far values used when creating a light. We could also default these to something other than their current defaults if there are more sensible values. For example, we could add a light_clip_near that defaults to 0.1.

... A light on a wall can easily be as close as 1cm.
Although I'm unsure how likely a setup would be in practice, given that last I knew there wasn't an in-engine way to bake lights.

rdb commented

The near distance doesn't affect how close to a wall a light can be. It just affects how close an object can be to a light source and still cast shadows.

Placing the near plane too close will dramatically impact depth buffer precision and therefore shadow mapping quality.

.... Like the shadows any lamp shade might cast?

rdb commented

Those aren't likely to be within 1cm of the light source. For lights with such close casters, it would be necessary to tweak the near clip so that it's just barely within anything that might need to cast shadows.

Generally, I would say that it's better to handle lamp shades via an IES profile (which also allows them to be partially translucent). But those are not currently supported / require a custom shader.