static public Ray Reflect(Material mat, Vector nextOrgin, Vector dir, Vector nextNormal) { Vector pureBounce = Reflect(dir, nextNormal); //this is a shit way todo this. //TODO this is a shit way todo this. so make it better if (mat.reflect < 1.0f) { Vector rv = new Vector(Helpers.Rand.RandomBilateral(), Helpers.Rand.RandomBilateral(), Helpers.Rand.RandomBilateral() ); Vector RandomBounce = (nextNormal + rv).Normalize(); nextNormal = RandomBounce.Lerp(pureBounce, mat.reflect).Normalize(); } else { nextNormal = pureBounce; } return(new Ray(nextOrgin, nextNormal)); }