Difference between revisions of "3D Fundamentals Tutorial 6"

From Chilipedia
Jump to: navigation, search
(Video)
(Video)
Line 5: Line 5:
 
The tutorial video is on YouTube [https://www.youtube.com/watch?v=h_Aqol0oTs4 here].
 
The tutorial video is on YouTube [https://www.youtube.com/watch?v=h_Aqol0oTs4 here].
  
* Recap of our problem: trianles are always drawn in the same order [https://youtu.be/h_Aqol0oTs4?t=0m20s 0:20]
+
* Recap of our problem: triangles are always drawn in the same order [https://youtu.be/h_Aqol0oTs4?t=0m20s 0:20]
 +
* Solution: Back face culling [https://youtu.be/h_Aqol0oTs4?t=2m02s 2:02]
 +
:* Poor solution: painter's algoritm (sort the triangles back to front, draw front ones last)
 +
:* Better solution: never draw back facing triangles. For convex single objects front facing triangles will never overlap
 +
* Using a triangle's surface normal to determine its orientation [https://youtu.be/h_Aqol0oTs4?t=5m15s 5:15]
 +
:* Just the z-component of the face normal is not good enough
 +
:* Correct approach: take the viewing vector (v1) and the face normal direction (v2)
 +
:* (viewing vector: vector from focal point to any point on the triangle in world space)
 +
:* If their dot product is negative (opposide directions), the triangle's face is towards the focal point
  
 
== Downloads ==
 
== Downloads ==

Revision as of 23:33, 11 May 2020

Get rid of those dirty back-facers, we don't serve their kind here. Also, learn the new sex move that is taking New England by storm: the Bridgeport Shocker.

Video

The tutorial video is on YouTube here.

  • Recap of our problem: triangles are always drawn in the same order 0:20
  • Solution: Back face culling 2:02
  • Poor solution: painter's algoritm (sort the triangles back to front, draw front ones last)
  • Better solution: never draw back facing triangles. For convex single objects front facing triangles will never overlap
  • Using a triangle's surface normal to determine its orientation 5:15
  • Just the z-component of the face normal is not good enough
  • Correct approach: take the viewing vector (v1) and the face normal direction (v2)
  • (viewing vector: vector from focal point to any point on the triangle in world space)
  • If their dot product is negative (opposide directions), the triangle's face is towards the focal point

Downloads

The GitHub repository for the tutorial code is here.

See also