giRSM.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Class used to store the global illumination parameters for a reflective shadow map.
  3. * Instances of this class are used by the GIRSMManager class to generate global illumination for a scene.
  4. */
  5. export class GIRSM {
  6. /**
  7. * Creates a new GIRSM instance
  8. * @param rsm The reflective shadow map
  9. */
  10. constructor(rsm) {
  11. /**
  12. * The number of samples to use to generate the global illumination. Default value is 400.
  13. */
  14. this.numSamples = 400;
  15. /**
  16. * Radius of the circle in the RSM flux texture to read samples from. Default value is 0.1.
  17. * Valid values are between 0 and 1.
  18. */
  19. this.radius = 0.1;
  20. /**
  21. * Intensity of the global illumination effect. Default value is 0.1.
  22. */
  23. this.intensity = 0.1;
  24. /**
  25. * value used to correct for edge artifacts when calculating the global illumination effect. Default value is 0.1.
  26. * Will depend on your scene.
  27. */
  28. this.edgeArtifactCorrection = 0.1;
  29. /**
  30. * Defines if samples should be rotated when generating the global illumination effect. Default value is true.
  31. * Rotating samples will improve the quality of the global illumination effect by trading banding for noise, at the cost of a bit of performance.
  32. */
  33. this.rotateSample = true;
  34. /**
  35. * Noise scale factor, only used if rotateSample is true. Default value is 100.
  36. * Will depend on your scene.
  37. */
  38. this.noiseFactor = 100;
  39. /**
  40. * Defines if the full texture should be used when generating the global illumination effect. Default value is false.
  41. * If true, values for numSamples, radius, rotateSample and noiseFactor will be ignored and the full texture will be used to generate the global illumination effect.
  42. * Be careful to use a RSM texture size small enough to limit the number of samples! For eg. a 32x32 texture will generate 1024 samples per pixel!
  43. */
  44. this.useFullTexture = false;
  45. this.rsm = rsm;
  46. }
  47. /**
  48. * Disposes the GIRSM
  49. */
  50. dispose() {
  51. this.rsm.dispose();
  52. }
  53. }
  54. //# sourceMappingURL=giRSM.js.map