- Timestamp:
- 10/01/08 11:35:23 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2984 r2985 53 53 static CGparameter sModelViewProjMatrixParam; 54 54 static CGparameter sMaxDepthParam; 55 static CGparameter sEyePosParam; 55 56 static CGparameter sSamplesParam; 56 57 static CGparameter sOldTexParam; … … 340 341 sPositionsTexParam = cgGetNamedParameter(sCgSsaoProgram, "positions"); 341 342 sColorsTexParam = cgGetNamedParameter(sCgSsaoProgram, "colors"); 343 sEyePosParam = cgGetNamedParameter(sCgSsaoProgram, "eyePos"); 342 344 sNormalsTexParam = cgGetNamedParameter(sCgSsaoProgram, "normals"); 343 345 sNoiseTexParam = cgGetNamedParameter(sCgSsaoProgram, "noiseTexture"); … … 664 666 665 667 cgGLSetParameter1f(sMaxDepthParam, mScaleFactor); 668 669 Vector3 pos = mCamera->GetPosition(); 670 cgGLSetParameter3f(sEyePosParam, pos.x, pos.y, pos.z); 666 671 667 672 cgGLSetParameter1f(sTemporalCoherenceParam, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2984 r2985 963 963 glDrawBuffers(3, mrt2); 964 964 } 965 965 966 sCurrentMrtSet = 1 - sCurrentMrtSet; 966 967 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r2982 r2985 28 28 //#define ILLUM_INTENSITY 9e-1f; 29 29 30 #define SSAO_MIPMAP_LEVEL 130 #define SSAO_MIPMAP_LEVEL 0//1 31 31 #define GI_MIPMAP_LEVEL 0//2 32 32 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2984 r2985 82 82 83 83 OUT.color = col; 84 84 85 OUT.color.w = color.w; 86 85 87 86 88 //////////// 87 89 //-- write out logaritmic luminance for tone mapping 88 90 /* 89 91 float4 oldColor = tex2Dlod(colors, float4(IN.texCoord.xy, 0, MAX_LOD_LEVEL)); 90 92 … … 101 103 else 102 104 OUT.color.w = logLumScaled; 103 105 */ 104 106 return OUT; 105 107 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2982 r2985 36 36 */ 37 37 float2 ssao(fragment IN, 38 uniform sampler2D positions,38 uniform sampler2D colors, 39 39 uniform sampler2D noiseTexture, 40 40 uniform float2 samples[NUM_SAMPLES], 41 41 uniform float3 currentNormal, 42 42 uniform float4 centerPosition, 43 uniform float scaleFactor 44 //,uniform float3 currentViewDir 43 uniform float scaleFactor, 44 uniform float3 viewDir, 45 uniform float3 eyePos 45 46 ) 46 47 { … … 59 60 //////////////////// 60 61 // add random noise: reflect around random normal vector (warning: slow!) 62 61 63 float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy).xy; 62 64 const float2 offsetTransformed = myreflect(offset, mynoise); … … 71 73 72 74 // sample downsampled texture in order to speed up texture accesses 73 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 74 //float3 sample_position = tex2D(positions, texcoord).xyz; 75 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 76 77 float3 sample_position = eyePos - viewDir * eyeSpaceDepth; 78 75 79 76 80 float3 vector_to_sample = sample_position - centerPosition.xyz; … … 112 116 const uniform float4x4 oldModelViewProj, 113 117 uniform float maxDepth, 114 uniform float temporalCoherence 118 uniform float temporalCoherence, 119 uniform float3 eyePos 115 120 ) 116 121 { … … 129 134 const float currentDepth = centerPosition.w; 130 135 131 const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w);//, viewDir); 136 /// the current view direction 137 float3 viewDir = normalize(IN.view); 138 139 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 132 140 133 141
Note: See TracChangeset
for help on using the changeset viewer.