Difference between revisions of "3D Fundamentals Tutorial 12"

From Chilipedia
Jump to: navigation, search
(Video)
(Video)
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
== Video ==
 
== Video ==
 
 
The tutorial video is on YouTube [https://youtu.be/xcs2IEGVkCk here].
 
The tutorial video is on YouTube [https://youtu.be/xcs2IEGVkCk here].
 +
<div class="mw-collapsible mw-collapsed"><br />
 +
* What is a Vertex Shader (vs) and its position in the pipeline [https://youtu.be/xcs2IEGVkCk?t=0m20s 0:20]
 +
<div class="mw-collapsible-content">
 +
:* A vs takes in vertices of the geometries and applies transformations to them
 +
:* Our current pipeline function <code>ProcessVertices()</code> does this in the most basic form: it applies rotation and translation to move vertices of the mesh from object space to world space
 +
:* In this video, we will be making the vs configurable
 +
</div>
 +
* Code implementation walk-through [https://youtu.be/xcs2IEGVkCk?t=1m14s 1:14]
 +
:* <code>Pipeline.h</code> [https://youtu.be/xcs2IEGVkCk?t=1m14s 1:14]
 +
<div class="mw-collapsible-content">
 +
::- We apply a <code>std::transform()</code> on the vertices vector
 +
::- We create a new datatype <code>VSOut</code>, giving the vs the power to change the datatype of the output vertices
 +
::- Note: this can be through a typedef or by implementing a new output type
 +
::- Each vertex shader will define its output type
 +
</div>
 +
:* <code>Effect::VertexShader</code> [https://youtu.be/xcs2IEGVkCk?t=3m33s 3:33]
 +
:* <code>DefaultVertexShader.h</code> [https://youtu.be/xcs2IEGVkCk?t=4m06s 4:06]
 +
:* Scene definition [https://youtu.be/xcs2IEGVkCk?t=5m02s 5:02]
 +
* Demo: creating a wave effect [https://youtu.be/xcs2IEGVkCk?t=5m24s 5:24]
 +
:* <code>Plane.h</code> defines Tessellation of a plane object [https://youtu.be/xcs2IEGVkCk?t=6m28s 6:28]
 +
:* <code>WaveVertexTextureEffect.h</code> implements the sinusoid wave effect [https://youtu.be/xcs2IEGVkCk?t=7m21s 7:21]
 +
:* <code>VertexWaveScene.h</code> [https://youtu.be/xcs2IEGVkCk?t=9m48s 9:48]
 +
* Example where the vertex output type is different from the vertex input type [https://youtu.be/xcs2IEGVkCk?t=10m48s 10:48]
 +
<div class="mw-collapsible-content">
 +
:* Example effect: the color of the vertex is determined by its position
 +
:* The input vertex type only holds position as data member, we add color in the output data type <code>VSOut</code>
 +
:* You can procedurally add information to your vertices in the vs
 +
</div>
 +
</div>
  
 
== Downloads ==
 
== Downloads ==

Latest revision as of 21:08, 28 June 2020

The vertex shader is the one of the two original shaders introduced in Direct3D 8, and it is the only shader besides the pixel shader that must be provided before triangles can be rendered. It's kind of a big deal.

Video

The tutorial video is on YouTube here.


  • What is a Vertex Shader (vs) and its position in the pipeline 0:20
  • A vs takes in vertices of the geometries and applies transformations to them
  • Our current pipeline function ProcessVertices() does this in the most basic form: it applies rotation and translation to move vertices of the mesh from object space to world space
  • In this video, we will be making the vs configurable
  • Code implementation walk-through 1:14
- We apply a std::transform() on the vertices vector
- We create a new datatype VSOut, giving the vs the power to change the datatype of the output vertices
- Note: this can be through a typedef or by implementing a new output type
- Each vertex shader will define its output type
  • Effect::VertexShader 3:33
  • DefaultVertexShader.h 4:06
  • Scene definition 5:02
  • Demo: creating a wave effect 5:24
  • Plane.h defines Tessellation of a plane object 6:28
  • WaveVertexTextureEffect.h implements the sinusoid wave effect 7:21
  • VertexWaveScene.h 9:48
  • Example where the vertex output type is different from the vertex input type 10:48
  • Example effect: the color of the vertex is determined by its position
  • The input vertex type only holds position as data member, we add color in the output data type VSOut
  • You can procedurally add information to your vertices in the vs

Downloads

The GitHub repository for the tutorial code is here.

See also