-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
SpriteNodeMaterial: Add sizeAttenuation #29394
base: dev
Are you sure you want to change the base?
SpriteNodeMaterial: Add sizeAttenuation #29394
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Could someone test the example |
Can you please test with a single sprite and confirm disabling size attenuation works as you expect it to? I tried to help, but the PR is not working for me in its current form. |
@@ -317,6 +317,12 @@ export default class RenderObject { | |||
|
|||
} | |||
|
|||
if ( object.center ) { | |||
|
|||
cacheKey += object.center.x + ',' + object.center.y + ','; |
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.
uniform values should not generate cache key.
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.
Unfortunately center is not a uniform value.
In that case we probably want to deprecate that property and move it to the SpriteNodeMaterial as SpriteNodeMaterial.centerNode?
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.
It seems to be uniform in both renderers, but I think you may have a problem related to the uniform reference. Maybe if you replace uniform()
with reference( 'center', 'vec2' )
can it work in your tests?
alignedPosition = alignedPosition.sub( uniform( object.center ).sub( 0.5 ) ); |
setupPosition( { object, context } ) { | ||
setupPosition( { object, camera, context } ) { | ||
|
||
const useSizeAttenuation = this.sizeAttenuation; |
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.
const sizeAttenuation = this.sizeAttenuation;
Related issue: #29269 #29374
Description
Following #29374, I will spread the features and fixes among multiple PRs instead. This fixes #29269.
This contribution is funded by Segments.AI & Utsubo