-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
TSL Node: cameraWorldQuaternion #30986
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
TSL Node: cameraWorldQuaternion #30986
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
three.js is quaternion-based. I would advise sticking to quaternions. Get the world quaternion, instead. The world rotation was removed from the library years ago. |
Done |
|
It may be too early to implement quaternions and eulers relating to objects, matrices normally do the job and are more performant. Try using the example below: import { mat3, texture, cameraWorldMatrix, positionView, equirectUV } ...
//
const viewUV = mat3( cameraWorldMatrix ).mul( positionView.normalize() );
material.colorNode = texture( texture, equirectUV( viewUV ) ); |
|
Closing for now. |
This pull request adds a
cameraWorldQuaternionTSL node.This node is helpful for when one needs to access the current camera's rotation relative to the world as a TSL node. For example, when creating a skybox material.
JSFiddle isn't saving the updates to the example, I'll update this when I get a new JSFiddle link.
See the bottom of this post for the original PR description (with original JSFiddle link).
Original PR description (before updating it to only use a quaternion)
Here is an example of a skybox material using a
cameraWorldRotationTSL node: https://jsfiddle.net/9b56L412Related forum discussion: https://discourse.threejs.org/t/need-help-writing-a-true-skybox-tsl-shader-node/74406
This pull request is based on lines 69-74 in that JSFiddle: