SlideShare una empresa de Scribd logo
1 de 53
Descargar para leer sin conexión
© Daniel Freeman 2013
Stage3D
and AGAL
HFUG mix May 18
Saturday, 18 May 2013
• What is Stage3D ?
• Principles of 3D graphics
• Introduction to AGAL
• Shader Examples
• Extrusion and Lathes
Saturday, 18 May 2013
What is Stage3D ?
Saturday, 18 May 2013
“9 out of 10 top Facebook games are delivered
using Flash Player.
The biggest game networks in the world, like
DNA, GREE, and Tencent, deliver their games
with Flash technology.
The iOS App Store,Android Market, and
Amazon Appstore feature best-selling, #1
games built with Flash technologies.”
http://gaming.adobe.com/whyflash/
Saturday, 18 May 2013
Stage3D
Open GL
Mac
Stage3D
DirectX
Windows
Stage3D
Open GL ES
Mobile
Stage3D
SwiftShader
No GPU
Ubiquitous
Support for older hardware (Intel GMA)
Saturday, 18 May 2013
Low Level
mov ft3, v1
sub ft0.xy, v0.xy, fc4.xx
sub ft0.z, fc4.x, v2.x
abs ft1.xy, ft0.xy
sub ft1.xy, ft1.xy, ft0.zz
mul ft2.xy, ft1.xy, ft1.xy
add ft2.x, ft2.x, ft2.y
sqt ft2.x, ft2.x
add ft2.z, fc4.w, v2.x
sub ft2.z, ft2.z, ft2.x
pow ft3.w, ft2.z, fc4.z
sat ft3.w, ft3.w
mov oc, ft3
Saturday, 18 May 2013
Principles of 3D
Graphics
Saturday, 18 May 2013
-x +x
-y
+y
+z
-z
{x,y,z}
origin
vertex
Vertices
Saturday, 18 May 2013
-x +x
-y
+y
+z
-z
origin
triangle
Triangles
Saturday, 18 May 2013
3D Meshes
Saturday, 18 May 2013
winding / backface culling
Saturday, 18 May 2013
depth buffering
Saturday, 18 May 2013
Saturday, 18 May 2013
Saturday, 18 May 2013
z = 0
z = 1
-1 +1
-1
+1
2d
2d
-1 +1
-1
+1
World
Coordinates
Stage
Coordinates
Saturday, 18 May 2013
Introduction to AGAL
Saturday, 18 May 2013
Vertex Shader
Triangle
Assembly
Viewport
Clipping
transformed
vertices
triangle
stream
Rasteriser
Fragment
Shader
Frame
Buffer
fragment
stream
pixel
stream
Programmable
indicesvertices
textures
Saturday, 18 May 2013
Versatile
VertexShader FragmentShader
v0-v7
Interpolated
Registers
Vertex
shader runs
once per
vertex
Fragment
shader runs
once per
fragment
Saturday, 18 May 2013
Registers
va0-va7 Attribute Registers
vc0-vc127 Constant Registers
fc0-fc127 Constant Registers
fs0-fs7 Sampler Registers
v0-v7 Varying Registers
op Output Point
oc Output Colour
Saturday, 18 May 2013
VertexShader
FragmentShader
op
oc
v0-v7
vc0-vc127
fc0-fc127
(Interpolated)
va0-va7
fs0-fs7
vt0-vt7
ft0-ft7
Registers
Saturday, 18 May 2013
add v0, va0, va2
sub v0, va0, va2
mul v0, va0, va2
div v0, va0, va2
m44 v0, va0, vc0
Saturday, 18 May 2013
pow ft2.x, ft0.y, fc0.w
mul ft2.xyz, ft0.xxy, fc0.xxx
x y z w
Saturday, 18 May 2013
mul ft2.xyz, ft0.xxy, fc0.xxx
ft2.x = ft0.x * fc0.x
ft2.y = ft0.x * fc0.x
ft2.z = ft0.y * fc0.x
x y z w
Saturday, 18 May 2013
Saturday, 18 May 2013
Shader Examples
Saturday, 18 May 2013
Example 1 : Solid Colour
GreenSquare1
Saturday, 18 May 2013
protected static const VERTICES:Vector.<Number> =
	 	 	
	 	 	 Vector.<Number> ([
	 	 	 	 //	 X,	 	 Y,	 	 Z
	 	 	 	 -0.5,	 -0.5,	 0.0,
	 	 	 	 0.5,	 -0.5,	 0.0,
	 	 	 	 0.5,	 0.5,	 0.0,
	 	 	 	 -0.5,	 0.5,	 0.0,
	 	 	 ]);
	 	
	 	 protected static const N:int = 3;
	 	
	 	 protected static const INDICES:Vector.<uint> = Vector.<uint> ([ 0, 1, 2,	 0, 2, 3 ]);
