User Tools

Site Tools


tutorial_204_20-_203d_20spaces

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial_204_20-_203d_20spaces [2018/04/13 22:36] – Added syntax highlighting richardrusselltutorial_204_20-_203d_20spaces [2024/01/05 00:21] (current) – external edit 127.0.0.1
Line 85: Line 85:
 ===== Modifying the Vertex Shader ===== ===== Modifying the Vertex Shader =====
 \\  In our vertex shader from the previous tutorial, we take the input vertex position and output the same position without any modification. We can do this because the input vertex position is already defined in projection space. Now, because the input vertex position is defined in object space, we must transform it before outputting from the vertex shader. We do this with three steps: transform from object to world space, transform from world to view space, and transform from view to projection space. A vector is transformed by multiplying the vector by a matrix. In HLSL, this is done using the mul() intrinsic function. Our variable declaration and new vertex shader are shown below:\\ \\  \\  In our vertex shader from the previous tutorial, we take the input vertex position and output the same position without any modification. We can do this because the input vertex position is already defined in projection space. Now, because the input vertex position is defined in object space, we must transform it before outputting from the vertex shader. We do this with three steps: transform from object to world space, transform from world to view space, and transform from view to projection space. A vector is transformed by multiplying the vector by a matrix. In HLSL, this is done using the mul() intrinsic function. Our variable declaration and new vertex shader are shown below:\\ \\ 
 +<code glsl>
       //       //
       // Vertex Shader       // Vertex Shader
Line 97: Line 98:
           return output;           return output;
       }       }
 +</code>
 \\  \\ 
 ===== Setting up the Matrices ===== ===== Setting up the Matrices =====
tutorial_204_20-_203d_20spaces.1523658980.txt.gz · Last modified: 2024/01/05 00:16 (external edit)