SlideShare a Scribd company logo
INTRODUCTION TO 3D  AND SHADERS YOU CAN’T DRAW MONA LISA WITH A CPU
SELF. Victor Porof instanceof class  Programmer  extends  Geek +=  3D +=  Low-level stuff +=  iPhone  | iPod | iPad programmer +=  Part time student
PRODUCT – ABSTRACTION   ?
PRODUCT – ABSTRACTION = TECHNIQUE DirectX openGL ES 1.1; 2.0 HLSL GLSL Cg
WE’LL TALK ABOUT.. Super Mario What is DirectX | openGL | QuickDraw Mythbusters, CPU & GPU What happened since DirectX 7 | openGL 2.0 Picasso & DaVinci How 3D stuff works in general, and how 3D data is processed Vertices, Pixels, Matrices How does low level GPU programming taste like Language & syntax WebGL
 
WHAT IS DIRECTX | OPENGL | QUICKDRAW Application programming interfaces Game programming Data visualization Graphics Video Sound DirectX: Microsoft , in 1995 OpenGL: Silicon Graphics Inc. (SGI), in 199 9 QD3D: Apple, in 1995
SINCE DIRECTX 7 | OPENGL 2.0
PICASSO & DAVINCI     ?
HOW 3D STUFF WORKS IN GENERAL
HOW 3D STUFF WORKS IN GENERAL ..let’s simplify things (sort of)
HOW 3D STUFF WORKS IN GENERAL ..hopefully you got the idea (sort of)
HOW 3D DATA IS PROCESSED
VERTICES, PIXELS, MATRICES HLSL “ high level shading language” GLSL “ openGL shading language” “ Glslang” Cg “ C for graphics” SL
SHADING LANGUAGES EVOLUTION
LOW LEVEL GPU PROGRAMMING DEFINE  LUMINANCE = {0.299, 0.587, 0.114, 0.0};  TEX  H0, f[TEX0], TEX4, 2D;  TEX  H1, f[TEX2], TEX5, CUBE;  DP3X  H1.xyz, H1, LUMINANCE;  MULX  H0.w, H0.w, LUMINANCE.w;  MULX  H1.w, H1.x, H1.x;  MOVH  H2, f[TEX3].wxyz;  MULX  H1.w, H1.x, H1.w;  DP3X  H0.xyz, H2.xzyw, H0;  …
LANGUAGE AND SYNTAX //the vertex shader attribute vec3 vertPosition; attribute vec2 vertTexCoord; uniform mat4 mvMatrix; uniform mat4 projMatrix; varying vec2 texCoord; void main() { texCoord = vertTexCoord; gl_Position = projMatrix * mvMatrix * vec4(vertPosition, 1); }
LANGUAGE AND SYNTAX //the pixel (fragment) shader uniform vec4 tint; uniform sampler2D sampler; varying vec2 texCoord; void main() { gl_FragColor = tint * texture2D(sampler, texCoord); }
HOW 3D STUFF WORKS IN GENERAL ..remember this?
TRANSFORMATIONS //a very simple way to project 3D objects on a 2D screen uniform Transformation {  mat4 projection_matrix;  mat4 modelview_matrix; };  in vec3 vertex;  void main() {  gl_Position = projection_matrix * modelview_matrix *   vec4(vertex, 1.0);  }
WEBGL A context of the HTML 5 canvas Based on openGL ES 2.0 Brings 3D hardware accelerated graphics to the browser Javascript Engines: WebGLU GLGE C3DL Copperlicht SpiderGL SceneJS Processing.js O3D
?

More Related Content

PPT
Open gles
ODP
Basics
PPTX
Java script
PPT
Cryptography
PPT
Encryptolog y-1216310707267721-9
PDF
201707 SER332 Lecture10
PDF
201707 SER332 Lecture 09
PDF
Pharo VX
Open gles
Basics
Java script
Cryptography
Encryptolog y-1216310707267721-9
201707 SER332 Lecture10
201707 SER332 Lecture 09
Pharo VX

Viewers also liked (17)

PDF
De ce sa nu folosim Ruby On Rails?
PDF
Chameleon game engine
PDF
Firefox WebGL developer tools
PDF
Mini-Training: JS Graphical Libraries
PDF
Considerații privind cercetarea științifică
PDF
#undef IS_KING
PDF
Student User Experience in Web Design - sweb2010
PDF
Introducere in Vizualizarea Datelor cu HTML5 Canvas
PDF
FII la examinări
PPTX
3 in 1 - Student Volunteer and Employee
PDF
Cosmin Varlan: Stagii pe Bune 2011 la Facultatea de Informatica, UAIC
KEY
NoSQL in the context of Social Web
PDF
From virtual to augmented reality
PDF
Processing.js vs. three.js
PDF
Web brother is watching you
PDF
HTML5? HTML5!
PDF
Studentii iau altitudine. FII pe vf. Lenin (august 2011)
De ce sa nu folosim Ruby On Rails?
Chameleon game engine
Firefox WebGL developer tools
Mini-Training: JS Graphical Libraries
Considerații privind cercetarea științifică
#undef IS_KING
Student User Experience in Web Design - sweb2010
Introducere in Vizualizarea Datelor cu HTML5 Canvas
FII la examinări
3 in 1 - Student Volunteer and Employee
Cosmin Varlan: Stagii pe Bune 2011 la Facultatea de Informatica, UAIC
NoSQL in the context of Social Web
From virtual to augmented reality
Processing.js vs. three.js
Web brother is watching you
HTML5? HTML5!
Studentii iau altitudine. FII pe vf. Lenin (august 2011)
Ad

Similar to Introduction to 3D and shaders (20)

