mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.74k stars 35.38k forks source link

Why pointlight cant cast shadow ? #1192

Closed jeromeetienne closed 12 years ago

jeromeetienne commented 12 years ago

Im writing a blog post on casting shadow and would like some info on the current state of the lib. i would like to experiment and ask questions here, thus i can explain to people more efficiently. So here is the first

From my understanding pointlight cant cast shadow at the moment https://github.com/mrdoob/three.js/blob/master/src/lights/PointLight.js

WestLangley commented 12 years ago

Here is part of your answer: #1173 .

jeromeetienne commented 12 years ago

@WestLangley from my understanding, it means "SpotLight is just PointLight that casts shadow in a single direction."

ok ... not sure i understand what it implies for point light casting shadow ?

WestLangley commented 12 years ago

@jeromeetienne, good point. I have no idea what I was thinking...

zz85 commented 12 years ago

a spotlight is a special kind of light with a field of vision (like a camera).

i suppose, it light objects within its fov, and at the same time cast shadows on those objects.

right now, the spotlight does cast shadows, but its light objects around like a pointlight, which kinds of explains "SpotLight is just PointLight that casts shadow in a single direction."

so while it might be possible that pointlights can cast shadows, someone would need to implement them. because a pointlight is omnidirectional, cast shadows in all directions, the current shadowmapping implementation might not work.

perhaps, using "dual paraboloid mapping" or something like http://http.developer.nvidia.com/GPUGems/gpugems_ch12.html

alteredq commented 12 years ago

Yup, as @zz85 said, point light shadows are more complex to implement (and more expensive to run) as these lights shine in all directions.

Our SpotLight is a point light with just one sixth of the shadow.

jeromeetienne commented 12 years ago

excelent thanks all for the info