Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D: angles are not defined consistently #2284

Open
glenrobson opened this issue Feb 21, 2024 · 1 comment
Open

3D: angles are not defined consistently #2284

glenrobson opened this issue Feb 21, 2024 · 1 comment

Comments

@glenrobson
Copy link
Member

Remark by Rita in the European timed 3d TSG call:

Angles are not defined consistently as far as I can see

  • Value for fieldOfView of a perspective camera denotes the full angle
  • Value for angle in the case of SpotLight denotes the half angle

We noted that 3js isn't very clear in what it supports for spotlight:

"angle - Maximum angle of light dispersion from its direction whose upper bound is Math.PI/2."

Math.PI / 2 = 90 degrees so we assume its half the angle but it would be good to test this.

The discussion in the meeting was that it would be useful to have consistency but if we are following the 3JS approach then that is also fine with implementers but would be good to confirm this is the reason for the inconsistency.

@glenrobson glenrobson added the 3d label Feb 21, 2024
@JulieWinchester
Copy link
Contributor

For spotlights in three.js, the angle is indeed the half-angle of the spotlight cone. Here is an example demonstrating a spotlight angle of 90 degrees: https://codepen.io/JellyfishJail/pen/vYPwNvx (copied and only slightly modified from https://codepen.io/boytchev/full/ZEMJEeR). The angle is specified in line 40 and can be changed to interactively see the effect.

With regard to differences between the fieldOfView angle value and the spotlight dispersion angle, it's worth noting that the spotlight angle defines a cone while the field of view doesn't. The FOV is defining a square frustum, and for both the draft spec and three.js specifically the FOV defines the top-to-bottom angle of the frustum planes. Out of curiosity, does anything use half-angles for FOV?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants