- Timestamp:
- 07/04/08 00:51:25 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2811 r2813 89 89 90 90 static int winWidth = 1024; 91 static int winHeight = 1024;91 static int winHeight = 768; 92 92 static float winAspectRatio = 1.0f; 93 93 … … 98 98 99 99 // rendertexture 100 const static int texWidth = 1024; 101 const static int texHeight = 1024; 100 //const static int texWidth = 1024; 101 //const static int texHeight = 768; 102 const static int texWidth = 2048; 103 const static int texHeight = 2048; 102 104 103 105 int renderedObjects = 0; … … 505 507 glGenRenderbuffersEXT(1, &colorsBuffer); 506 508 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorsBuffer); 507 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA 16F_ARB, texWidth, texHeight);509 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 508 510 509 511 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, colorsBuffer); … … 512 514 glBindTexture(GL_TEXTURE_2D, colorsTex); 513 515 514 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA 16F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL);516 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL); 515 517 glGenerateMipmapEXT(GL_TEXTURE_2D); 516 518 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, colorsTex, 0); … … 525 527 glGenRenderbuffersEXT(1, &positionsBuffer); 526 528 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, positionsBuffer); 527 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA 16F_ARB, texWidth, texHeight);528 //glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_RGBA 16F_ARB, texWidth, texHeight);529 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 530 //glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_RGBA32F_ARB, texWidth, texHeight); 529 531 530 532 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_RENDERBUFFER_EXT, positionsBuffer); … … 532 534 glGenTextures(1, &positionsTex); 533 535 glBindTexture(GL_TEXTURE_2D, positionsTex); 534 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA 16F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL);536 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL); 535 537 glGenerateMipmapEXT(GL_TEXTURE_2D); 536 538 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, positionsTex, 0); … … 550 552 glGenRenderbuffersEXT(1, &normalsBuffer); 551 553 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, normalsBuffer); 552 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA 16F_ARB, texWidth, texHeight);554 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 553 555 554 556 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_RENDERBUFFER_EXT, normalsBuffer); … … 556 558 glGenTextures(1, &normalsTex); 557 559 glBindTexture(GL_TEXTURE_2D, normalsTex); 558 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA 16F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL);560 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL); 559 561 glGenerateMipmapEXT(GL_TEXTURE_2D); 560 562 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_TEXTURE_2D, normalsTex, 0); … … 591 593 // create color buffer 592 594 glGenRenderbuffersEXT(1, &occlusionbuffer); 593 //glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA 16F_ARB, texWidth, texHeight);595 //glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 594 596 glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_FLOAT_RGBA_NV, texWidth2, texHeight2); 595 597 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, occlusionbuffer); … … 598 600 glGenTextures(1, &occlusionTex); 599 601 glBindTexture(GL_TEXTURE_2D, occlusionTex); 600 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA 16F_ARB, texWidth2, texHeight2, 0, GL_RGBA, GL_FLOAT, NULL);602 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, texWidth2, texHeight2, 0, GL_RGBA, GL_FLOAT, NULL); 601 603 glGenerateMipmapEXT(GL_TEXTURE_2D); 602 604 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, colorTex, 0); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2812 r2813 67 67 68 68 //const float areaSize = 4.0f; 69 const float areaSize = 4e-3f; 70 const float sampleIntensity = 0.1f; 69 const float areaSize = 5e-1f; 70 //const float areaSize = 1e-4f; 71 const float sampleIntensity = 0.2f; 71 72 72 73 for (int i = 0; i < SAMPLES; i ++) { … … 76 77 float3 noise = tex2D(noiseTexture, IN.texCoord.xy).xyz * 2.0f - 1.0f; 77 78 78 //float2 offsetTransformed = offset;79 float2 offsetTransformed;80 offsetTransformed.x = noise.r*offset.x - noise.g*offset.y;81 offsetTransformed.y = noise.g*offset.x + noise.r*offset.y;79 float2 offsetTransformed = offset; 80 //float2 offsetTransformed; 81 //offsetTransformed.x = noise.r*offset.x - noise.g*offset.y; 82 //offsetTransformed.y = noise.g*offset.x + noise.r*offset.y; 82 83 83 float2 texcoord = IN.texCoord.xy + offsetTransformed * areaSize;// * (1.0f - centerPositionW.w); 84 // weight with projected coordinate to reach similar kernel size for near and far 85 float2 texcoord = IN.texCoord.xy + offsetTransformed * areaSize * centerPositionW.w; 84 86 85 87 float3 sample_position = tex2D(positions, texcoord).xyz; 86 88 87 89 float3 vector_to_sample = sample_position - centerPosition; 88 // vector_to_sample.z = -vector_to_sample.z;89 90 float length_to_sample = length(vector_to_sample); 90 91 float3 direction_to_sample = vector_to_sample / (length_to_sample + 1e-9f); … … 95 96 96 97 // distance between current position and sample position controls AO intensity. 97 const float maxdist = 5e-1f;98 const float maxdist = 1e-1f; 98 99 //const float scale = 50.0f; 99 100 … … 116 117 { 117 118 pixel OUT; 118 //float4 lightDir = float4(1.0f, 1.0f, 1.0f, 0.0f);119 float4 lightDir = float4(0.0f, 1.0f, 0.0f, 0.0f);119 float4 lightDir = float4(1.0f, 1.0f, 1.0f, 0.0f); 120 //float4 lightDir = float4(0.0f, 1.0f, 0.0f, 0.0f); 120 121 121 122 float4 color = tex2D(colors, IN.texCoord.xy); … … 126 127 float4 position = tex2D(positions, IN.texCoord.xy); 127 128 128 float4 ambient = float4(0. 1f);129 float4 ambient = float4(0.3f); 129 130 130 131 // float3 L = normalize(lightPosition - position); … … 135 136 136 137 float ao = ssao(IN, positions, normals, ProjTrafo, noiseTexture); 137 OUT.color = ao; //(ambient + diffuse) * color; 138 //OUT.color = (ambient + diffuse) * color; 138 OUT.color = ao; 139 //OUT.color = ao * (ambient + diffuse) * color; 140 141 //float4 currentPos = tex2D(normals, IN.texCoord.xy) * 0.5f + 0.5f; 142 //float4 currentPos = tex2D(positions, IN.texCoord.xy); 143 //OUT.color = currentPos.w; 139 144 140 //float4 currentPos = tex2D(positions, IN.texCoord.xy); 141 //OUT.color = currentPos; 142 //float4 currentPos = tex2D(normals, IN.texCoord.xy) * 0.5f + 0.5f; 143 //OUT.color = currentPos; 144 145 145 146 return OUT; 146 147 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r2811 r2813 26 26 float4 texCoord: TEXCOORD0; 27 27 28 float4 dummy: WPOS;28 float4 projPos: WPOS; 29 29 float4 color: COLOR0; 30 30 float4 worldPos: TEXCOORD1; // world position … … 66 66 pix.col = tex2D(tex, IN.texCoord.xy); 67 67 pix.pos = IN.worldPos * maxDepth; 68 pix.pos.w = IN.projPos.w; 68 69 pix.norm = IN.normal; 69 70
Note: See TracChangeset
for help on using the changeset viewer.