Moguri / panda3d-gltf

glTF utilities for Panda3D
BSD 3-Clause "New" or "Revised" License
82 stars 19 forks source link

Lights are imported with the default 1 meter near clip plane #90

Open Clockwork-Muse opened 3 years ago

Clockwork-Muse commented 3 years ago

... 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.

Moguri commented 1 year ago

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.

Clockwork-Muse commented 1 year ago

... 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 1 year ago

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.

Clockwork-Muse commented 1 year ago

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

rdb commented 1 year ago

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.