Rendering to a canvas and using it as a texture
In this section, we will look at two different examples. First, we will look at how you can use the canvas to create a simple texture and apply it to a mesh; after that, we’ll go one step further and create a canvas that can be used as a bump map, using a randomly generated pattern.
Using the canvas as a color map
Figure 10.29 – Using an HTML canvas as a texture
import Mandelbrot from 'mandelbrot-canvas' ... const div = document.createElement('div') div.id = 'mandelbrot' div.style = 'position: absolute' document.body.append(div) const mandelbrot = new Mandelbrot(document.getElementById...