-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Examples: Remove need for manually assigning Line2 material resolution #28343
Conversation
Nice. This is working for me. I think there are a few more lines that can be edited. Grep for "resolution" in the relevant examples. Perhaps unrelated, there is also a webgpu example. It renders lines with a slightly different width for some reason. /ping @sunag |
There was one straggler - thanks!
I'm not familiar enough with all the WebGPU stuff yet to make changes here |
There are additional comments to remove:
|
Thanks, missed those |
The viewport uniform in the nodes material is automatically updated so there is no need for changes there. Not sure where the width variation comes from though. |
@gkjohnson The line widths are different compared to those in the previous release. At least on my machine. I expect you are off by a factor of |
Oh interesting - I guess |
No, that is not true. |
examples/jsm/lines/LineSegments2.js
Outdated
|
||
if ( this.material.uniforms.resolution ) { | ||
|
||
renderer.getCurrentViewport( _viewport ).multiplyScalar( 1 / renderer.getPixelRatio() ); |
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.
This should be:
renderer.getViewport( _viewport );
Is the line width discrepancy you see in the webgpu version the width in the inset box when in css pixel width mode? If so I have found the issue that creates that difference. |
yes |
Gotcha thanks - just fixed. The naming of |
Oh man even the documentation between the two is identical:
I'm wondering if this should just be changed to a flag to be passed into |
examples/jsm/lines/LineMaterial.js
Outdated
@@ -7,7 +7,7 @@ | |||
* dashSize: <float>, | |||
* dashOffset: <float>, | |||
* gapSize: <float>, | |||
* resolution: <Vector2>, // to be set by renderer | |||
* resolution: <Vector2>, |
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.
This line should be removed.
@Mugen87 How do you feel about removing this entire comment block? Apparently, we no longer use this coding pattern.
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.
I'm fine with that.
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.
I'll fix it. It's time to move on.
Um, does |
With this PR, this.material.uniforms.resolution This fixes it: this.material.uniforms?.resolution Is there a "proper" way of handing this? |
I think the best solution at this is your code The Nodes update the values individually so we don't need a uniform object for each material. I think that soon we would also have to review the implementation of the default material |
We have reverted optional chaining because we want to stick to ECMA 2018 syntax, see #25172. |
FYI: |
Related issue: #28335
Description
Remove the need to manually assign the resolution uniform for rendering Line2. If rendering to multiple resolutions of canvas or render targets then the resolution still needs to be set before performing raycasting.