Changeset 2970
- Timestamp:
- 09/24/08 14:59:35 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2968 r2970 98 98 static CGparameter sLightDirShadowParam; 99 99 static CGparameter sImageKeyParam; 100 static CGparameter sMiddleGreyParam; 100 101 static CGparameter sWhiteLumParam; 101 102 … … 408 409 409 410 sImageKeyParam = cgGetNamedParameter(sCgAntiAliasingProgram, "imageKey"); 411 sMiddleGreyParam = cgGetNamedParameter(sCgAntiAliasingProgram, "middleGrey"); 410 412 sWhiteLumParam = cgGetNamedParameter(sCgAntiAliasingProgram, "whiteLum"); 411 413 … … 513 515 } 514 516 515 AntiAliasing(fbo );517 AntiAliasing(fbo, light); 516 518 517 519 glEnable(GL_LIGHTING); … … 668 670 669 671 670 void DeferredRenderer::AntiAliasing(FrameBufferObject *fbo )672 void DeferredRenderer::AntiAliasing(FrameBufferObject *fbo, DirectionalLight *light) 671 673 { 672 674 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); … … 679 681 680 682 const float imageKey = ToneMapper().CalcImageKey(pixels, w, h); 681 const float whiteLum = 0.5f * ToneMapper().CalcMaxLuminance(pixels, w, h); 682 683 const float whiteLum = 1.0f * ToneMapper().CalcMaxLuminance(pixels, w, h); 684 685 //const float minKey = 0.18f; 686 //const float maxKey = 0.72f; 687 688 //const float minKey = 0.0045f; 689 const float minKey = 0.09f; 690 const float maxKey = 0.5f; 691 692 const float lightIntensity = DotProd(-light->GetDirection(), Vector3::UNIT_Z()); 693 const float middleGrey = lightIntensity * maxKey + (1.0f - lightIntensity) * minKey; 694 695 cout << "middlegrey: " << middleGrey << endl; 683 696 delete [] pixels; 684 697 … … 699 712 cgGLSetParameter1f(sImageKeyParam, imageKey); 700 713 cgGLSetParameter1f(sWhiteLumParam, whiteLum); 714 cgGLSetParameter1f(sMiddleGreyParam, middleGrey); 701 715 702 716 … … 889 903 GLuint colorsTex = fbo->GetColorBuffer(3)->GetTexture(); 890 904 891 //GLuint ssaoTex = mNewFbo->GetColorBuffer(0)->GetTexture();892 //GLuint illumTex = mNewFbo->GetColorBuffer(1)->GetTexture();893 905 GLuint ssaoTex = mFbo->GetColorBuffer(mFboIndex)->GetTexture(); 894 906 GLuint illumTex = mFbo->GetColorBuffer(mFboIndex + 1)->GetTexture(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r2965 r2970 78 78 void CombineIllum(FrameBufferObject *fbo); 79 79 80 void AntiAliasing(FrameBufferObject *fbo );80 void AntiAliasing(FrameBufferObject *fbo, DirectionalLight *light); 81 81 /** Helper method that computes the view vectors in the corners of the current view frustum. 82 82 */ -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r2968 r2970 284 284 // downscale ambient color 285 285 //ambient *= 5e-5f; 286 //ambient *= 2e-3f;286 ambient *= 1e-1f; 287 287 288 288 // simulate the sun intensity by modulating the ambient term. 289 //ambient *= (1.0f - 0.9f * DotProd(sunDir, Vector3::UNIT_Z()));289 ambient *= (10.0f - 9.0f * DotProd(sunDir, Vector3::UNIT_Z())); 290 290 //ambient += Vector3(0.2f); 291 291 … … 321 321 322 322 // Calculate final sun diffuse color. 323 //diffuse = color * 2e-3f; 324 diffuse = color; 323 diffuse = color * 3e-1f; 324 //diffuse *= (3.0f - 2.0f * DotProd(sunDir, Vector3::UNIT_Z())); 325 //diffuse = color; 326 325 327 326 328 //cout << "diffuse: " << Magnitude(diffuse) << " ambient: " << Magnitude(ambient) << endl; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ToneMapper.cpp
r2968 r2970 36 36 37 37 static float previousKey = key; 38 const float factor = 1.0f;38 const float factor = 0.5f; 39 39 40 const float imageKey = key;// * factor + previousKey * (1.0f - factor); 40 float imageKey; 41 42 if (key > 0) 43 imageKey = key * factor + previousKey * (1.0f - factor); 44 else 45 imageKey = previousKey; 46 41 47 previousKey = imageKey; 42 48 43 cout << "key: " << key << endl;49 //cout << "key: " << key << endl; 44 50 45 51 return imageKey; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r2968 r2970 33 33 34 34 ///////// 35 //-- tone mapping36 37 //#define MIDDLE_GRAY 0.5f38 //#define MIDDLE_GRAY 0.72f39 #define MIDDLE_GRAY 0.36f40 //#define MIDDLE_GRAY 0.18f41 //#define MIDDLE_GRAY 0.18f42 43 44 /////////45 35 //-- shadowing 46 36 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
r2969 r2970 21 21 22 22 23 float3 ToneMap(float imageKey, float whiteLum, float 3 color)23 float3 ToneMap(float imageKey, float whiteLum, float middleGrey, float3 color) 24 24 { 25 25 float3 outCol; … … 27 27 28 28 // adjust to middle gray 29 const float lum = MIDDLE_GRAY* pixLum / imageKey;29 const float lum = middleGrey * pixLum / imageKey; 30 30 31 31 // map to range and calc burnout … … 51 51 uniform sampler2D normals, 52 52 uniform float imageKey, 53 uniform float whiteLum 53 uniform float whiteLum, 54 uniform float middleGrey 54 55 ): COLOR 55 56 { … … 121 122 122 123 //return float4(w); 123 col.xyz = ToneMap(imageKey, whiteLum, col.xyz);124 col.xyz = ToneMap(imageKey, whiteLum, middleGrey, col.xyz); 124 125 125 126 return col;
Note: See TracChangeset
for help on using the changeset viewer.