I recently decided to build my first 3D game, after a few 2D ones. Chose to go with Three.js and WebGL, as it is supported on both Linux and Windows. Anyway, I got my first few examples, but I still need to understand things on a lower level... Things like shaders, bounding boxes, textures, models. Could you explain them to me? I do know what textures and models are, but there are still many other unknown terms that occur... I tried to read up on shaders on Wikipedia, but I need a solid example, that article seems to be written for experts, not for people that seek to learn something.
Also, if you could recommend some good books on this, I'd be grateful.
Think of an OPENGL (/WebGL) instance as an artist, well call him `Bob`, but instead of eyes, your artist takes messages. The messages that `Bob` can accept is described by the API (application programming interface
How can you describe a 3D object to someone without eyes? Well, there are a few ways. The method used by OPENGL is "Geometric Primitives". Essentially lines and polygons. A mathematical representation.
You create a laundry list of Geometric Primitives that describe the visible structure of the object, which is called a Model
These Models are a bit bland, they don't contain any information about colour, or to be more precise, how Light interacts with the object. (The line between Model and Light Interaction Information is a bit blurred as Light Interaction Information requires knowledge of the Model).
Complex colour information can be stored in the objects Texture
. A texture is essentially a 2D array of pixels (an image).
Storing the colour information in this way has its limitations, consider creating an Ear, how would you render the veins just under the skin which show up under high intense light?
can be used to alter the attributes of a pixel (https://en.wikipedia.org/wiki/Fragment_%28computer_graphics%29
) at runtime, providing more detail and realism to your rendering.
A Bounding Box is a method to "accelerate certain kinds of tests". Which can be found in Ray Tracing, and in Collision Detection. The wiki entry can explain the finer details better than I, https://en.wikipedia.org/wiki/Bounding_volume
All the best with your future 3D projects
Mike Brown [CXZUK]