- Timestamp:
- 09/04/08 12:55:36 (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/SampleGenerator.cpp
r2901 r2902 8 8 HaltonSequence PoissonDiscSampleGenerator::sHalton; 9 9 HaltonSequence GaussianSampleGenerator::sHalton; 10 HaltonSequence PseudoRandomGenerator::sHalton; 10 11 11 12 … … 125 126 126 127 128 PseudoRandomGenerator::PseudoRandomGenerator(int numSamples, float radius): 129 SampleGenerator(numSamples, radius) 130 {} 131 132 133 void PseudoRandomGenerator::Generate(float *samples) const 134 { 135 sHalton.GetNext(2 * mNumSamples, samples); 136 } 137 138 127 139 SphericalSampleGenerator::SphericalSampleGenerator(int numSamples, float radius): 128 140 SampleGenerator(numSamples, radius) … … 134 146 float r[2]; 135 147 Sample3 *s = (Sample3 *)samples; 148 /* 149 // idea: use poisson distribution to generate samples 136 150 137 // idea: use poisson distribution to generate samples138 151 PoissonDiscSampleGenerator poisson(mNumSamples, 1.0f); 139 152 Sample2 *pSamples = new Sample2[mNumSamples]; 140 141 153 poisson.Generate((float *)pSamples); 142 154 */ 143 155 for (int i = 0; i < mNumSamples; ++ i) 144 156 { 145 //sHalton.GetNext(2, r);146 r[0] = pSamples[i].x; r[1] = pSamples[i].y;157 sHalton.GetNext(2, r); 158 //r[0] = pSamples[i].x; r[1] = pSamples[i].y; 147 159 148 160 // create stratified samples over sphere … … 155 167 } 156 168 157 delete [] pSamples;169 //delete [] pSamples; 158 170 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h
r2901 r2902 47 47 48 48 49 class PseudoRandomGenerator: public SampleGenerator 50 { 51 public: 52 53 PseudoRandomGenerator(int numSamples, float radius); 54 55 virtual void Generate(float *samples) const; 56 57 protected: 58 59 static HaltonSequence sHalton; 60 }; 61 62 49 63 class PoissonDiscSampleGenerator: public SampleGenerator 50 64 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao3d.cg
r2901 r2902 59 59 for (int i = 0; i < NUM_SAMPLES; ++ i) 60 60 { 61 const float3 offset = samples[i] * AREA_SIZE;61 const float3 offset = samples[i]; 62 62 63 63 //////////////////// 64 64 // add random noise: r stores costheta, g stores sintheta 65 65 66 float3 mynoise = (float3)tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier);67 const float3 offsetTransformed = reflect(offset, mynoise);68 //const float3 offsetTransformed = offset;66 float3 mynoise = (float3)tex2D(noiseTexture, IN.texCoord.xy);// * noiseMultiplier); 67 //const float3 offsetTransformed = myreflect(offset, mynoise) * AREA_SIZE; 68 const float3 offsetTransformed = offset * AREA_SIZE; 69 69 70 70 // compute position
Note: See TracChangeset
for help on using the changeset viewer.