zercha  committed 2c466a0

Important !!!forgot to add to the previous commit!!! - fixed a MAJOR !MAJOR! MAJOR overlooked bug in the program causing objects to appear more emitted than they actually were. This occurred because the color from the light model was added together with the ratio-fixed refraction and reflection... HOWEVER the light from the lightmodel wasn't ratio-fixed (1 - refraction - reflection) causing objects to give off more than 100% light, an object with 30% refraction and 30% reflection would send out a sum of 160% color making up for the (especially) weird refracting materials.

  • Participants
  • Parent commits c87a29d
  • Branches default

Comments (0)

Files changed (1)

File src/raytracer/

 				avgLightRatio = avgLightRatio.add(tmpLightRatio);
-		color  = color.mul(1-shape.getMaterial().getReflectionRatio()-shape.getMaterial().getRefractionRatio());
+		color  = color.mul(1-shape.getMaterial().getReflectionRatio()-shape.getMaterial().getRefractionRatio()); //Major bug fix
 		avgLightRatio = avgLightRatio.div(scene.getLights().size()); //Zercha säger att det ska finnas(kommer att påverkas av en light sensitivity variabel)
 //		color *= scene.settings.lightSensitivity;  // Zetro säger att denna ska vara i slutet. Zetro ändrar sig... Denna ska ligga i getPixelAt()