mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-24 22:59:24 +00:00
Reverse depth & 32F buffer format
-Adds reversed depth projection model, dramatically increasing depth buffer effective resolution. -Adds 32F depth 8U stencil format GFXFormatD32FS8X24 (following DX naming conventions). Note this is a 64-bit format, and likely not suitable for mobile platforms. Revert to GFXFormatD24S8 in renderManager.tscript for mobile & "ancient" platforms. -Corrects alignment of texture type details array.
This commit is contained in:
parent
c08fa359d2
commit
75625dc679
37 changed files with 91 additions and 57 deletions
|
|
@ -35,7 +35,7 @@ function initRenderManager()
|
|||
|
||||
//When hdr is enabled this will be changed to the appropriate format
|
||||
format = "GFXFormatR16G16B16A16F";
|
||||
depthFormat = "GFXFormatD24S8";
|
||||
depthFormat = "GFXFormatD32FS8X24"; // 64-bit depth format. Old 32-bit format was "GFXFormatD24S8"
|
||||
aaLevel = 0; // -1 = match backbuffer
|
||||
|
||||
// The contents of the back buffer before this format token is executed
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ ConnectData main( CloudVert IN )
|
|||
ConnectData OUT;
|
||||
|
||||
OUT.hpos = mul(modelview, float4(IN.pos,1.0));
|
||||
OUT.hpos.z = OUT.hpos.w;
|
||||
OUT.hpos.z = 0.0f; // OUT.hpos.w; // reverse depth -- put cloud layer in the far dist and let render order hints sort it out?
|
||||
float2 uv = IN.uv0;
|
||||
uv += texOffset;
|
||||
uv *= texScale;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ ConnectData main( CloudVert IN )
|
|||
ConnectData OUT;
|
||||
|
||||
OUT.hpos = mul(modelview, float4(IN.pos,1.0));
|
||||
OUT.hpos.z = OUT.hpos.w;
|
||||
OUT.hpos.z = 0.0f; //OUT.hpos.w; // for reversed depth
|
||||
// Offset the uv so we don't have a seam directly over our head.
|
||||
float2 uv = IN.uv0 + float2( 0.5, 0.5 );
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ out vec2 texCoord;
|
|||
void main()
|
||||
{
|
||||
gl_Position = tMul(modelview, IN_pos);
|
||||
gl_Position.z = gl_Position.w;
|
||||
gl_Position.z = 0.0; // gl_Position.w; // reverse depth -- put cloud layer in the far dist and let render order hints sort it out?
|
||||
|
||||
vec2 uv = IN_uv0;
|
||||
uv += texOffset;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void main()
|
|||
vec2 IN_uv0 = vTexCoord0.st;
|
||||
|
||||
gl_Position = modelview * IN_pos;
|
||||
gl_Position.z = gl_Position.w;
|
||||
gl_Position.z = 0.0;//gl_Position.w; // reversed depth -- put clouds in the far distance (0) with other sky-type objects
|
||||
|
||||
// Offset the uv so we don't have a seam directly over our head.
|
||||
vec2 uv = IN_uv0 + vec2( 0.5, 0.5 );
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ void main()
|
|||
// }
|
||||
|
||||
// Save world space camera dist/depth of the outgoing pixel
|
||||
OUT_rippleTexCoord2.z = OUT_hpos.z;
|
||||
OUT_rippleTexCoord2.z = OUT_hpos.w; // for reversed depth
|
||||
|
||||
// Convert to reflection texture space
|
||||
OUT_posPostWave = tMul( texGen, OUT_posPostWave );
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ ConnectData main( VertData IN )
|
|||
// }
|
||||
|
||||
// Save world space camera dist/depth of the outgoing pixel
|
||||
OUT.rippleTexCoord2.z = OUT.hpos.z;
|
||||
OUT.rippleTexCoord2.z = OUT.hpos.w; // use the world-coordinate version of depth, this will work with either projection model
|
||||
|
||||
// Convert to reflection texture space
|
||||
OUT.posPostWave = mul( texGen, OUT.posPostWave );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue