[Optimization] Ray tracing only computed when needed

We're not in Mozilla here!