Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Let’s talk WebGL

Let’s talk WebGL

Introduction to game development and three.js with Tomek Kopczuk, SwingDev’s CTO

Tomek Kopczuk

March 05, 2018
Tweet

Other Decks in Programming

Transcript

  1. 16ms to rule them all • Actual drawing • Collisions

    • Physics • Animations • AI • I/O
  2. Programmable Pipeline Vertex Buffer Objects Primitive Processing Vertex
 Shader Primitive

    Assembly Rasterizer Fragment Shader Depth
 Stencil Color Buffer Blend Dither Frame
 Buffer API Triangles/Lines/Points Vertices How does stuff get drawn?
  3. three.js - common geometries • BoxGeometry • CircleGeometry • ConeGeometry

    • CylinderGeometry • PlaneGeometry • SphereGeometry
  4. three.js - common materials • MeshBasicMaterial • MeshLambertMaterial • MeshPhongMaterial

    • MeshPhysicalMaterial • MeshStandardMaterial • MeshToonMaterial • RawShaderMaterial
  5. three.js - shaders • Vertex shader • Fragment shader Vertex


    Shader Uniforms Fragment Shader Frame
 Buffer Vertex Buffer Objects Varyings Attributes input input input output points to input
  6. three.js - vertex shader uniform mat4 projectionMatrix;
 uniform mat4 modelViewMatrix;

    void main () {
 gl_Position = 
 projectionMatrix * 
 modelViewMatrix *
 vec4(position, 1.0);
 }
  7. three.js - loading real assets • Geometry • MeshStandardMaterial •

    map • normalMap • aoMap • roughnessMap • metalnessMap • envMap • ModelView matrix