- Timestamp:
- 06/03/08 03:25:49 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh
r2730 r2731 26 26 #LOG_PREFIX=../src/SG08/rebut-arena-pixel2 27 27 LOG_PREFIX=../src/SG08/speedtest 28 LOG_PREFIX=../src/SG08/ arena_trees28 LOG_PREFIX=../src/SG08/importance_3.0 29 29 30 30 ENVIRONMENT=gvs.env … … 42 42 -gvs_total_samples=1000000 \ 43 43 -gvs_samples_per_pass=1000000 \ 44 -gvs_initial_samples=1 \44 -gvs_initial_samples=16 \ 45 45 -gvs_max_viewcells=3 \ 46 -gvs_min_contribution=50 0\46 -gvs_min_contribution=50 \ 47 47 -gvs_per_viewcell=true \ 48 48 -preprocessor_detect_empty_viewspace+ \ 49 -preprocessor_snap_error_frames+ \ 49 50 -kd_pvs_area=1e-4 \ 50 51 -view_cells_use_kd_pvs+ \ -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r2687 r2731 1923 1923 "false"); 1924 1924 1925 1926 RegisterOption("Preprocessor.snapErrorFrames", 1927 optBool, 1928 "preprocessor_snap_error_frames", 1929 "false"); 1930 1931 1925 1932 RegisterOption("Preprocessor.useVbos", 1926 1933 optBool, -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2730 r2731 148 148 mDetectEmptyViewSpace); 149 149 150 //mSnapErrorFrames = false;151 mSnapErrorFrames = true;150 Environment::GetSingleton()->GetBoolValue("Preprocessor.snapErrorFrames", 151 mSnapErrorFrames); 152 152 153 153 mSnapPrefix = "snap/"; -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2730 r2731 25 25 #define NOT_ACCOUNTED_OBJECT 0 26 26 #define ACCOUNTED_OBJECT 2 27 27 #define DETERMINISTIC_GVS 0 28 28 29 29 static const float MIN_DIST = 0.001f; … … 182 182 reverseRays.clear(); 183 183 184 if ( 0)184 if (DETERMINISTIC_GVS) 185 185 { 186 186 VssRay *reverseRay = … … 301 301 bool GvsPreprocessor::HandleRay(VssRay *vssRay) 302 302 { 303 if (! HasContribution(*vssRay))303 if (!vssRay || !HasContribution(*vssRay)) 304 304 return false; 305 305 … … 491 491 492 492 const int numRandomRays = 16 - (int)simpleRays.size(); 493 SimpleRay mainRay = SimpleRay(currentRay.GetOrigin(), 494 currentRay.GetNormalizedDir(), 495 SamplingStrategy::GVS, 496 1.0f); 497 498 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0); 499 //GenerateRays(numRandomRays, *mDistribution, simpleRays, sInvalidSamples); 493 494 if (!DETERMINISTIC_GVS) 495 { 496 if (0) 497 { 498 SimpleRay mainRay = SimpleRay(currentRay.GetOrigin(), 499 currentRay.GetNormalizedDir(), 500 SamplingStrategy::GVS, 501 1.0f); 502 503 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0); 504 } 505 else 506 GenerateImportanceSamples(currentRay, hitTriangle, numRandomRays, simpleRays); 507 } 508 else 509 GenerateRays(numRandomRays, *mDistribution, simpleRays, sInvalidSamples); 500 510 501 511 generationTimer.Exit(); … … 799 809 castTimer.Entry(); 800 810 801 if ( 0)811 if (DETERMINISTIC_GVS) 802 812 { 803 813 const bool castDoubleRays = !mPerViewCell; … … 1511 1521 1512 1522 // compute the pixel error of this visibility solution 1513 if ( mEvaluatePixelError)1523 if (0 && mEvaluatePixelError) 1514 1524 ComputeRenderError(); 1515 1525 } … … 1521 1531 ComputeViewCellGeometryIntersection(); 1522 1532 1533 // compute the pixel error of this visibility solution 1534 if (mEvaluatePixelError) 1535 ComputeRenderError(); 1523 1536 1524 1537 //////// … … 1865 1878 1866 1879 1867 SimpleRay GvsPreprocessor::GenerateJitteredSample(const SimpleRay &sray) 1868 { 1869 // mutate the origin 1870 Vector3 d = sray.mDirection; 1880 void GvsPreprocessor::GenerateImportanceSamples(const VssRay &ray, 1881 const Triangle3 &triangle, 1882 int numSamples, 1883 SimpleRayContainer &simpleRays) 1884 { 1885 const size_t samplesSize = simpleRays.size(); 1886 1887 while (simpleRays.size() < (samplesSize + numSamples)) 1888 { 1889 SimpleRay sray; 1890 if (GenerateImportanceSample(ray, triangle, sray)) 1891 simpleRays.push_back(sray); 1892 } 1893 } 1894 1895 1896 bool GvsPreprocessor::GenerateImportanceSample(const VssRay &ray, 1897 const Triangle3 &triangle, 1898 SimpleRay &sray) 1899 { 1900 Vector3 d = ray.GetDir(); 1871 1901 1872 1902 // Compute right handed coordinate system from direction 1873 1903 Vector3 U, V; 1874 d.RightHandedBase(U, V); 1904 1905 Vector3 nd = Normalize(d); 1906 nd.RightHandedBase(U, V); 1907 1908 Vector3 origin = ray.mOrigin; 1909 Vector3 termination = ray.mTermination; 1875 1910 1876 1911 float rr[2]; … … 1880 1915 1881 1916 Vector2 vr2(rr[0], rr[1]); 1917 const float sigma = triangle.GetBoundingBox().Radius() * 3.0f; 1882 1918 Vector2 gaussvec2; 1883 1884 const float sigma = 0.2f;1885 1919 1886 1920 GaussianOn2D(vr2, sigma, // input 1887 1921 gaussvec2); // output 1888 1922 1889 Vector3 shift = gaussvec2.xx * U + gaussvec2.yy * V; 1890 1891 d += shift; 1923 const Vector3 shift = gaussvec2.xx * U + gaussvec2.yy * V; 1924 1925 //cout << "t: " << termination; 1926 termination += shift; 1927 //cout << " new t: " << termination << endl; 1928 Vector3 direction = termination - origin; 1929 1930 const float len = Magnitude(direction); 1931 1932 if (len < Limits::Small) 1933 return false; 1892 1934 1893 d.Normalize(); 1894 1895 return SimpleRay(sray.mOrigin, d, SamplingStrategy::GVS, 1.0f); 1896 } 1897 1898 1899 } 1935 direction /= len; 1936 1937 // $$ jb the pdf is yet not correct for all sampling methods! 1938 const float pdf = 1.0f; 1939 sray = SimpleRay(origin, direction, SamplingStrategy::GVS, pdf); 1940 1941 return true; 1942 } 1943 1944 1945 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
r2730 r2731 274 274 virtual void ComputeRenderError(); 275 275 276 SimpleRay GenerateJitteredSample(const SimpleRay &ray); 277 276 bool GenerateImportanceSample(const VssRay &ray, const Triangle3 &triangle, SimpleRay &sray); 277 278 void GenerateImportanceSamples(const VssRay &ray, 279 const Triangle3 &triangle, 280 int numSamples, 281 SimpleRayContainer &simpleRays); 278 282 279 283 //////////////////////
Note: See TracChangeset
for help on using the changeset viewer.