-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
Depthtextures should not need to be explicitly constructed #18860
Comments
It was implemented like this on purpose since the respective depth texture extension is not supported by all devices. The default of generating depth textures is still RGBA depth packing. |
wait, so a Three DepthTexture is not meant for use as a framebuffer depth attachment? |
opinion- my difficulty figuring out how to use three's render targets has far exceeded the amount of effort of using raw webgl framebuffers |
Yes, you use Hence, the mentioned RGBA depth packing is more reliable although this approach requires a separate render pass. Which is not always necessary e.g. when rendering a DoF effect. With Because of this circumstance, the depth texture configuration has to be done by the developer. |
Is it against Three's standard to alter its behavior based on available extensions? Would an auto-configuring depth setup be candidate for three's 'examples'? |
I don't think there is "defined standard" but other features like WebGL 2 are also not automatically enabled. In this case, devs have to create the WebGL 2 rendering context by themselves and pass it into the renderer. |
I see. A higher level library would handle this all automatically, but that would require pipeline modifications and hidden behavior, which don't fit with three's mid-level role. But I would still like to see a syntax improvement here, since having to mutate a field for an object I just constructed, instead of the initial constructor doing so, feels unwieldy. And I would have never figured out how to do this if not for the depth texture example code. I suggest this be done using an opt for the render target constructor, to avoid mutation. |
The problem is that you might still want to configure the depth texture, for example its type. In Let's see how others evaluate your suggestion. |
Is that not inconsistent with how the color buffer is configured? |
Yes, |
Depthtextures explicitly require construction and assignment
three.js/examples/webgl_depth_texture.html
Line 117 in b11f897
It would make sense only if #15440 were on master, however attempting to assign a depthtexture to multiple rendertargets instead results in silent undefined behavior.
The text was updated successfully, but these errors were encountered: