public override Color Tracing(Ray ray, Sky sky, SamplerBase sampler, int depth = 0) { if (depth > tracingTimes) { return(Color.black); } RayCastHit hit; hit.distance = double.MaxValue; if (sceneData.Raycast(ray, m_Epsilon, out hit)) { hit.depth = depth; if (hit.shader == null) { return(new Color(1, 0, 1)); } return(hit.shader.Render(this, sky, sampler, ray, hit, m_Epsilon)); } else { if (sky != null) { return(sky.RenderColor(ray.direction)); } return(Color.black); } }
public override Color Render(Tracer tracer, Sky sky, SamplerBase sampler, Ray ray, RayCastHit hit, double epsilon) { Vector3 refl = Vector3.Reflect(ray.direction, hit.normal); if (sky != null) { return(sky.RenderColor(refl)); } return(Color.white); }