genetic programming for shader simplification
play

Genetic Programming for Shader Simplification (UVA TR CS-2011-03) - PowerPoint PPT Presentation

Genetic Programming for Shader Simplification (UVA TR CS-2011-03) Pitchaya Sitthi-amorn, Nick Modly, Jason Lawrence, Westley Weimer Motivation: Real-Time Rendering Motivation: Pixel Shaders Most effects and computations occur at the pixel


  1. Genetic Programming for Shader Simplification (UVA TR CS-2011-03) Pitchaya Sitthi-amorn, Nick Modly, Jason Lawrence, Westley Weimer

  2. Motivation: Real-Time Rendering

  3. Motivation: Pixel Shaders ▸ Most effects and computations occur at the pixel level ▸ Pixel shader: a user program that executes at each pixel • Fog • Lighting • Water ripples • Soft shadows • Environment reflection mapping [Crysis 2]

  4. Motivation: Shader Complexity [Norman Rubin]

  5. Motivation: Shader Run Time ▸ Pixel shaders are executed several times to avoid aliasing 1 sample 16 samples 256 samples

  6. Key Insight ▸ Most shaders can be simplified with an acceptable loss in detail ▸ Output is consumed by human eyes

  7. Problem Statement ▸ Generate a sequence of simplified shaders

  8. Problem Statement ▸ Generate sequence of simplified shaders Rendering Time Error

  9. Problem Statement ▸ Generate sequence of simplified shaders Rendering Time Error

  10. Previous Work Olano et. al [2003] Pellacini [2005]

  11. Multi-Objective Genetic Programming (NSGA-II): Initialize Sort Select Pairs Crossover Mutate-Evaluate Select Rendering Time Rank 4 Rank 3 Rank 2 Crowding Heuristic Rank 1 Pareto Frontier Error

  12. Mutation Operator: Insert 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cost) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * cosi); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  13. Mutation Operator: Insert 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cost) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * cosi) - (cosi * cosi); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  14. Mutation Operator: Delete 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cost) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * cosi); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  15. Mutation Operator: Delete 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cost) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * cosi); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  16. Mutation Operator: Swap 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cost) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * cosi); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  17. Mutation Operator: Swap 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cosi) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * cost); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  18. Mutation Operator: Replacing with its average value 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cost) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * cosi); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  19. Mutation Operator: Replacing with the average value 1.float Fresnel (float th, float n) { 2. float cosi = cos (th); 3. float R = 1.0f; 4. float n12 = 1.0f / n; 5. float sint = n12 * sqrt (1 - (cosi * cosi)); 6. if (sint < 1.0f) { 7. float cost = sqrt (1.0 - (sint * sint)); 8. float r_ortho = (cosi - n * cost) 9. / (cosi + n * cost); 10. float r_par = (cost - n * cosi) 11. / (cost + n * 0.5); 12. R=(r_ortho * r_ortho + r_par * r_par)/2; 13. } 14. return R; 15.}

  20. Measuring Error/Performance Original Modified

  21. Approximating Error/Performance

  22. Approximating Error/Performance

  23. Approximating Error/Performance

  24. Error/Performance Approximation Validation Cross correlation 0.84 and 0.95 Fitness evaluation time improvement: 100x

  25. Test Scenes and Shaders Marble shader Trashcan shader Human Head procedural noise with approximate subsurface supersampled (25) Blinn-Phong specular layer scattering of human skin environment map (300K triangles) (75K triangles) (15K triangles)

  26. Marble Shader

  27. Marble Shader

  28. Trashcan Shader

  29. Trashcan Shader

  30. Human Head Shader

  31. Human Head Shader

  32. Marble Shader – SSIM & Previous Work (Previous approaches are not well-founded on multi-pass shaders.)

  33. Conclusion ▸ Graphics shader software simplification ▸ “Continuous functions” ▸ Efficiency is critical ▸ Output consumed by humans ▸ Multi-objective genetic programming approach ▸ NSGA-II plus mutation, crossover, tournament k , crowding heuristic ▸ Rapid error and runtime (fitness) approximation ▸ 2.5x better than previous work at constant error ▸ Applies to multi-pass shaders

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend