-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add support for Cube Map Rotation and expose Skybox Rotation #2527
Conversation
…o all cubemap related shader chunks It is very likely that this will cause some custom shader chunks to break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a user, I think it's confusing that setting an identity rotation matrix results in a mirror transform. I'd much rather keep the -1x always and optionally multiply in the rotation matrix.
Also, is it possible to have this rotation logic (the -1x and optional rotation matrix) encapsulated into single chunk/function? This way we can modify/customise easily in future.
Alternatively you could apply the -1x to the matrix when it's being set on the shader. |
I will move the rotation logic into a function and put it in a new chunk. For the -1x flip, maybe the best way for users is to expose an extra boolean flag which defaults to true to determine is the -1x should be applied to the rotation - and maybe switch back to Quat from Mat3 for the rotation property? |
yep I agree with this. Ideally we don't convert quat->matrix each frame, so it would need to store additional Mat3 as well? |
isRenderTarget flag added to pc.Texture skyboxRotation is now pc.Quat again, but with a private pc.Mat3 that only gets updated when needed.
Will this fully address #189? |
I restored it to multi-line |
…v-map-rotate # Conflicts: # src/graphics/program-lib/chunks/reflectionPrefilteredCube.frag
…made naming in skybox and standard material more consistent
PR name is misleading - this is not cubemap rotation, but skybox rotation. Is it possible to rotate cubemap that is applied on material directly? |
@Maksims - You are right, this PR now only exposes skybox rotation, even though the shader code does support any cubemap to be rotated. A subsequent PR will also expose non-skybox cube map rotation - and we are discussing the best place to store the rotation. I'll adjust the name of this PR. |
Fixes #2505
Public API additions:
Example:
I confirm I have signed the Contributor License Agreement.