Time for Action: Examining the Ray Traced Scene

Let's cover an example showcasing the power of ray tracing:

  1. Open the ch10_04_ray-tracing.html file in your browser. You should see a scene with a simple lit, bobbing sphere like the one shown in the following screenshot:
  1. In order to trigger the shader, we need a way to draw a full-screen quad. Fortunately, we have a class from our post-processing examples earlier in this chapter to help us do just that. Since we don't have a scene to process, we can omit a large part of the rendering code and simplify JavaScript's draw function:
function draw() {  gl.viewport(0, 0, gl.canvas.width, gl.canvas. ...

Get Real-Time 3D Graphics with WebGL 2 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.