question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gl.compile doesn't work for off screen objects

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Oct 23, 2021

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.

1reaction
Mugen87commented, Oct 23, 2021

I guess in this case it does matter what objects are in frustum?

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 to false, render the scene and then restore the frustumCulled property.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found