PDF
Computer Graphics - Lecture 01 - 3D Programming I
PPT
CS 354 Programmable Shading
PDF
Open gl
PPTX
OpenGL basics
PPT
Advanced Graphics Workshop - GFX2011
PPTX
OpenGL Shading Language
PPT
CS 354 Introduction
PPT
Hardware Shaders
PDF
Computer Graphics Programming Problem Solving And Visual Communication Dr Ste...
PDF
Gpu Programming With GPUImage and Metal
PPTX
What is OpenGL ?
PDF
Installing Games Sucks, Learn WebGL
PPT
OpenGL ES based UI Development on TI Platforms
PDF
lectureAll-OpenGL-complete-Guide-Tutorial.pdf
PPTX
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
PPT
Programmable Piplelines
PPT
GTC 2009 OpenGL Barthold
PPTX
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Computer Graphics - Lecture 01 - 3D Programming I
CS 354 Programmable Shading
Open gl
OpenGL basics
Advanced Graphics Workshop - GFX2011
OpenGL Shading Language
CS 354 Introduction
Hardware Shaders
Computer Graphics Programming Problem Solving And Visual Communication Dr Ste...
Gpu Programming With GPUImage and Metal
What is OpenGL ?
Installing Games Sucks, Learn WebGL
OpenGL ES based UI Development on TI Platforms
lectureAll-OpenGL-complete-Guide-Tutorial.pdf
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
Programmable Piplelines
GTC 2009 OpenGL Barthold
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Ad

More from Victor Porof (8)

PDF
Firefox developer tools
PDF
Js in the open
PDF
Javascript, Do you speak it!
PDF
Cityquest - Developing games for the mobile devices
PDF
Web3D - Semantic standards, WebGL, HCI
PPTX
Developing web apps using Java and the Play framework
PPTX
Beginners' guide to Ruby on Rails
PPTX
Introduction to the XNA framework
Firefox developer tools
Js in the open
Javascript, Do you speak it!
Cityquest - Developing games for the mobile devices
Web3D - Semantic standards, WebGL, HCI
Developing web apps using Java and the Play framework
Beginners' guide to Ruby on Rails
Introduction to the XNA framework

Introduction to 3D and shaders

  • 1. INTRODUCTION TO 3D AND SHADERS YOU CAN’T DRAW MONA LISA WITH A CPU
  • 2. SELF. Victor Porof instanceof class Programmer extends Geek += 3D += Low-level stuff += iPhone | iPod | iPad programmer += Part time student
  • 4. PRODUCT – ABSTRACTION = TECHNIQUE DirectX openGL ES 1.1; 2.0 HLSL GLSL Cg
  • 5. WE’LL TALK ABOUT.. Super Mario What is DirectX | openGL | QuickDraw Mythbusters, CPU & GPU What happened since DirectX 7 | openGL 2.0 Picasso & DaVinci How 3D stuff works in general, and how 3D data is processed Vertices, Pixels, Matrices How does low level GPU programming taste like Language & syntax WebGL
  • 6.  
  • 7. WHAT IS DIRECTX | OPENGL | QUICKDRAW Application programming interfaces Game programming Data visualization Graphics Video Sound DirectX: Microsoft , in 1995 OpenGL: Silicon Graphics Inc. (SGI), in 199 9 QD3D: Apple, in 1995
  • 8. SINCE DIRECTX 7 | OPENGL 2.0
  • 10. HOW 3D STUFF WORKS IN GENERAL
  • 11. HOW 3D STUFF WORKS IN GENERAL ..let’s simplify things (sort of)
  • 12. HOW 3D STUFF WORKS IN GENERAL ..hopefully you got the idea (sort of)
  • 13. HOW 3D DATA IS PROCESSED
  • 14. VERTICES, PIXELS, MATRICES HLSL “ high level shading language” GLSL “ openGL shading language” “ Glslang” Cg “ C for graphics” SL
  • 16. LOW LEVEL GPU PROGRAMMING DEFINE LUMINANCE = {0.299, 0.587, 0.114, 0.0}; TEX H0, f[TEX0], TEX4, 2D; TEX H1, f[TEX2], TEX5, CUBE; DP3X H1.xyz, H1, LUMINANCE; MULX H0.w, H0.w, LUMINANCE.w; MULX H1.w, H1.x, H1.x; MOVH H2, f[TEX3].wxyz; MULX H1.w, H1.x, H1.w; DP3X H0.xyz, H2.xzyw, H0; …
  • 17. LANGUAGE AND SYNTAX //the vertex shader attribute vec3 vertPosition; attribute vec2 vertTexCoord; uniform mat4 mvMatrix; uniform mat4 projMatrix; varying vec2 texCoord; void main() { texCoord = vertTexCoord; gl_Position = projMatrix * mvMatrix * vec4(vertPosition, 1); }
  • 18. LANGUAGE AND SYNTAX //the pixel (fragment) shader uniform vec4 tint; uniform sampler2D sampler; varying vec2 texCoord; void main() { gl_FragColor = tint * texture2D(sampler, texCoord); }
  • 19. HOW 3D STUFF WORKS IN GENERAL ..remember this?
  • 20. TRANSFORMATIONS //a very simple way to project 3D objects on a 2D screen uniform Transformation { mat4 projection_matrix; mat4 modelview_matrix; }; in vec3 vertex; void main() { gl_Position = projection_matrix * modelview_matrix * vec4(vertex, 1.0); }
  • 21. WEBGL A context of the HTML 5 canvas Based on openGL ES 2.0 Brings 3D hardware accelerated graphics to the browser Javascript Engines: WebGLU GLGE C3DL Copperlicht SpiderGL SceneJS Processing.js O3D
  • 22. ?