- Timestamp:
- 10/02/08 16:34:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
r2975 r2991 105 105 return OUT; 106 106 } 107 108 109 pixel CalcAvgLogLum(frag IN, uniform sampler2D colors) 110 { 111 //////////// 112 //-- write out logaritmic luminance for tone mapping 113 114 pixel OUT; 115 116 // the old loglum is stored in the hightest mipmap-level 117 float4 color = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); 118 float oldLogLum = tex2Dlod(colors, float4(IN.texCoord.xy, 0, MAX_LOD_LEVEL)).w; 119 120 // the intensity weights 121 const float3 w = float3(0.299f, 0.587f, 0.114f); 122 123 float lum = dot(color.rgb, w); 124 float logLum = log(1e-5f + lum); 125 126 float logLumOffset = MINLOGLUM * INV_LOGLUM_RANGE; 127 float logLumScaled = logLum * INV_LOGLUM_RANGE - logLumOffset; 128 129 OUT.color = color; 130 131 if (oldLogLum > 0) 132 OUT.color.w = lerp(oldLogLum, logLumScaled, 0.1f); 133 else 134 OUT.color.w = logLumScaled; 135 }
Note: See TracChangeset
for help on using the changeset viewer.