fourcc INTZ, RAWZ Game develop

GPU Programming Guide GeForce 8 and 9 Series

6.4.2. Direct DepthBuffer Access (“INTZ” and “RAWZ”)
Supported GPUs: GeForce 6 Series and later (INTZ requires 8 Series) There are two fourcc codes that allow direct depth buffer access. The first “RAWZ” gives a 4 component value that represents the raw data stored in the depth buffer. The second “INTZ” returns a simple depth value representing the depth that is stored in the depth buffer. INTZ is the recommended code to use, but it is only supported on GeForce 8 Series GPUs and later.
You can use direct access to the depth buffer to enable effects (such as custom shadow mapping) without having to render depth to a color buffer. By performing a Z only render you can make use of the double speed Z rendering and still get direct access to the rendered depth. Usage
"No z-compare" z-buffers are exposed as a separate FOURCC format ('RAWZ' on NV4x and 'INTZ' on G8x).
To create a RAWZ z-buffer, just do:
1. On GeForce 6/7 series use: (D3DFORMAT)MAKEFOURCC('R','A','W','Z')
2. On GeForce 8 series use: (D3DFORMAT)MAKEFOURCC('I','N','T','Z')
Then use it just as if it was a normal z-buffer (render to it, etc). Reconstructing Z for RAWZ (GeForce 6/7 Series GPUs)
REMINDER: Since the GeForce 8 Series and later GPUs can read depth buffers directly, there's no need for the 'RAWZ' format. Thus, this mode is exposed as FOURCC of 'INTZ' on G8x. When reading it in the shader, no reconstruction is necessary - z value is replicated to all four components of a texture fetch.
If you are using RAWZ due to running on a GeForce 6/7 Series GPU then in the shader you reconstruct the z-value as follows:
float z = dot(tex2D(RawZSampler, tcoord).arg, float3(0.996093809371817670572857294849, 0.0038909914428586627756752238080039,
Unfortunately, the result provided by this simple approximation is not always accurate enough. In fact, due to rounding errors, it can be as bad as being accurate to only 8 bits. Better accuracy (at the cost of more instructions) can be obtained by dropping any extra rounding errors as follows:
float3 rawval = floor( 255.0 * tex2D(RawZSampler, tcoord).arg + 0.5);
float z = dot( rawval, float3(0.996093809371817670572857294849, 0.0038909914428586627756752238080039, 1.5199185323666651467481343000015e-5) / 255.0);

Advanced DX9 Capabilities for ATI Radeon Cards

Depth Texture Format: INTZ
Description: An additional texture format called INTZ is exposed that allows a 24-bit depth buffer previously used for rendering to be bound as a texture. Any fetches from this texture will return the depth values stored. Shadow mapping applications relying on Percentage-Closer Filtering should prefer the use of DX9 Depth Stencil Textures instead. INTZ additionally exposes an 8-bit stencil buffer when used for depth buffering, allowing stencil operation to be carried out when an INTZ surface is bound as the active depth stencil buffer. However the contents of the stencil buffer will not be available as texture data when binding the surface as a texture.
Note that an INTZ depth buffer may be used as a texture concurrently to the same INTZ surface being used for depth buffering, as long as depth writes are disabled.
Supported hardware: ATI Radeon 4000 series and above.
Implementation details
A FourCC depth texture format is exposed:
• To check support for this feature:
// Determine if INTZ is supported
hr =pd3d->CheckDeviceFormat(AdapterOrdinal, DeviceType, AdapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_INTZ);
BOOL bINTZDepthStencilTexturesSupported = (hr == D3D_OK);
• To create an INTZ depth stencil texture:
// Create an INTZ depth stencil texture
IDirect3DTexture9 *pINTZDST;
pd3dDevice->CreateTexture(dwWidth, dwHeight, 1, D3DUSAGE_DEPTHSTENCIL, FOURCC_INTZ, D3DPOOL_DEFAULT, &pINTZDST, NULL);
• To bind the depth stencil texture as an active depth buffer:
// Retrieve depth buffer surface from texture interface
IDirect3DSurface9 *pINTZDSTSurface;
pINTZDST->GetSurfaceLevel(0, &pINTZDSTSurface);
// Bind depth buffer
Note that calling GetSurfaceLevel() increases the reference count of pINTZDST so you will need to Release() it when no longer needed.
• To bind an INTZ depth buffer texture as a texture:
// Bind depth buffer texture
pd3dDevice->SetTexture(0, pINTZDST);


  • gigaboy의 메모장 : 하드웨어 깊이맵 2011-07-01 19:12:56 #

    ... INTZ, RAWZ를 이용해서 하드웨어적으로 깊이맵을 만들어 사용해서 깊이맵 렌더 타겟 하나를 줄일 수 있다. 많이 보던 블로그다. ... more


  • mi 2010/11/17 22:07 # 삭제 답글

  • 오즈라엘 2010/11/19 11:01 #

    god bless you !!!!!!!!!!
  • 냥냥양 2010/12/02 15:31 # 삭제 답글

    이거 잘되던가요?
  • 오즈라엘 2010/12/03 00:48 #

    아직 못해봤습니다 :-) 다른 할 것들이 많아서리... 적용하게되면 올려놓겠습니다(언제가 될런지 ㅎ)
  • 냥냥양 2010/12/05 10:05 # 삭제 답글

    잘되네요. deferred는 역시 mrt줄이는거 말고는 답이 없네요..훌륭하게 퍼포먼스가 좋아졌네요..다만 7000시리즈는 걍 forward로 긁어야 될듯하네요..
  • 오즈라엘 2010/12/05 22:57 #

    오오 잘 되시나요? 부럽슴당 ㅎ
    INT는 스텐실 지원 된다 되어 있고, RAWZ도 스텐실 지원이 되는 지를 모르겠네요.
    INTZ, RAW 자체의 성능은 어떤가요? 저희는 Gbuffer 뎁스를 리니어로 저장하고 스텐실도 적극 사용하고 있어서 최후의 보루정도로 생각하고 있습니다 -ㅈ-;
  • 냥냥양 2010/12/11 14:03 # 삭제 답글

    RAWZ를 써야할 형편이라면 그냥 deferred를 포기할수준인거 같아요..그쪽은 포워드로 ㄱㄱ싱하시는게
  • 오즈라엘 2010/12/13 11:01 #

    테라처럼 대책없이 디퓨즈만 발라버리는 것도 쿨해뵈더군요 -
  • 냥냥양 2010/12/14 11:00 # 삭제

    먼가 너무 대책없어 보이기도 하네요 ㅋㅋ. 걍 vertex에서라도 하지 넘하다
  • 오즈라엘 2011/12/02 10:29 #

    INTZ 자알~ 되네요. 이거 쓰면 딱 지버퍼 하나 줄고 따ㅏㄱ 그만큼의 성능 나오네요 ㅎ
  • 1층팀j모씨 2011/11/30 20:44 # 삭제 답글

    잘보고 갑니다!
  • 오즈라엘 2011/12/02 10:29 #

    ㅎㅎ 감사합니다
댓글 입력 영역