Let's cover an example of how we'd update shader uniforms interactively:
- Open the ch03_01_goraud_lambert.html file in your browser:
- Notice that in this example, the controls widget is at the top right of the page. If you're curious about how it works, you can check the initControls function inside of the example code.
The Settings Widget
The settings widget was created using DatGui, an open source library. While we won't cover the intuitive DatGui API, it may be useful to read the documentation and the code in the provided examples to see how it works. For more information, you can check out https://github.com/dataarts/dat.gui.
The settings widget was created using DatGui, an open source library. While we won't cover the intuitive DatGui API, it may be useful to read the documentation and the code in the provided examples to see how it works. For more information, you can check out https://github.com/dataarts/dat.gui.
- Translate X, Y, Z: These control the direction of the light. By changing these sliders, you will modify the uLightDirection uniform:
- Sphere Color: This changes the uMaterialDiffuse...