Difference between revisions of "3D Fundamentals Tutorial 2"
From Chilipedia
(→Video) |
(→Video) |
||
Line 16: | Line 16: | ||
* Calculating the length of a 3D vector (i.e., in R3) [https://youtu.be/HV1ZGyiY5C8?t=4m57s 4:57] | * Calculating the length of a 3D vector (i.e., in R3) [https://youtu.be/HV1ZGyiY5C8?t=4m57s 4:57] | ||
* The <code>Mat3</code> 3D Matrix class [https://youtu.be/HV1ZGyiY5C8?t=5m57s 5:57] | * The <code>Mat3</code> 3D Matrix class [https://youtu.be/HV1ZGyiY5C8?t=5m57s 5:57] | ||
− | * | + | * Choosing a coordinate system [https://youtu.be/HV1ZGyiY5C8?t=7m37s 7:37] |
− | :* | + | :* We choose a Left Handed coordinate system |
+ | :* And start with defining world space (=object space for now) and screen space | ||
+ | * Setting up world space [https://youtu.be/HV1ZGyiY5C8?t=10m08s 10:08] | ||
+ | :* We set the Origin (0,0,0) of world space in the middle of the screen | ||
+ | ::- This makes for better (easier) scaling | ||
+ | :* We will use NDC (Normalized Device Coordinates) | ||
+ | ::- Meaning: we don't use pixel values, but normalized values relative to screen size (e.g. x=1.0 means far right end of screen, x=-1.0 for far left end of screen | ||
+ | ::- Main advantage: become independent from screen size | ||
+ | ::- Note: Direct 3D and OpenGL use NDC | ||
Revision as of 05:53, 24 April 2020
In this video we lay the groundwork needed to represent and transform positions and 3D space, we define the relationship between our 3D space and the screen coordinates, and we setup a data structure to hold our test cube geometry.
Video
The tutorial video is on YouTube here.
- Fix an error in
Mat2.h
(vector * Matrix multiplication) 0:16 - Introducing 3D space 1:57
- Implementing the
Vec3
class 3:19
- Inherits from
Vec2
(z-component added) - Overload all operators for 3D
- Advantage of inheritence here: enables passing
Vec3
s into functions that acceptVecc2&
references
- Inherits from
- Calculating the length of a 3D vector (i.e., in R3) 4:57
- The
Mat3
3D Matrix class 5:57 - Choosing a coordinate system 7:37
- We choose a Left Handed coordinate system
- And start with defining world space (=object space for now) and screen space
- Setting up world space 10:08
- We set the Origin (0,0,0) of world space in the middle of the screen
- - This makes for better (easier) scaling
- We will use NDC (Normalized Device Coordinates)
- - Meaning: we don't use pixel values, but normalized values relative to screen size (e.g. x=1.0 means far right end of screen, x=-1.0 for far left end of screen
- - Main advantage: become independent from screen size
- - Note: Direct 3D and OpenGL use NDC
- ...
Downloads
The GitHub repository for the tutorial code is here.