3
(-0.5, -0.5, 0)
(-0.5, 0.5, 0)
(0.5, -0.5, 0)
(0.5, 0.5, 0)
0 1
2
0 1
2
0
23
Saturday, 18 May 2013
vertex shader
mov op, va0 output point
fragment shader
mov oc, fc0 output colour
_context3D.setProgramConstantsFromVector(
Context3DProgramType.FRAGMENT, 0, // fc0
Vector.<Number>([ 1.0, 0.0, 0.0, 1.0])	 // = Red
);
Saturday, 18 May 2013
Example 2 : Gradient Fill
GreenSquare3
Saturday, 18 May 2013
protected static const VERTICES:Vector.<Number> =
	 	 	
	 	 	 Vector.<Number> ([
	 	 	 //	 X,	 	 Y,	 	 Z,	 	 r,	 g,	 b
	 	 	 	 -0.5,	 -0.5,	 0.0,	 0,	 1,	 0,
	 	 	 	 0.5,	 -0.5,	 0.0,	 1,	 0,	 0,
	 	 	 	 0.5,	 0.5,	 0.0,	 1,	 1,	 1,
	 	 	 	 -0.5,	 0.5,	 0.0,	 0,	 0,	 1,
	 	 	 ]);
	 	
	 	 protected static const N:int = 6;
	 	
	 	 protected static const INDICES:Vector.<uint> = Vector.<uint> ([ 0, 1, 2,	 0, 2, 3 ]);
3
(-0.5, -0.5, 0)
(-0.5, 0.5, 0)
(0.5, -0.5, 0)
(0.5, 0.5, 0)
0 1
2
0 1
2
0
23
Saturday, 18 May 2013
vertex shader
mov op, va0 output point
mov v0, va1 interpolate colour
fragment shader
mov oc, v0 output colour
VertexShader FragmentShader
v0-v7
Interpolated
Registers
Saturday, 18 May 2013
Example 3 : Rotation
GreenSquare4
Saturday, 18 May 2013
vertex shader
m44 op, va0, vc0 transform
fragment shader
mov oc, fc0 output colour
_transform.appendRotation( 2.0, Vector3D.Z_AXIS );
_context3D.setProgramConstantsFromMatrix(
Context3DProgramType.VERTEX, 0, //vc0
_transform, true
);
Saturday, 18 May 2013
Example 4 : Gradient Cube
Flash3DExperiment5
Saturday, 18 May 2013
protected static const VERTICES:Vector.<Number> =
	 	 	
	 	 	 Vector.<Number> ([
	 	 	 //	 X,	 	 Y,	 	 Z,	 	 r,	 g,	 b
	 	 	 	 -0.5,	 -0.5,	 0.5,	 0,	 1,	 0,
	 	 	 	 0.5,	 -0.5,	 0.5,	 1,	 0,	 0,
	 	 	 	 0.5,	 0.5,	 0.5,	 1,	 1,	 1,
	 	 	 	 -0.5,	 0.5,	 0.5,	 0,	 0,	 1,
	 	 	 	
	 	 	 	 -0.5,	 -0.5,	 -0.5,	 0,	 1,	 0,
	 	 	 	 0.5,	 -0.5,	 -0.5,	 1,	 0,	 0,
	 	 	 	 0.5,	 0.5,	 -0.5,	 1,	 1,	 1,
	 	 	 	 -0.5,	 0.5,	 -0.5,	 0,	 0,	 1,
	 	 	 ]);
	 	
