-
-
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
SSRPass : fixed MAX_STEP #21384
SSRPass : fixed MAX_STEP #21384
Conversation
/ping @gonnavis |
@ycw Thanks!
should be used instead of
? |
MAX_STEP: Math.sqrt( window.innerWidth * window.innerWidth + window.innerHeight * window.innerHeight ) | ||
}, SSRShader.defines ), | ||
defines: Object.assign( {}, SSRShader.defines, { | ||
MAX_STEP: Math.sqrt( this.width * this.width + this.height + this.height ).toFixed(1) |
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.
Should be multiplication sign here? this.height * this.height
How about doing this instead? for(float i=0.0,l=float(MAX_STEP);i<l;i++){ |
const his = { x : 1 }
const her = { x : 2 }
Object.assign( his, her ) // { x : 2 } ( the 1st par is mutated )
his.x === 2 // true implies btw, i also found one here three.js/examples/jsm/objects/ReflectorForSSRPass.js Lines 111 to 113 in be6a7db
|
@mrdoob I have been keep testing the PR code and there is only a little need to be modified no big problem. I remember that it may because glsl can't use dynamic variable in for loop. But why just crash not throw error, I have no idea~~. |
@gonnavis but |
Yes, and
work too, very surprising. I really remember that can't use variable and even can't use uniform in for loop, this is why I used |
@mrdoob @ycw Turned out that on IOS WebGL1 all these
will cause error Just |
I think that solution is fragile. We're likely to bump into that issue again if we rewrite. I think using @zeux Any insights about the best thing to do here? Is it a bad idea to cast a define right in the for loop? for(float i=0.;i<float(MAX_STEP);i++){ |
Excellent! it works on my iphone6sp WebGL1. |
@mrdoob fwiw outside of WebGL & GLSLES I wouldn't worry about this; in WebGL1/ESSL specifically shaders have extra restrictions to enforce loop termination, see https://www.khronos.org/registry/webgl/specs/latest/1.0/#SUPPORTED_GLSL_CONSTRUCTS:
https://www.khronos.org/registry/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf, Appendix A:
Noteworthy is that |
@zeux Thanks! 🙏 |
Thanks! |
three.js/examples/jsm/shaders/SSRShader.js
Line 166 in be6a7db
SSRShader.defines
's one by correct value in correct order.