gl.compile doesn't work for off screen objects
See original GitHub issueDescribe the bug
i try to compile materials in order to avoid first scroll lag, but it appears like gl.compile does practically nothing. it does not pick up on objects that are not in the frustum.
on threes discord i was told i should render out a single frame with a cubecamera, and that indeed works: https://github.com/pmndrs/drei/commit/6cee0bb9b2cb2f804f17599a41d67e00c9c19102 but compile should pick up on all materials in the scene, i don’t think it’s supposed to skip objects.
To Reproduce
https://codesandbox.io/s/scrollcontrols-demo-website-forked-zf1dj?file=/src/App.js:1066-1517
You can execute compile()
in the console, it calls gl.compile and it will do nothing. or call cube()
, and you will see a big execution stack in the perf readout.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
OpenGL shaders compile but no rendering appears in the ...
Both the vertex and fragment shader seem to be compiling and the window appears and is given the clear color but I cannot...
Read more >Common Mistakes - OpenGL Wiki - Khronos Group
OpenGL functions do not work unless an OpenGL Context has been created and is active within that thread. Thus, glGenTextures will not work ......
Read more >WebGL best practices - Web APIs - MDN Web Docs - Mozilla
WebGL is a complicated API, and it's often not obvious what the recommended ways to use it are. This page tackles recommendations across...
Read more >Debugging - LearnOpenGL
Debugging in OpenGL is not too difficult to do and getting a grasp of its techniques ... The way debug output works is...
Read more >Asynchronous shader compilation - Unity - Manual
DrawProcedural , the Editor doesn't use a placeholder shader. ... To force synchronous compilation for a Shader object, add the #pragma ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In any event, we should not make the assumption what resources the user wants to upload or compile ahead of time. This is highly app specific.
The engine already provides the necessary utilities. After some considerations, I think it’s better to not add the suggested method from https://github.com/mrdoob/three.js/issues/22696#issuecomment-944909439. It could be easily misused on app level producing too large lags.
You are right. If you want to honor all 3D objects in your scene, it is necessary to traverse through the scene graph, set
frustumCulled
for all 3D objects tofalse
, render the scene and then restore thefrustumCulled
property.