- Timestamp:
- 10/03/08 16:49:22 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3000 r3001 272 272 mFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 273 273 274 mFbo->AddColorBuffer(ColorBufferObject:: BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);275 mFbo->AddColorBuffer(ColorBufferObject:: BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);276 mFbo->AddColorBuffer(ColorBufferObject:: BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);277 mFbo->AddColorBuffer(ColorBufferObject:: BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);274 mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 275 mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 276 mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 277 mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 278 278 } 279 279 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
r2999 r3001 15 15 public: 16 16 17 enum FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32, BUFFER_LUMINANCE_ALPHA};17 enum FORMAT { RGBA_UBYTE, RGBA_FLOAT_16, RGB_FLOAT_32, RGBA_FLOAT_32}; 18 18 enum WRAP_TYPE { WRAP_REPEAT, WRAP_CLAMP_TO_EDGE }; 19 19 enum FILTER_TYPE { FILTER_NEAREST, FILTER_LINEAR }; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r2965 r3001 139 139 140 140 FrameBufferObject *fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32, true); 141 fbo->AddColorBuffer(ColorBufferObject:: BUFFER_UBYTE,141 fbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE, 142 142 ColorBufferObject::WRAP_CLAMP_TO_EDGE, 143 143 ColorBufferObject::FILTER_NEAREST, -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
r2965 r3001 143 143 144 144 // need a color buffer to keep opengl happy 145 mFbo->AddColorBuffer(ColorBufferObject:: BUFFER_UBYTE,145 mFbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE, 146 146 ColorBufferObject::WRAP_CLAMP_TO_EDGE, 147 147 ColorBufferObject::FILTER_NEAREST); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2999 r3001 666 666 667 667 // the diffuse color buffer 668 fbo->AddColorBuffer(ColorBufferObject:: BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);668 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 669 669 // the positions buffer 670 //fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);671 fbo->AddColorBuffer(ColorBufferObject::BUFFER_LUMINANCE_ALPHA, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);670 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 671 //fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 672 672 // the normals buffer 673 fbo->AddColorBuffer(ColorBufferObject:: BUFFER_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);673 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 674 674 // another color buffer 675 fbo->AddColorBuffer(ColorBufferObject:: BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);675 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 676 676 677 677 PrintGLerror("fbo"); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r3000 r3001 108 108 //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 109 109 float3 rotView = Interpol(texcoord, bl, br, tl, tr); 110 //float3 rotView = Interpol(texcoord, bl, br, tl, tr);110 111 111 112 112 const float3 sample_position = eyePos - rotView * eyeSpaceDepth; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r3000 r3001 105 105 const float4 projPos = IN.mypos / IN.mypos.w; 106 106 107 const float2 screenCoord = projPos.xy * 0.5f + 0.5f;108 const float magView = length(Interpol(screenCoord, bl, br, tl, tr));109 110 107 // hack: squeeze some information about ambient into the texture 111 108 //pix.col.w = glstate.material.emission.x; 112 109 113 // eye linear depth 110 // compute eye linear depth 111 const float2 screenCoord = projPos.xy * 0.5f + 0.5f; 112 const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 114 113 pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 115 114 116 115 // save world position in second render target 117 116 pix.pos = IN.worldPos * maxDepth; 118 //pix.pos.x = pix.col.w;119 117 // store the projected depth 120 118 pix.pos.w = projPos.z; … … 143 141 144 142 const float4 projPos = IN.mypos / IN.mypos.w; 145 146 float2 screenCoord = projPos.xy * 0.5f + 0.5f;147 const float magView = length(Interpol(screenCoord, bl, br, tl, tr));148 143 149 144 // hack: squeeze some information about the ambient term into the target 150 145 //pix.col.w = glstate.material.emission.x; 146 147 // compute eye linear depth 148 float2 screenCoord = projPos.xy * 0.5f + 0.5f; 149 const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 151 150 pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 152 151 153 152 pix.pos = IN.worldPos * maxDepth; 154 //pix.pos.x = pix.col.w;155 153 // store the projected depth 156 154 pix.pos.w = projPos.z; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3000 r3001 4 4 // Screen Spaced Ambient Occlusion shader 5 5 // based on shader of Alexander Kusternig 6 7 8 #define USE_EYE_SPACE_DEPTH 0 6 9 7 10 … … 48 51 float3 bl, float3 br, float3 tl, float3 tr) 49 52 { 50 #if 153 #if USE_EYE_SPACE_DEPTH 51 54 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 52 55 //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); … … 104 107 //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f))++ numSamples; 105 108 106 // get sample world space position107 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w;108 //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr));109 float3 rotView = Interpol(texcoord, bl, br, tl, tr);110 111 109 float3 samplePos = ReconstructSamplePosition(eyePos, colors, texcoord, bl, br, tl, tr); 112 110 … … 170 168 float w = norm.w; 171 169 170 172 171 // the current world position 173 172 const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 174 173 175 #if 0174 #if USE_EYE_SPACE_DEPTH 176 175 /// reconstruct position from the eye space depth 177 /* float3 viewDir = normalize(IN.view);176 float3 viewDir = IN.view; 178 177 const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 179 float4 centerPosition; 180 181 centerPosition.xyz = eyePos - viewDir * eyeDepth; 182 */ 183 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 178 float4 centerPosition2; 179 180 centerPosition2.xyz = eyePos - viewDir * eyeDepth; 181 centerPosition2.w = centerPosition.w; 182 183 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition2, w, eyePos, bl, br, tl, tr); 184 184 #else 185 185
Note: See TracChangeset
for help on using the changeset viewer.