Posts

Showing posts with the label Shaders

What is a Normal Map Shader?

What is a Normal Map Shader? It provides a way to make your objects look more detailed and realistic, without having to actually increase the complexity of the models.

In a Normal Map, how are the Normals stored?

In a Normal Map, how are the Normals stored? The Normals are stored as Colors in the texture, so to get the Normal at a certain point on the object, we would sample the normal map at the relevant point and that will give us an RGB color where each value is between 0 and 1. However, the XYZ components in a Normal vector can be between -1 and 1. So a conversion is to multiple them by 2 and subtract 1. We now have 3 values between -1 and 1.

The Fragment Shader runs once for every...?

The Fragment Shader runs once for every...? Pixel that needs to get Rasterized.

What is a Uniform?

What is a Uniform? A uniform is a GLSL global variable declared with the "uniform" variable name. These act as parameters that the user of a shader program can pass to the shader program. They are stored in a program object. Uniforms are so named because they do not change from one execution of a shader program to the next within a particular rendering call. This makes them unlike shader stage inputs and outputs, which are often different for each invocation of a program stage.

What does Attenuation mean?

What does Attenuation mean? The reduction of the force, effect, or value of something.

What is a Layout qualifier?

What is a Layout qualifier? Layout Qualifiers affect where the storage for a variable comes from, as well as other user-facing properties of a particular definition. For instance: layout (location=0) in vec3 position; means that no matter what "position" is called, it is still the same variable.

How does the Normal Map Texture work?

How does the Normal Map Texture work? A Normal Map is a texture which specifies the surface normal that should be used for every single point on the object's surface.

What is the Vertex Processing Stage?

What is the Vertex Processing Stage? Transforms the primitives into screen space, optionally doing other processing, such as vertex color computation, along the way. The specific operations can be customized by vertex shaders.

What is the Rasterization Stage?

What is the Rasterization Stage? Takes the screen-space triangles resulted from vertex processing and generates a fragment for every pixel that's covered by each triangle. It also interpolates parameter values, such as colors, normals, and texture coordinates, given by the vertex processing stage, to create smoothly varying parameter values for the fragments. Depending on the design of the Rasterizer, it may clip the primitives to the view volume.

What is the Fragment Processing Stage?

What is the Fragment Processing Stage? Processes the fragments to determine the final color of each pixel. It performs z-buffering for hidden surface removal and writes the results into the frame buffer.

For each Vertex that we want to draw, the ___ Shader is used. So if we wanted to draw a triangle, it would be called ___ times.

For each Vertex that we want to draw, the ___ Shader is used. So if we wanted to draw a triangle, it would be called ___ times. Vertex Shader 3 times, one for each Vertex.

The primary job of the Vertex Shader is to tell OpenGL...?

The primary job of the Vertex Shader is to tell OpenGL...? Where you want the Vertex to be in your screen space.

What is the Application Stage?

What is the Application Stage? Holds the scene being rendered in some appropriate data structure, and sends a series of primitives to the pipeline for rendering.

What is the Graphics Pipeline?

What is the Graphics Pipeline? A sequence of processing stages that efficiently transforms a set of 3D primitives into a shaded rendering from a particular camera viewpoint.

What are the major stages of the Graphics Pipeline?

What are the major stages of the Graphics Pipeline? 1. Application 2. Vertex Processing 3. Rasterization 4. Fragment Processing 5. Display