[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Depth Texture Extension

On 2012-01-23, at 2:09 PM, Florian Bösch wrote:

On Mon, Jan 23, 2012 at 7:40 PM, Gregg Tavares (勤) <gman@google.com> wrote:
I believe there are issues trying to emulate this in D3D.
According to this page http://unity3d.com/support/documentation/Components/SL-DepthTextures.html in Direct3D 9 a depth texture has the format R32F.

This page mentions that the formats D16 and D24 would also work: http://aras-p.info/texts/D3D9GPUHacks.html

Unfortunately INTZ and DF16/DF24 don't support cube-maps.

In OpenGL support for them is defined by this extension http://www.opengl.org/registry/specs/ARB/depth_texture.txt supporting the format DEPTH_COMPONENT[16|24|32] (presumably floating point textures).

No - those are integer formats.

I'm also not sure if desktop hardware supports depth cubemaps which OES_depth_texture requires.
(not even sure what a depth cubemap is)
If you're attaching a cubemap side to an FBO, and render something in it, the cubemap depth texture would be the recepient of the depth values for that side.

I'm not sure that OpenGL/Direct3D actually lack the capacity to use a cubeside as a depth texture, other than the comment in the ARB extension there doesn't seem to be anything explicitly making it impossible. Likewise I'm not sure that any mobile actually has the capacity to use a cube side as a depth texture. These capabilities should be tested.

See issue 4 of OES_depth_texture.  It explicitly says that cube-map depth textures are supported.
Interestingly enough, ARB_depth_texture also doesn't support cube depth textures, but I believe they are supported as a core feature now.

There seem to be these two issues:
#1 OpenGL ES specifies depth textures as unsigned int and short, OpenGL/Direct3D specifies them as floats. Correct me if this is a wrong impression.
This is incorrect.  OpenGL/Direct3D also have integer depth textures. It's not until DX10-capable hardware that floating point depth became available.

#2 Support for attaching cube side targets as depth textures is doubtful.

Yet the OES extension requires it.  At a minimum (for ANGLE support at least) it seems like this will have to be removed from the WebGL version.

I don't think that issue #2 should make this extension impossible. How to handle issue #1 (int vs. float) would be of some concern in situations where a user whishes to provide depth values to the texImage2D entry points, otherwise it shouldn't matter that much. 


                        Daniel Koch -+- daniel@transgaming.com
Senior Graphics Architect -+- TransGaming Inc.  -+- www.transgaming.com