SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
The Day You 
Finally Use Algebra! 
Janie Clayton-Hasz
About Me
But math is hard! 
(Let’s go shopping!)
Math is hard. 
But math is fun too.
Demo
Normalized 
Coordinate 
Systems
Cartesian 
Coordinates
320 
480
320 
480 
or 
568
1 
1
(0,0) (1,0) 
(0,1) (1,1)
(0,0) (1,0) 
(0,1) (1,1)
(0,0) (1,0) 
(0,1) (1,1)
self.size.width 
self. 
size. 
height
- Colors, like the 
screen dimensions, 
are based on 
percentages rather 
than absolute 
values. 
- If you come from 
a graphic design 
background, you 
need to convert 
your 255 scale to 
percentages.
Algorithm Rosetta 
Stone
Rosetta Stone 
- Had the same text in 
Greek, demotic, and 
hieroglyphics. Was 
used to translate 
hieroglyphics 
- Going to do similar 
thing, but with math 
algorithms, plain 
English, and code
√-1 2ˆ3 Σ π
Algoritm 
Σ5 
i = 1 
4i
Plain English 
I have a starting value of one. 
I have an end value of five. 
I want to multiply each value 
by four and add them together.
var x = 0 
! 
for index in 1…5 { 
! 
x += (4 * index) 
! 
} 
Code
It’s All Greek to 
Me 
π 
Δ 
i 
θ 
Constant: 3.14159… 
Change between two values 
Square root of negative one 
Variable representing an angle
√-1 2ˆ3 Σ π 
…and it was delicious!
i 8 sum pi 
…and it was delicious!
Trigonometry
Triangles 
A shape with three sides where the 
angles add up to 180 degrees 
Everything in our world comes back 
to triangles 
The most stable shape 
Foundation of 3D graphics
Right Triangles
Pythagorean 
Theorem 
aˆ2 + bˆ2 = cˆ2
Triangle Formulas 
Tangent 
Sin 
Cosine 
Arctangent 
Arcsin 
Arccosine
Triangle Formulas
Triangle Formulas
Circle Formulas 
Circumference: 2πr 
Area: πrˆ2
So What Can We Do 
Knowing This? 
Change the direction a character is 
moving in 
Check to see if the user is hitting a 
target area on the screen 
Draw shapes and filters in specific 
configurations
Demo
Linear Algebra
What is Linear 
Algebra? 
Linear Algebra allows you to 
perform an action on many values 
at the same time. 
This action must be consistent 
across all values, such as multiplying 
every value by two.
What is Linear 
Algebra? 
Values are placed in an object 
called a matrix and the actions 
performed on the values are called 
transforms 
Linear algebra is optimized for 
parallel mathematical operations.
Data Types 
vec2, vec3, vec4: 2D, 3D, and 4D 
floating point vector objects. 
vec2: (x, y) 
vec3: (x, y, z) 
vec4: (r, g, b, a)
Data Types 
mat2, mat3, mat4: 2, 3, and 4 
element matrices. 
mat2: Holds a 2 X 2 number matrix 
mat3: Holds a 3 X 3 number matrix, 
used for 2D linear algebra 
mat4: Holds a 4 X 4 number matrix, 
used for 3D linear algebra
Enter the Matrix
Column 
1.0 1.0 1.0 0 
1.0 1.0 1.0 0 
1.0 1.0 1.0 0 
1.0 1.0 1.0 0 
Row
mat4 genericMatrix = mat4( 
! 
1.0, 1.0, 1.0, 1.0, 
1.0, 1.0, 1.0, 1.0, 
1.0, 1.0, 1.0, 1.0, 
0, 0, 0, 0 
Column 
); 
Row
vec4 firstColumn = vec4(1.0, 1.0, 1.0, 
1.0); 
vec4 secondColumn = vec4(1.0, 1.0, 1.0, 
1.0); 
vec4 thirdColumn = vec4(1.0, 1.0, 1.0, 
1.0); 
vec4 fouthColumn = vec4(0, 0, 0, 0); 
mat4 myMatrix = mat4( 
firstColumn, SecondColumn, 
thirdColumn, FourthColumn 
);
CGAffineTransform
Affine, Wha?? :( 
A transform is any function that 
alters the size, position, or rotation 
of an object on your screen. 
Four types: Identity, Translate, 
Rotation, and Scale. 
For a transform to be affine, the 
lines in your shape must be parallel.
CGAffine 
Transform Methods 
CGAffineTransformMakeRotation 
(GLFloat angle); 
CGAffineTransformMakeScale 
(CGFLoat sx, CGFloat sy); 
CGAffineTransformMakeTranslation 
(CGFloat tx, CGFloat ty);
struct CAAffineTransform { 
CGFloat a; 
GLFloat b; 
CGFloat c; 
CGFloat d; 
CGFloat tx; 
CGFloat ty 
}
new point x = a * x 
+ c * y + tx; 
new point y = b * x 
+ d * y + ty;
How Does This 
Work? 
For each point in your shape, the 
computer uses this calculation to 
figure out where the point should 
be. 
If you have a rectangle, this gets 
run four times: One for each point 
in your shape.
Refraction 
Fragment 
Shader 
Example
void main() 
{ 
highp vec2 textureCoordinateToUse = vec2(textureCoordinate.x, (textureCoordinate.y * 
aspectRatio + 0.5 - 0.5 * aspectRatio)); 
highp float distanceFromCenter = distance(center, textureCoordinateToUse); 
lowp float checkForPresenceWithinSphere = step(distanceFromCenter, radius); 
distanceFromCenter = distanceFromCenter / radius; 
highp float normalizedDepth = radius * sqrt(1.0 - distanceFromCenter * 
distanceFromCenter); 
highp vec3 sphereNormal = normalize(vec3(textureCoordinateToUse - center, 
normalizedDepth)); 
highp vec3 refractedVector = 2.0 * refract(vec3(0.0, 0.0, -1.0), sphereNormal, 
refractiveIndex); 
refractedVector.xy = -refractedVector.xy; 
highp vec3 finalSphereColor = texture2D(inputImageTexture, (refractedVector.xy + 1.0) * 
0.5).rgb; 
// Grazing angle lighting 
highp float lightingIntensity = 2.5 * (1.0 - pow(clamp(dot(ambientLightPosition, 
sphereNormal), 0.0, 1.0), 0.25)); 
finalSphereColor += lightingIntensity; 
// Specular lighting 
lightingIntensity = clamp(dot(normalize(lightPosition), sphereNormal), 0.0, 1.0); 
lightingIntensity = pow(lightingIntensity, 15.0); 
finalSphereColor += vec3(0.8, 0.8, 0.8) * lightingIntensity; 
gl_FragColor = vec4(finalSphereColor, 1.0) * checkForPresenceWithinSphere; 
}
highp vec2 textureCoordinateToUse = 
vec2(textureCoordinate.x, 
(textureCoordinate.y * aspectRatio + 
0.5 - 0.5 * aspectRatio));
highp float 
distanceFromCenter = 
distance(center, 
textureCoordinateToUse);
lowp float 
checkForPresenceWithinSphere 
= step(distanceFromCenter, 
radius);
distanceFromCenter = 
distanceFromCenter / 
radius;
highp float normalizedDepth = 
radius * sqrt(1.0 - 
distanceFromCenter * 
distanceFromCenter);
highp vec3 sphereNormal = 
normalize(vec3! 
(textureCoordinateToUse - 
center, normalizedDepth));
highp vec3 refractedVector = 
refract(vec3(0.0, 0.0, -1.0), ! 
sphereNormal, 
refractiveIndex);
gl_FragColor = 
texture2D(inputImageTexture, 
(refractedVector.xy + 1.0) * 0.5) 
* checkForPresenceWithinSphere;
The End

Weitere ähnliche Inhalte

Was ist angesagt?

Midterm 1
Midterm 1Midterm 1
Midterm 1IIUM
 
Newton divided difference interpolation
Newton divided difference interpolationNewton divided difference interpolation
Newton divided difference interpolationVISHAL DONGA
 
Applied numerical methods lec12
Applied numerical methods lec12Applied numerical methods lec12
Applied numerical methods lec12Yasser Ahmed
 
Bwm21403 mathematics iv assignments
Bwm21403 mathematics iv assignmentsBwm21403 mathematics iv assignments
Bwm21403 mathematics iv assignmentsAzalina Harun
 
Chapter 5 interpolation
Chapter 5 interpolationChapter 5 interpolation
Chapter 5 interpolationssuser53ee01
 
Applied numerical methods lec9
Applied numerical methods lec9Applied numerical methods lec9
Applied numerical methods lec9Yasser Ahmed
 
Bresenham Line Drawing Algorithm
Bresenham Line Drawing AlgorithmBresenham Line Drawing Algorithm
Bresenham Line Drawing AlgorithmMahesh Kodituwakku
 
Integral Calculus
Integral CalculusIntegral Calculus
Integral Calculusitutor
 
L4 one sided limits limits at infinity
L4 one sided limits limits at infinityL4 one sided limits limits at infinity
L4 one sided limits limits at infinityJames Tagara
 
5.2 using intercepts
5.2 using intercepts5.2 using intercepts
5.2 using interceptscoolhanddav
 
3.2 Synthetic Division
3.2 Synthetic Division3.2 Synthetic Division
3.2 Synthetic Divisionsmiller5
 

Was ist angesagt? (17)

Assignment5
Assignment5Assignment5
Assignment5
 
1552 limits graphically and nume
1552 limits graphically and nume1552 limits graphically and nume
1552 limits graphically and nume
 
Midterm 1
Midterm 1Midterm 1
Midterm 1
 
Newton divided difference interpolation
Newton divided difference interpolationNewton divided difference interpolation
Newton divided difference interpolation
 
Applied numerical methods lec12
Applied numerical methods lec12Applied numerical methods lec12
Applied numerical methods lec12
 
Bwm21403 mathematics iv assignments
Bwm21403 mathematics iv assignmentsBwm21403 mathematics iv assignments
Bwm21403 mathematics iv assignments
 
Chapter 5 interpolation
Chapter 5 interpolationChapter 5 interpolation
Chapter 5 interpolation
 
Applied numerical methods lec9
Applied numerical methods lec9Applied numerical methods lec9
Applied numerical methods lec9
 
Lagrange’s interpolation formula
Lagrange’s interpolation formulaLagrange’s interpolation formula
Lagrange’s interpolation formula
 
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
 
Bresenham Line Drawing Algorithm
Bresenham Line Drawing AlgorithmBresenham Line Drawing Algorithm
Bresenham Line Drawing Algorithm
 
Integral Calculus
Integral CalculusIntegral Calculus
Integral Calculus
 
Interpolation
InterpolationInterpolation
Interpolation
 
Statistics Assignment Help
Statistics Assignment HelpStatistics Assignment Help
Statistics Assignment Help
 
L4 one sided limits limits at infinity
L4 one sided limits limits at infinityL4 one sided limits limits at infinity
L4 one sided limits limits at infinity
 
5.2 using intercepts
5.2 using intercepts5.2 using intercepts
5.2 using intercepts
 
3.2 Synthetic Division
3.2 Synthetic Division3.2 Synthetic Division
3.2 Synthetic Division
 

Andere mochten auch

Mat 5th_UD4_3D shapes
Mat 5th_UD4_3D shapesMat 5th_UD4_3D shapes
Mat 5th_UD4_3D shapesTRMaria
 
Qwizdom year 7 maths - find the missing number
Qwizdom   year 7 maths  - find the missing numberQwizdom   year 7 maths  - find the missing number
Qwizdom year 7 maths - find the missing numberQwizdom UK
 
Mat _6th_UD4_3D Shapes
Mat _6th_UD4_3D ShapesMat _6th_UD4_3D Shapes
Mat _6th_UD4_3D ShapesTRMaria
 
Kungfu math p2 slide8 (2d and 3d figures)
Kungfu math p2 slide8 (2d and 3d figures)Kungfu math p2 slide8 (2d and 3d figures)
Kungfu math p2 slide8 (2d and 3d figures)kungfumath
 
3D Figures- volume and surface area
3D Figures- volume and surface area3D Figures- volume and surface area
3D Figures- volume and surface areaRenegarmath
 
LinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-PresentedLinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-PresentedSlideShare
 

Andere mochten auch (6)

Mat 5th_UD4_3D shapes
Mat 5th_UD4_3D shapesMat 5th_UD4_3D shapes
Mat 5th_UD4_3D shapes
 
Qwizdom year 7 maths - find the missing number
Qwizdom   year 7 maths  - find the missing numberQwizdom   year 7 maths  - find the missing number
Qwizdom year 7 maths - find the missing number
 
Mat _6th_UD4_3D Shapes
Mat _6th_UD4_3D ShapesMat _6th_UD4_3D Shapes
Mat _6th_UD4_3D Shapes
 
Kungfu math p2 slide8 (2d and 3d figures)
Kungfu math p2 slide8 (2d and 3d figures)Kungfu math p2 slide8 (2d and 3d figures)
Kungfu math p2 slide8 (2d and 3d figures)
 
3D Figures- volume and surface area
3D Figures- volume and surface area3D Figures- volume and surface area
3D Figures- volume and surface area
 
LinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-PresentedLinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-Presented
 

Ähnlich wie 3D Math Without Presenter Notes

3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf ChicagoJanie Clayton
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programmingDamian T. Gordon
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1aravindangc
 
Linear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraLinear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraMUHAMMADUSMAN93058
 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptxsaadhaq6
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmKALAIRANJANI21
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmKALAIRANJANI21
 
Rational Functions
Rational FunctionsRational Functions
Rational FunctionsJazz0614
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicingElsayed Hemayed
 
Full n final prjct
Full n final prjctFull n final prjct
Full n final prjctpunu2602
 
Module 2 Lesson 2 Notes
Module 2 Lesson 2 NotesModule 2 Lesson 2 Notes
Module 2 Lesson 2 Notestoni dimella
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptxssuser255bf1
 

Ähnlich wie 3D Math Without Presenter Notes (20)

3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago
 
Lr4 math cad
Lr4 math cadLr4 math cad
Lr4 math cad
 
Lec3
Lec3Lec3
Lec3
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
Linear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraLinear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear Algebra
 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithm
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithm
 
Rational Functions
Rational FunctionsRational Functions
Rational Functions
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Primitives
PrimitivesPrimitives
Primitives
 
Mit6 094 iap10_lec03
Mit6 094 iap10_lec03Mit6 094 iap10_lec03
Mit6 094 iap10_lec03
 
bobok
bobokbobok
bobok
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicing
 
Full n final prjct
Full n final prjctFull n final prjct
Full n final prjct
 
Module 2 Lesson 2 Notes
Module 2 Lesson 2 NotesModule 2 Lesson 2 Notes
Module 2 Lesson 2 Notes
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx
 
1.2 matlab numerical data
1.2  matlab numerical data1.2  matlab numerical data
1.2 matlab numerical data
 

Mehr von Janie Clayton

Beyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design AestheticBeyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design AestheticJanie Clayton
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015Janie Clayton
 
GPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaGPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaJanie Clayton
 
GPU Programming 360iDev
GPU Programming 360iDevGPU Programming 360iDev
GPU Programming 360iDevJanie Clayton
 
Gpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalGpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalJanie Clayton
 

Mehr von Janie Clayton (8)

Robots in Swift
Robots in SwiftRobots in Swift
Robots in Swift
 
Beyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design AestheticBeyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design Aesthetic
 
Thinking In Swift
Thinking In SwiftThinking In Swift
Thinking In Swift
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015
 
GPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaGPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf Atlanta
 
GPU Programming 360iDev
GPU Programming 360iDevGPU Programming 360iDev
GPU Programming 360iDev
 
Bug Hunting Safari
Bug Hunting SafariBug Hunting Safari
Bug Hunting Safari
 
Gpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalGpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and Metal
 

Kürzlich hochgeladen

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

3D Math Without Presenter Notes

  • 1. The Day You Finally Use Algebra! Janie Clayton-Hasz
  • 3. But math is hard! (Let’s go shopping!)
  • 4. Math is hard. But math is fun too.
  • 10.
  • 11. 1 1
  • 16. - Colors, like the screen dimensions, are based on percentages rather than absolute values. - If you come from a graphic design background, you need to convert your 255 scale to percentages.
  • 18. Rosetta Stone - Had the same text in Greek, demotic, and hieroglyphics. Was used to translate hieroglyphics - Going to do similar thing, but with math algorithms, plain English, and code
  • 20. Algoritm Σ5 i = 1 4i
  • 21. Plain English I have a starting value of one. I have an end value of five. I want to multiply each value by four and add them together.
  • 22. var x = 0 ! for index in 1…5 { ! x += (4 * index) ! } Code
  • 23. It’s All Greek to Me π Δ i θ Constant: 3.14159… Change between two values Square root of negative one Variable representing an angle
  • 24. √-1 2ˆ3 Σ π …and it was delicious!
  • 25. i 8 sum pi …and it was delicious!
  • 27. Triangles A shape with three sides where the angles add up to 180 degrees Everything in our world comes back to triangles The most stable shape Foundation of 3D graphics
  • 29. Pythagorean Theorem aˆ2 + bˆ2 = cˆ2
  • 30. Triangle Formulas Tangent Sin Cosine Arctangent Arcsin Arccosine
  • 33. Circle Formulas Circumference: 2πr Area: πrˆ2
  • 34. So What Can We Do Knowing This? Change the direction a character is moving in Check to see if the user is hitting a target area on the screen Draw shapes and filters in specific configurations
  • 35. Demo
  • 37. What is Linear Algebra? Linear Algebra allows you to perform an action on many values at the same time. This action must be consistent across all values, such as multiplying every value by two.
  • 38. What is Linear Algebra? Values are placed in an object called a matrix and the actions performed on the values are called transforms Linear algebra is optimized for parallel mathematical operations.
  • 39. Data Types vec2, vec3, vec4: 2D, 3D, and 4D floating point vector objects. vec2: (x, y) vec3: (x, y, z) vec4: (r, g, b, a)
  • 40. Data Types mat2, mat3, mat4: 2, 3, and 4 element matrices. mat2: Holds a 2 X 2 number matrix mat3: Holds a 3 X 3 number matrix, used for 2D linear algebra mat4: Holds a 4 X 4 number matrix, used for 3D linear algebra
  • 42. Column 1.0 1.0 1.0 0 1.0 1.0 1.0 0 1.0 1.0 1.0 0 1.0 1.0 1.0 0 Row
  • 43. mat4 genericMatrix = mat4( ! 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0, 0, 0, 0 Column ); Row
  • 44. vec4 firstColumn = vec4(1.0, 1.0, 1.0, 1.0); vec4 secondColumn = vec4(1.0, 1.0, 1.0, 1.0); vec4 thirdColumn = vec4(1.0, 1.0, 1.0, 1.0); vec4 fouthColumn = vec4(0, 0, 0, 0); mat4 myMatrix = mat4( firstColumn, SecondColumn, thirdColumn, FourthColumn );
  • 46. Affine, Wha?? :( A transform is any function that alters the size, position, or rotation of an object on your screen. Four types: Identity, Translate, Rotation, and Scale. For a transform to be affine, the lines in your shape must be parallel.
  • 47. CGAffine Transform Methods CGAffineTransformMakeRotation (GLFloat angle); CGAffineTransformMakeScale (CGFLoat sx, CGFloat sy); CGAffineTransformMakeTranslation (CGFloat tx, CGFloat ty);
  • 48. struct CAAffineTransform { CGFloat a; GLFloat b; CGFloat c; CGFloat d; CGFloat tx; CGFloat ty }
  • 49. new point x = a * x + c * y + tx; new point y = b * x + d * y + ty;
  • 50. How Does This Work? For each point in your shape, the computer uses this calculation to figure out where the point should be. If you have a rectangle, this gets run four times: One for each point in your shape.
  • 52. void main() { highp vec2 textureCoordinateToUse = vec2(textureCoordinate.x, (textureCoordinate.y * aspectRatio + 0.5 - 0.5 * aspectRatio)); highp float distanceFromCenter = distance(center, textureCoordinateToUse); lowp float checkForPresenceWithinSphere = step(distanceFromCenter, radius); distanceFromCenter = distanceFromCenter / radius; highp float normalizedDepth = radius * sqrt(1.0 - distanceFromCenter * distanceFromCenter); highp vec3 sphereNormal = normalize(vec3(textureCoordinateToUse - center, normalizedDepth)); highp vec3 refractedVector = 2.0 * refract(vec3(0.0, 0.0, -1.0), sphereNormal, refractiveIndex); refractedVector.xy = -refractedVector.xy; highp vec3 finalSphereColor = texture2D(inputImageTexture, (refractedVector.xy + 1.0) * 0.5).rgb; // Grazing angle lighting highp float lightingIntensity = 2.5 * (1.0 - pow(clamp(dot(ambientLightPosition, sphereNormal), 0.0, 1.0), 0.25)); finalSphereColor += lightingIntensity; // Specular lighting lightingIntensity = clamp(dot(normalize(lightPosition), sphereNormal), 0.0, 1.0); lightingIntensity = pow(lightingIntensity, 15.0); finalSphereColor += vec3(0.8, 0.8, 0.8) * lightingIntensity; gl_FragColor = vec4(finalSphereColor, 1.0) * checkForPresenceWithinSphere; }
  • 53. highp vec2 textureCoordinateToUse = vec2(textureCoordinate.x, (textureCoordinate.y * aspectRatio + 0.5 - 0.5 * aspectRatio));
  • 54. highp float distanceFromCenter = distance(center, textureCoordinateToUse);
  • 55. lowp float checkForPresenceWithinSphere = step(distanceFromCenter, radius);
  • 57. highp float normalizedDepth = radius * sqrt(1.0 - distanceFromCenter * distanceFromCenter);
  • 58. highp vec3 sphereNormal = normalize(vec3! (textureCoordinateToUse - center, normalizedDepth));
  • 59. highp vec3 refractedVector = refract(vec3(0.0, 0.0, -1.0), ! sphereNormal, refractiveIndex);
  • 60. gl_FragColor = texture2D(inputImageTexture, (refractedVector.xy + 1.0) * 0.5) * checkForPresenceWithinSphere;
  • 61.
  • 62.
  • 63.