protected static const N:int = 6;
	 	
protected static const INDICES:Vector.<uint> = Vector.<uint> (
[ 0, 1, 2,	 0, 2, 3, 4, 6, 5,	 4, 7, 6,
	 	 	 	 	 0, 4, 5, 0, 5, 1, 1, 5, 6, 1, 6, 2,
	 	 2, 6, 7, 2, 7, 3, 3, 7, 4, 3, 4, 0
]);
Saturday, 18 May 2013
vertex shader
m44 op, va0, vc0 transform
mov v0, va1 interpolate
fragment shader
mov oc, v0 output colour
_projectionMatrix.perspectiveFieldOfViewLH(
45.0*Math.PI/180,
stage.stageWidth/stage.stageHeight,
0.1,1000.0
);
Saturday, 18 May 2013
Example 5 :Texture Cube
Flash3DExperiment3
Flash3DExperiment3a
Saturday, 18 May 2013
protected static const VERTICES:Vector.<Number> =
	 	 	
	 	 	 Vector.<Number> ([
	 	 	 //	X,		 Y,	 	 Z,		 u,	 v,
	 	 	 	 -1.0,	 -1.0,	 -1.0,	 0,	 0,
	 	 1.0, -1.0,	 -1.0,	 0,	 1,
	 	 	 	 1.0,	 1.0, -1.0,	 1,	 1,
	 	 	 	 -1.0,	 1.0,	 -1.0,	 1,	 0, etc...etc..
3
0 1
2
u
v
0 1
1
VertexShader FragmentShader
Interpolated
Saturday, 18 May 2013
vertex shader
m44 op, va0, vc0 transform
mov v0, va1 interpolate uv
fragment shader
tex ft0, v0, fs0 <2d,linear,nomip>
mov oc, ft0 output fragment
_projectionMatrix.perspectiveFieldOfViewLH(
45.0*Math.PI/180,
stage.stageWidth/stage.stageHeight,
0.1,1000.0
);
Saturday, 18 May 2013
Example 6 : Light Source
Flash3DExperiment7a
Saturday, 18 May 2013
protected static const VERTICES:Vector.<Number> =
	 	 	
	 	 	 Vector.<Number> ([
	 	 	 //	 X,	 	 Y,	 	 Z,	 	 nX,		 nY,		 nZ
	 	 	 	 -1.0,	 -1.0,	 -1.0,	 0,	 	 0,	 	 -1.0,
	 	 	 	 1.0,	 -1.0,	 -1.0,	 0,	 	 0,	 	 -1.0,
	 	 	 	 1.0,	 1.0,	 -1.0,	 0,	 	 0,	 	 -1.0,
	 	 	 	 -1.0,	 1.0,	 -1.0,	 0,	 	 0,	 	 -1.0, etc...etc...
normal
Saturday, 18 May 2013
vertex shader
m44 op, va0, vc0 transform
m44 v0, va1, vc0 normal
fragment shader
nrm ft0.xzy, v0 normalise
mov ft0.w, fc0.w
dp3 ft0, ft0, fc1 dot product
sat ft0, ft0 clamp
mul oc, ft0, fc0 multiply colour
	 	 _context3D.setProgramConstantsFromVector(
Context3DProgramType.FRAGMENT, 0, Vector.<Number>([ 0.5, 0.5, 0.5, 1.0 ]) );
	 	 _context3D.setProgramConstantsFromVector(
Context3DProgramType.FRAGMENT, 1, Vector.<Number>([ X, Y, Z, 1.0 ]) );
Saturday, 18 May 2013
Example 7 : Phong Shader
Flash3DExperimentA
Saturday, 18 May 2013
interpolated
normals
normal
Saturday, 18 May 2013
A
B
A • B = |A| |B| Cos
A is Half Angle
B is Normal
( A • B )
n
n = 1 n = 50n = 5
= 0
Saturday, 18 May 2013
vertex shader
m44 op, va0, vc0 transform
m44 v0, va1, vc4 normal
fragment shader
nrm ft0.xyz, v0 normalise normal
mov ft0.w, fc0.w set w to 1
dp3 ft0.x, ft0, fc0 dot product
sat ft0.x, ft0.x clamp
pow ft1.x, ft0.x, fc3.w dot product to power
mul ft2.xyz, fc2.xyz, ft0.xxx diffuse colour
add ft2.xyz, fc1.xyz, ft2.xyz add ambient colour
mul ft3.xyz, fc3.xyz, ft1.xxx specular colour
add oc, ft2.xyz, ft3.xyz 	 	 combine and output
fc0 Half Angle Vector fc1 Ambient Colour
fc2 Diffuse Colour fc3 Specular Colour
Saturday, 18 May 2013
Example 8 :AGAL Animation
Flash3DExperimentE
Saturday, 18 May 2013
AGAL Animation
• Advantageous to animate vertices in AGAL
• AS3 is slow. AGAL is fast.
• Manipulation of vertices in AS3 is slow
• Computing a transformation matrix is slow
• Better to interpolate vertices in AGAL
Saturday, 18 May 2013
AGAL Animation
ManipulateVertices
where u = 1 and v = 1
Saturday, 18 May 2013
vertex shader
mov v1, va1 		 	 	 	 	 // interpolate uv	 	
m44 vt0, va0, vc0		 	 	 // translate vertex
m44 vt1, va0, vc4		 	 	 // translate normal
mov v0, vt1	 	 	 	 	 // interpolate normal
mul vt1.xyz, vc8.xxx, vt1.xyz 	 // multiply t by normal
mul vt2.x, va1.x, va1.y 	 	 	 // multiply u by v
// if ( u==1 && v==1)
mul vt1.xyz, vt2.xxx, vt1.xyz // push vertex out
add op, vt0, vt1 // add
va0 Vertices (Normals) va1 U-V
vc0 transform matrix vc1 rotation transform
vc8.x interpolation
Saturday, 18 May 2013
Extrude and Lathe
Saturday, 18 May 2013
Lathe
Extrude
Saturday, 18 May 2013
Questions
Saturday, 18 May 2013

Más contenido relacionado

La actualidad más candente

MLIP - Chapter 4 - Image classification and CNNs
MLIP - Chapter 4 - Image classification and CNNsMLIP - Chapter 4 - Image classification and CNNs
MLIP - Chapter 4 - Image classification and CNNsCharles Deledalle
 
Solution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDMSolution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDMSyeilendra Pramuditya
 
Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)anithabalaprabhu
 
Distilling Free-Form Natural Laws from Experimental Data
Distilling Free-Form Natural Laws from Experimental DataDistilling Free-Form Natural Laws from Experimental Data
Distilling Free-Form Natural Laws from Experimental Dataswissnex San Francisco
 
OOP for Hardware Verification--Demystified!
OOP for Hardware Verification--Demystified! OOP for Hardware Verification--Demystified!
OOP for Hardware Verification--Demystified! DVClub
 
Evaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and CloudEvaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and CloudThe Linux Foundation
 
Graph convolutional networks in apache spark
Graph convolutional networks in apache sparkGraph convolutional networks in apache spark
Graph convolutional networks in apache sparkEmiliano Martinez Sanchez
 
Computational Linguistics week 5
Computational Linguistics  week 5Computational Linguistics  week 5
Computational Linguistics week 5Mark Chang
 
CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10fungfung Chen
 
NTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsNTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsMark Chang
 
The Enchant.js Animation Engine in 5 Minutes
The Enchant.js Animation Engine in 5 MinutesThe Enchant.js Animation Engine in 5 Minutes
The Enchant.js Animation Engine in 5 MinutesBrandon McInnis
 
CFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAMCFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAMFumiya Nozaki
 

La actualidad más candente (19)

MLIP - Chapter 4 - Image classification and CNNs
MLIP - Chapter 4 - Image classification and CNNsMLIP - Chapter 4 - Image classification and CNNs
MLIP - Chapter 4 - Image classification and CNNs
 
Quality Python Homework Help
Quality Python Homework HelpQuality Python Homework Help
Quality Python Homework Help
 
Solution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDMSolution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDM
 
06 Arithmetic 1
06 Arithmetic 106 Arithmetic 1
06 Arithmetic 1
 
Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)
 
Distilling Free-Form Natural Laws from Experimental Data
Distilling Free-Form Natural Laws from Experimental DataDistilling Free-Form Natural Laws from Experimental Data
Distilling Free-Form Natural Laws from Experimental Data
 
OOP for Hardware Verification--Demystified!
OOP for Hardware Verification--Demystified! OOP for Hardware Verification--Demystified!
OOP for Hardware Verification--Demystified!
 
Bessel functionsoffractionalorder1
Bessel functionsoffractionalorder1Bessel functionsoffractionalorder1
Bessel functionsoffractionalorder1
 
Evaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and CloudEvaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and Cloud
 
10 simulation
10 simulation10 simulation
10 simulation
 
Graph convolutional networks in apache spark
Graph convolutional networks in apache sparkGraph convolutional networks in apache spark
Graph convolutional networks in apache spark
 
Computational Linguistics week 5
Computational Linguistics  week 5Computational Linguistics  week 5
Computational Linguistics week 5
 
CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10
 
NTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsNTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANs
 
program logbook 2
program logbook 2program logbook 2
program logbook 2
 
Suppression enhancement
Suppression enhancementSuppression enhancement
Suppression enhancement
 
The Enchant.js Animation Engine in 5 Minutes
The Enchant.js Animation Engine in 5 MinutesThe Enchant.js Animation Engine in 5 Minutes
The Enchant.js Animation Engine in 5 Minutes
 
CFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAMCFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAM
 
Notes
NotesNotes
Notes
 

Destacado

What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great InfographicsSlideShare
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShareKapost
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation OptimizationOneupweb
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareEmpowered Presentations
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingContent Marketing Institute
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 

Destacado (7)

What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 

Similar a Stage3D and AGAL

Minko stage3d workshop_20130525
Minko stage3d workshop_20130525Minko stage3d workshop_20130525
Minko stage3d workshop_20130525Minko3D
 
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGroovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGuillaume Laforge
 
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6Ono Shigeru
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DRoman Protsyk
 
Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5Takao Wada
 
Bayesian Dark Knowledge and Matrix Factorization
Bayesian Dark Knowledge and Matrix FactorizationBayesian Dark Knowledge and Matrix Factorization
Bayesian Dark Knowledge and Matrix FactorizationPreferred Networks
 
A 3D printing programming API
A 3D printing programming APIA 3D printing programming API
A 3D printing programming APIMax Kleiner
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityDefconRussia
 
Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++Darshan Parsana
 
Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.UA Mobile
 
Self-Learning Systems for Cyber Security
Self-Learning Systems for Cyber SecuritySelf-Learning Systems for Cyber Security
Self-Learning Systems for Cyber SecurityKim Hammar
 
Designing C++ portable SIMD support
Designing C++ portable SIMD supportDesigning C++ portable SIMD support
Designing C++ portable SIMD supportJoel Falcou
 
AST: threats and opportunities
AST: threats and opportunitiesAST: threats and opportunities
AST: threats and opportunitiesAlexander Lifanov
 
Halide tutorial 2019
Halide tutorial 2019Halide tutorial 2019
Halide tutorial 2019Champ Yen
 

Similar a Stage3D and AGAL (20)

sheet6.pdf
sheet6.pdfsheet6.pdf
sheet6.pdf
 
doc6.pdf
doc6.pdfdoc6.pdf
doc6.pdf
 
paper6.pdf
paper6.pdfpaper6.pdf
paper6.pdf
 
lecture5.pdf
lecture5.pdflecture5.pdf
lecture5.pdf
 
Minko stage3d workshop_20130525
Minko stage3d workshop_20130525Minko stage3d workshop_20130525
Minko stage3d workshop_20130525
 
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGroovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
 
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
 
Extreme dxt compression
Extreme dxt compressionExtreme dxt compression
Extreme dxt compression
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3D
 
Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5
 
Bayesian Dark Knowledge and Matrix Factorization
Bayesian Dark Knowledge and Matrix FactorizationBayesian Dark Knowledge and Matrix Factorization
Bayesian Dark Knowledge and Matrix Factorization
 
A 3D printing programming API
A 3D printing programming APIA 3D printing programming API
A 3D printing programming API
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
 
Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++
 
Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.
 
Self-Learning Systems for Cyber Security
Self-Learning Systems for Cyber SecuritySelf-Learning Systems for Cyber Security
Self-Learning Systems for Cyber Security
 
Designing C++ portable SIMD support
Designing C++ portable SIMD supportDesigning C++ portable SIMD support
Designing C++ portable SIMD support
 
AST: threats and opportunities
AST: threats and opportunitiesAST: threats and opportunities
AST: threats and opportunities
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Halide tutorial 2019
Halide tutorial 2019Halide tutorial 2019
Halide tutorial 2019
 

Último

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
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
 
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
 
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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
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
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
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
 

Último (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
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.
 
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
 
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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
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
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
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
 

Stage3D and AGAL

  • 1. © Daniel Freeman 2013 Stage3D and AGAL HFUG mix May 18 Saturday, 18 May 2013
  • 2. • What is Stage3D ? • Principles of 3D graphics • Introduction to AGAL • Shader Examples • Extrusion and Lathes Saturday, 18 May 2013
  • 3. What is Stage3D ? Saturday, 18 May 2013
  • 4. “9 out of 10 top Facebook games are delivered using Flash Player. The biggest game networks in the world, like DNA, GREE, and Tencent, deliver their games with Flash technology. The iOS App Store,Android Market, and Amazon Appstore feature best-selling, #1 games built with Flash technologies.” http://gaming.adobe.com/whyflash/ Saturday, 18 May 2013
  • 5. Stage3D Open GL Mac Stage3D DirectX Windows Stage3D Open GL ES Mobile Stage3D SwiftShader No GPU Ubiquitous Support for older hardware (Intel GMA) Saturday, 18 May 2013
  • 6. Low Level mov ft3, v1 sub ft0.xy, v0.xy, fc4.xx sub ft0.z, fc4.x, v2.x abs ft1.xy, ft0.xy sub ft1.xy, ft1.xy, ft0.zz mul ft2.xy, ft1.xy, ft1.xy add ft2.x, ft2.x, ft2.y sqt ft2.x, ft2.x add ft2.z, fc4.w, v2.x sub ft2.z, ft2.z, ft2.x pow ft3.w, ft2.z, fc4.z sat ft3.w, ft3.w mov oc, ft3 Saturday, 18 May 2013
  • 11. winding / backface culling Saturday, 18 May 2013
  • 15. z = 0 z = 1 -1 +1 -1 +1 2d 2d -1 +1 -1 +1 World Coordinates Stage Coordinates Saturday, 18 May 2013
  • 18. Versatile VertexShader FragmentShader v0-v7 Interpolated Registers Vertex shader runs once per vertex Fragment shader runs once per fragment Saturday, 18 May 2013
  • 19. Registers va0-va7 Attribute Registers vc0-vc127 Constant Registers fc0-fc127 Constant Registers fs0-fs7 Sampler Registers v0-v7 Varying Registers op Output Point oc Output Colour Saturday, 18 May 2013
  • 21. add v0, va0, va2 sub v0, va0, va2 mul v0, va0, va2 div v0, va0, va2 m44 v0, va0, vc0 Saturday, 18 May 2013
  • 22. pow ft2.x, ft0.y, fc0.w mul ft2.xyz, ft0.xxy, fc0.xxx x y z w Saturday, 18 May 2013
  • 23. mul ft2.xyz, ft0.xxy, fc0.xxx ft2.x = ft0.x * fc0.x ft2.y = ft0.x * fc0.x ft2.z = ft0.y * fc0.x x y z w Saturday, 18 May 2013
  • 26. Example 1 : Solid Colour GreenSquare1 Saturday, 18 May 2013
  • 27. protected static const VERTICES:Vector.<Number> = Vector.<Number> ([ // X, Y, Z -0.5, -0.5, 0.0, 0.5, -0.5, 0.0, 0.5, 0.5, 0.0, -0.5, 0.5, 0.0, ]); protected static const N:int = 3; protected static const INDICES:Vector.<uint> = Vector.<uint> ([ 0, 1, 2, 0, 2, 3 ]); 3 (-0.5, -0.5, 0) (-0.5, 0.5, 0) (0.5, -0.5, 0) (0.5, 0.5, 0) 0 1 2 0 1 2 0 23 Saturday, 18 May 2013
  • 28. vertex shader mov op, va0 output point fragment shader mov oc, fc0 output colour _context3D.setProgramConstantsFromVector( Context3DProgramType.FRAGMENT, 0, // fc0 Vector.<Number>([ 1.0, 0.0, 0.0, 1.0]) // = Red ); Saturday, 18 May 2013
  • 29. Example 2 : Gradient Fill GreenSquare3 Saturday, 18 May 2013
  • 30. protected static const VERTICES:Vector.<Number> = Vector.<Number> ([ // X, Y, Z, r, g, b -0.5, -0.5, 0.0, 0, 1, 0, 0.5, -0.5, 0.0, 1, 0, 0, 0.5, 0.5, 0.0, 1, 1, 1, -0.5, 0.5, 0.0, 0, 0, 1, ]); protected static const N:int = 6; protected static const INDICES:Vector.<uint> = Vector.<uint> ([ 0, 1, 2, 0, 2, 3 ]); 3 (-0.5, -0.5, 0) (-0.5, 0.5, 0) (0.5, -0.5, 0) (0.5, 0.5, 0) 0 1 2 0 1 2 0 23 Saturday, 18 May 2013
  • 31. vertex shader mov op, va0 output point mov v0, va1 interpolate colour fragment shader mov oc, v0 output colour VertexShader FragmentShader v0-v7 Interpolated Registers Saturday, 18 May 2013
  • 32. Example 3 : Rotation GreenSquare4 Saturday, 18 May 2013
  • 33. vertex shader m44 op, va0, vc0 transform fragment shader mov oc, fc0 output colour _transform.appendRotation( 2.0, Vector3D.Z_AXIS ); _context3D.setProgramConstantsFromMatrix( Context3DProgramType.VERTEX, 0, //vc0 _transform, true ); Saturday, 18 May 2013
  • 34. Example 4 : Gradient Cube Flash3DExperiment5 Saturday, 18 May 2013
  • 35. protected static const VERTICES:Vector.<Number> = Vector.<Number> ([ // X, Y, Z, r, g, b -0.5, -0.5, 0.5, 0, 1, 0, 0.5, -0.5, 0.5, 1, 0, 0, 0.5, 0.5, 0.5, 1, 1, 1, -0.5, 0.5, 0.5, 0, 0, 1, -0.5, -0.5, -0.5, 0, 1, 0, 0.5, -0.5, -0.5, 1, 0, 0, 0.5, 0.5, -0.5, 1, 1, 1, -0.5, 0.5, -0.5, 0, 0, 1, ]); protected static const N:int = 6; protected static const INDICES:Vector.<uint> = Vector.<uint> ( [ 0, 1, 2, 0, 2, 3, 4, 6, 5, 4, 7, 6, 0, 4, 5, 0, 5, 1, 1, 5, 6, 1, 6, 2, 2, 6, 7, 2, 7, 3, 3, 7, 4, 3, 4, 0 ]); Saturday, 18 May 2013
  • 36. vertex shader m44 op, va0, vc0 transform mov v0, va1 interpolate fragment shader mov oc, v0 output colour _projectionMatrix.perspectiveFieldOfViewLH( 45.0*Math.PI/180, stage.stageWidth/stage.stageHeight, 0.1,1000.0 ); Saturday, 18 May 2013
  • 37. Example 5 :Texture Cube Flash3DExperiment3 Flash3DExperiment3a Saturday, 18 May 2013
  • 38. protected static const VERTICES:Vector.<Number> = Vector.<Number> ([ // X, Y, Z, u, v, -1.0, -1.0, -1.0, 0, 0, 1.0, -1.0, -1.0, 0, 1, 1.0, 1.0, -1.0, 1, 1, -1.0, 1.0, -1.0, 1, 0, etc...etc.. 3 0 1 2 u v 0 1 1 VertexShader FragmentShader Interpolated Saturday, 18 May 2013
  • 39. vertex shader m44 op, va0, vc0 transform mov v0, va1 interpolate uv fragment shader tex ft0, v0, fs0 <2d,linear,nomip> mov oc, ft0 output fragment _projectionMatrix.perspectiveFieldOfViewLH( 45.0*Math.PI/180, stage.stageWidth/stage.stageHeight, 0.1,1000.0 ); Saturday, 18 May 2013
  • 40. Example 6 : Light Source Flash3DExperiment7a Saturday, 18 May 2013
  • 41. protected static const VERTICES:Vector.<Number> = Vector.<Number> ([ // X, Y, Z, nX, nY, nZ -1.0, -1.0, -1.0, 0, 0, -1.0, 1.0, -1.0, -1.0, 0, 0, -1.0, 1.0, 1.0, -1.0, 0, 0, -1.0, -1.0, 1.0, -1.0, 0, 0, -1.0, etc...etc... normal Saturday, 18 May 2013
  • 42. vertex shader m44 op, va0, vc0 transform m44 v0, va1, vc0 normal fragment shader nrm ft0.xzy, v0 normalise mov ft0.w, fc0.w dp3 ft0, ft0, fc1 dot product sat ft0, ft0 clamp mul oc, ft0, fc0 multiply colour _context3D.setProgramConstantsFromVector( Context3DProgramType.FRAGMENT, 0, Vector.<Number>([ 0.5, 0.5, 0.5, 1.0 ]) ); _context3D.setProgramConstantsFromVector( Context3DProgramType.FRAGMENT, 1, Vector.<Number>([ X, Y, Z, 1.0 ]) ); Saturday, 18 May 2013
  • 43. Example 7 : Phong Shader Flash3DExperimentA Saturday, 18 May 2013
  • 45. A B A • B = |A| |B| Cos A is Half Angle B is Normal ( A • B ) n n = 1 n = 50n = 5 = 0 Saturday, 18 May 2013
  • 46. vertex shader m44 op, va0, vc0 transform m44 v0, va1, vc4 normal fragment shader nrm ft0.xyz, v0 normalise normal mov ft0.w, fc0.w set w to 1 dp3 ft0.x, ft0, fc0 dot product sat ft0.x, ft0.x clamp pow ft1.x, ft0.x, fc3.w dot product to power mul ft2.xyz, fc2.xyz, ft0.xxx diffuse colour add ft2.xyz, fc1.xyz, ft2.xyz add ambient colour mul ft3.xyz, fc3.xyz, ft1.xxx specular colour add oc, ft2.xyz, ft3.xyz combine and output fc0 Half Angle Vector fc1 Ambient Colour fc2 Diffuse Colour fc3 Specular Colour Saturday, 18 May 2013
  • 47. Example 8 :AGAL Animation Flash3DExperimentE Saturday, 18 May 2013
  • 48. AGAL Animation • Advantageous to animate vertices in AGAL • AS3 is slow. AGAL is fast. • Manipulation of vertices in AS3 is slow • Computing a transformation matrix is slow • Better to interpolate vertices in AGAL Saturday, 18 May 2013
  • 49. AGAL Animation ManipulateVertices where u = 1 and v = 1 Saturday, 18 May 2013
  • 50. vertex shader mov v1, va1 // interpolate uv m44 vt0, va0, vc0 // translate vertex m44 vt1, va0, vc4 // translate normal mov v0, vt1 // interpolate normal mul vt1.xyz, vc8.xxx, vt1.xyz // multiply t by normal mul vt2.x, va1.x, va1.y // multiply u by v // if ( u==1 && v==1) mul vt1.xyz, vt2.xxx, vt1.xyz // push vertex out add op, vt0, vt1 // add va0 Vertices (Normals) va1 U-V vc0 transform matrix vc1 rotation transform vc8.x interpolation Saturday, 18 May 2013