Changeset 2830 for GTP/trunk/App/Demos
- Timestamp:
- 07/10/08 18:39:50 (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
r2829 r2830 291 291 int returnCode = 0; 292 292 293 cout << "=== reading environment file === " << endl; 294 293 295 env.Read("src/default.env"); 294 296 … … 304 306 305 307 env.GetBoolParam(string("useFullScreen"), useFullScreen); 306 307 308 //env.GetIntParam(string("numSssaoSamples"), numSsaoSamples); 308 309 … … 310 311 env.GetVectorParam(string("camPosition"), camPos); 311 312 312 cout << "read values: " << endl;313 313 cout << "assumedVisibleFrames: " << assumedVisibleFrames << endl; 314 314 cout << "maxBatchSize: " << maxBatchSize << endl; … … 1972 1972 } 1973 1973 1974 1974 #if 0 1975 // kustls magic sample positions 1975 1976 void GenerateSamples() 1977 { 1978 static const float mysamples[] = 1979 { 1980 -0.326212f, -0.405805f, 1981 -0.840144f, -0.07358f, 1982 -0.695914f, 0.457137f, 1983 -0.203345f, 0.620716, 1984 0.96234f, -0.194983f, 1985 0.473434f, -0.480026f, 1986 0.519456, 0.767022f, 1987 0.185461f, -0.893124f, 1988 0.507431f, 0.064425f, 1989 0.89642f, 0.412458f, 1990 -0.32194f, -0.932615f, 1991 -0.791559f, -0.597705f, 1992 0.326212f, 0.405805f, 1993 0.840144f, 0.07358f, 1994 0.695914f, -0.457137f, 1995 0.203345f, -0.620716, 1996 -0.96234f, 0.194983f, 1997 -0.473434f, 0.480026f, 1998 -0.519456, -0.767022f, 1999 -0.185461f, 0.893124f, 2000 -0.507431f, -0.064425f, 2001 -0.89642f, -0.412458f, 2002 0.32194f, 0.932615f, 2003 0.791559f, 0.597705f 2004 }; 2005 2006 for (int i = 0; i < NUM_SAMPLES; ++ i) 2007 { 2008 samples[i] = mysamples[i]; 2009 } 2010 } 2011 2012 #else 2013 2014 /*void GenerateSamples() 1976 2015 { 1977 2016 float scale = 1.0f / (float)NUM_SAMPLES; … … 2002 2041 //cout << samples[i] << " " << samples[i + 1] << endl; 2003 2042 } 2004 } 2043 }*/ 2044 2045 void GenerateSamples() 2046 { 2047 // generates poisson distribution on disc 2048 float factor = 1.0f; 2049 float minDist = factor * sqrt((float)NUM_SAMPLES) / 2; 2050 2051 cout << "minDist= " << minDist << endl; 2052 2053 for (int i = 0; i < NUM_SAMPLES; i += 2) 2054 { 2055 int tries = 0; 2056 2057 // repeat until valid sample was found 2058 while (1) 2059 { 2060 2061 ++ tries; 2062 2063 const float rx = RandomValue(-1, 1); 2064 const float ry = RandomValue(-1, 1); 2065 2066 // check if in disk, else exit early 2067 if (rx * rx + ry * ry > 1) 2068 continue; 2069 2070 bool sampleValid = true; 2071 2072 // check poisson property 2073 for (int j = 0; ((j < i) && sampleValid); j += 2) 2074 { 2075 const float dist = 2076 sqrt((samples[j] - rx) * (samples[j] - rx) + 2077 (samples[j + 1] - ry) * (samples[j + 1] - ry)); 2078 2079 if (dist < minDist) 2080 sampleValid = false; 2081 } 2082 2083 if (sampleValid) 2084 { 2085 samples[i] = rx; 2086 samples[i + 1]= ry; 2087 break; 2088 } 2089 2090 if (tries > 1000) 2091 { 2092 minDist *= 0.9f; 2093 tries = 0; 2094 } 2095 } 2096 cout << "sample: " << samples[i] << " " << samples[i + 1] << " r: " << sqrt(samples[i] * samples[i] + samples[i + 1] * samples[i + 1]) << " tries: " << tries << endl; 2097 } 2098 2099 cout << "minDist= " << minDist << endl; 2100 } 2101 2102 2103 #endif 2005 2104 2006 2105 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/default.env
r2829 r2830 10 10 winHeight=768 11 11 camPosition=483.398f 242.364f 186.078f 12 useFullScreen= false12 useFullScreen=0 13 13 numSsaoSamples=8 14 14 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2829 r2830 4 4 5 5 #define NUM_SAMPLES 8 6 #define SAMPLE_INTENSITY 0.5f 7 //#define SAMPLE_INTENSITY 0.7f 6 //#define SAMPLE_INTENSITY 0.5f 7 //#define SAMPLE_INTENSITY 1.1f 8 #define SAMPLE_INTENSITY 0.7f 8 9 #define AREA_SIZE 5e-1f 9 10 // kustls magic sample positions11 /*static const float2 samples[NUM_SAMPLES] =12 {13 {-0.326212f, -0.405805f},14 {-0.840144f, -0.07358f},15 {-0.695914f, 0.457137f},16 {-0.203345f, 0.620716},17 {0.96234f, -0.194983f},18 {0.473434f, -0.480026f},19 {0.519456, 0.767022f},20 {0.185461f, -0.893124f},21 {0.507431f, 0.064425f},22 {0.89642f, 0.412458f},23 {-0.32194f, -0.932615f},24 {-0.791559f, -0.597705f},25 {0.326212f, 0.405805f},26 {0.840144f, 0.07358f},27 {0.695914f, -0.457137f},28 {0.203345f, -0.620716},29 {-0.96234f, 0.194983f},30 {-0.473434f, 0.480026f},31 {-0.519456, -0.767022f},32 {-0.185461f, 0.893124f},33 {-0.507431f, -0.064425f},34 {-0.89642f, -0.412458f},35 {0.32194f, 0.932615f},36 {0.791559f, 0.597705f}37 };*/38 10 39 11 … … 119 91 float cos_angle = dot(direction_to_sample, currentNormal); 120 92 cos_angle = max(cos_angle, 0.0f); 121 cos_angle *= cos_angle; 93 // take quadratic influence to sharpen contrast 94 //cos_angle *= cos_angle; 122 95 123 96 // distance between current position and sample position controls AO intensity.
Note: See TracChangeset
for help on using the changeset viewer.