Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Let’s talk WebGL
Search
Tomek Kopczuk
March 05, 2018
Programming
1
25
Let’s talk WebGL
Introduction to game development and three.js with Tomek Kopczuk, SwingDev’s CTO
Tomek Kopczuk
March 05, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
400
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
270
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
180
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
入門 AWS Amplify Gen2 / Introduction to AWS Amplify Gen2
genkiogasawara
1
330
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
0
680
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
190
Snowflakeで眠ったデータを起こそう!
estie
0
110
ゆるい個人開発のススメ
kuroppe1819
10
980
ONE WEDGE_company_guide
1wedge_one
0
460
Netty Chicago Java User Group 2024-04-17
sullis
0
170
ADRを一年運用してみた/adr_after_a_year
hanhan1978
7
2.3k
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
BBQ
matthewcrist
80
8.8k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.6k
Atom: Resistance is Futile
akmur
259
25k
Adopting Sorbet at Scale
ufuk
68
8.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Why Our Code Smells
bkeepers
PRO
331
56k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
17
1.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
Transcript
www.swing3d.io Let’s talk WebGL Introduction to game development and three.js
with Tomek Kopczuk, SwingDev’s CTO
Game Development is different • Render loop • Only 16ms
per frame • Soft Real Time System
16ms to rule them all • Actual drawing • Collisions
• Physics • Animations • AI • I/O
So - WebGL • OpenGL ES for <canvas> • Transcends
way beyond 3D!
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?
How does stuff get drawn? VBO Vertex Shader Rasterization Fragment
Shader
three.js - introduction • After today we’re going to be
able to do this
three.js - introduction • Scene • Camera • Renderer
three.js - cameras and projections • Orthographic • Perspective
Camera Demo
three.js - introduction • Geometry • Material • Object3D •
Light • Mesh
three.js - common geometries • BoxGeometry • CircleGeometry • ConeGeometry
• CylinderGeometry • PlaneGeometry • SphereGeometry
Demo 1 - bootstrap, skybox, ground
three.js - common materials • MeshBasicMaterial • MeshLambertMaterial • MeshPhongMaterial
• MeshPhysicalMaterial • MeshStandardMaterial • MeshToonMaterial • RawShaderMaterial
Demo 2 - cube and materials
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
three.js - vertex shader uniform mat4 projectionMatrix; uniform mat4 modelViewMatrix;
void main () { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }
three.js - fragment shader void main () { gl_FragColor =
vec4(0.5, 0.5, 0.5, 1.0); }
Demo 3 - cube with a shader
three.js - shaders - useful?
Demo 4 - cube with a dynamic shader
three.js - loading real assets • Group • OBJ Loader
• Texture Loader
Demo 5 - turret
three.js - loading real assets • Geometry • MeshStandardMaterial •
map • normalMap • aoMap • roughnessMap • metalnessMap • envMap • ModelView matrix
three.js - adding user interaction • Asynchronous to the render
loop • Raycasting
Demo 6 - moving turrets
Further reading • https://threejs.org/docs/index.html#manual/introduction/Creating- a-scene • https://threejs.org/examples/ • https://www.khronos.org/webgl/ •
https://www.opengl.org/sdk/tools/ShaderDesigner/
Thank you