Vertex shader

From Unify Community Wiki
Jump to: navigation, search

DISCLAIMER: This page is written by Unity users and is built around their knowledge. Some users may be more knowledgeable than others, so the information contained within may not be entirely complete or accurate.

Summery

A Vertex Shader is the part of a Shader Program that gets run on the GPU every time it processes a Vertex before Rasterizing the geometery.

In Plain English

If you had a triangle that you were rendering to the screen, it would have three vertices; one at each corner. These vertices are how the game engine(in our case Unity3D, but also any program) communicates to the graphics card( GPU ) how the objects are formed and should be displayed. Each Vertex can send along any information we want to use to help describe the visual properties of it to the GPU. These pieces of information are normally called attributes. In Unity3D, this information gets sent for us through the Renderer Component, which then passes on Mesh data based on it's type (MeshRenderer, SpriteRenderer, etc.) and the other Components tied to that GameObject. Mesh data is simply a collection of vertices and their attributes. This collection of vertices is what gets sent to the GPU and then pushed through the various stages or shaders of Rendering, including the Vertex Shader. In times of old, the Vertex Shader was responsible for as many things as possible. At the time only the Vertex Shader and Fragment Shader were programmable and the Vertex Shader is generally processed much less, compared to the Fragment Shader which is run for every pixel on the screen the Mesh is visible (or would be visible if not for other objects in front of it).

(This page is a work in progress. Apologies!)

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox