Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Minko stage3d 20130222






Total Views
Views on SlideShare
Embed Views



1 Embed 29

https://twitter.com 29



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Minko stage3d 20130222 Minko stage3d 20130222 Presentation Transcript

    • Jean-Marc Le Roux@promethe42http://blogs.aerys.in/jeanmarc-leroux
    • Resources Sources https://github.com/aerys/minko Forum http://answers.aerys.in Samples http://github.com/aerys/minko-examples Documentation http://hub.aerys.in/index.php/Minko:Tutorials http://hub.aerys.in/minko/reference/index.html
    • Minko SDKsCommunity SDK Free and opensource framework Free tools
    • Minko SDKsProfessional SDK Advanced FeaturesCommunity SDK Free and opensource framework Free tools
    • PART 1: SCRIPTINGCommunity SDK
    • The bigger the app.,the cleaner you want to be.should?
    • I – or someone else – already did this,I want to re-use the existing code.
    • ISceneNodeMesh Camera GroupLightAbstractControllerISceneNode.addController()AnimationController AbstractScriptControllerDataProviderISceneNode.bindings.addDataProvider()CameraDataProvider LightDataProviderModelControllerViewMaterial
    • ISceneNodeMesh Camera GroupLightAbstractControllerISceneNode.addController()AnimationController AbstractScriptControllerDataProviderISceneNode.bindings.addDataProvider()CameraDataProvider LightDataProviderModelControllerViewMaterialMyScriptTo create a script: Extend AbstractScriptController Override the update() method
    • You can keep working the way you want.You don’t have to use scripts or controllers.
    • But with scripts & controllers…
    • Re-usable loosely coupled code Target multiple scene nodes with a single script Easily build and share your own library of useful scripts Easily fetch and use the communities code snippets// only 1 scriptvar kbScript : KeyboardMoveScript = new KeyboardMoveScript();// but it controls 2 targetscube.addController(kbScript);sphere.addController(kbScript);
    • Easy access to Mouse/keyboard properties and signals time, deltaTime Scene A lot of other properties useful to script stuff…// if the right arrow key is down…if (keyboard.keyIsDown(Keyboard.RIGHT))target.transform.appendTranslation(.1);
    • Similar to Event.ENTER_FRAME but Lighter Customisable per-script « frame rate »// execute this script only once per secondthis.framerate = 1;
    • Example: move objects with thekeyboardpublic class KeyboardMoveController extends AbstractScriptController{override protected function update(target : ISceneNode) : void{if (keyboard.keyIsDown(Keyboard.RIGHT))target.transform.appendTranslation(.1);if (keyboard.keyIsDown(Keyboard.LEFT))target.transform.appendTranslation(-.1);if (keyboard.keyIsDown(Keyboard.UP))target.transform.appendTranslation(0., .1);if (keyboard.keyIsDown(Keyboard.DOWN))target.transform.appendTranslation(0., -.1);if (keyboard.keyIsDown(Keyboard.PAGE_UP))target.transform.appendTranslation(0., 0., .1);if (keyboard.keyIsDown(Keyboard.PAGE_DOWN))target.transform.appendTranslation(0., 0., -.1);}}
    • Usage// instanciate the scriptvar kbScript : KeyboardMoveScript = new KeyboardMoveScript();// add the script to a targetcube.addController(kbScript);// remove the script from a targetcube.removeController(kbScript);
    • More about scripts and controllers… Write your first controller A Script To Move Objects With The Keyboard Handle Mouse Focus With A Script Switching Material With a Controller Create Procedural 3D Animations
    • HDR RenderingDynamic lightsStatic lightsDynamic shadowsStatic shadowsDiffuse textureNoiseDiffuse texture
    • Kids, this is the story of how I met your shader…
    • 1992 2001 2004 2011Mortal Kombat GTA III Doom 3 Crysis 21996Evolution of shader languages
    • What about AGAL?1992 2001 2004 2011Mortal Kombat GTA III Doom 3 Crysis 21996Language Features
    • In 1992, Flash was called FutureSplash Animator and written by a single man: Jonathan Gay
    •  learning AGAL != learning GPU programming AGAL is awesome for 3D engines developers Low-level binary assembly code Cross-platform AGAL is a nightmare for 3D applicationsdevelopers
    • With Minko you can program the GPUusing ActionScript 3.0 !
    • Minko embedded JITCompilerShader ByteCodeActionScript ShaderCodepublic class MyShader{public function getVertexPosition() : SFloat{return localToScreen(vertexXYZ);}public function getPixelColor() : SFloat{return sampleTexture(meshBindings.getTextureParameter(‘texture’),interpolate(vertexUV));}}m44 vt0, va0, vc0m44 vt0, vt0, vc5mov oc, vt0mov v0, va1tex ft0, v0 <linear,2d>mov oc, ft0at runtime compilation
    • ActionScriptShader•Use all ActionScript 3.0 features•getOutputPosition => Vertex Shader•getOutputColor => Fragment Shader•OOP style•CPU/GPU balancingASG•Abstract Shader Graph•Optimizations•Constants and temporary registersallocation•Operations re-ordering for fasterexecution and optimal use of temporaryregistersAGAL•Direct bytecode generation at runtime•Custom compiler•Optional debug data•AGAL assembly output•Shader graph output•Memory allocation mapExecution Full AS3 workflow Conditionnals and loops Classes and methods Dynamic OOP coding style Exhaustive AGAL implementation Extra high-level operations set Re-usable « shader parts » Shaders compiled at-runtime Just like any other AS3 code Dynamic according to The scene properties The mesh properties/material Any constant, variable, etc… Redistributable as SWF/SWC files
    • ACTIONSCRIPT IS NOWTHE MOST POWERFULSHADER LANGUAGE(as a language, but not GPU feature wise because of Stage3D limitations )
    • More about shaders… JIT shaders for better performance Create your first shader Understanding vertex to fragmentinterpolation Get ActionScript shaders compilations logs Create a shader rendering per-pixel normals Create a « black and white » post-processingeffect
    • PART 3: SCENE EDITORCommunity SDK
    • WYSIWYG Editor
    • Fine tuning
    • Flash Pro-like symbols
    • *.dae, *.3ds, *.obj, …Common File FormatsPublish MK Scenes…editor
    • MK File Format Fully optimized for Minko More suitable for web/mobile apps in general Binary Light Zip, deflate or LZMA Readable with AS3, PHP, C++ and JavaScript
    • More about the editor… Normal mapping and specular maps Importing Collada files
    • Minko SDKsProfessional SDKCommunity SDK
    • After this slide, nothing is neither free nor open source.(for now… )
    • PART 1: PHYSICSProfessional SDK
    •  Fast, robust and extensible Create new kind of forces, force fields… Add specialized shapes and collision detectionalgorithms Comprehensive set of shapes Box, sphere, cone, cylinder… Triangle mesh Convex hull Heightmap Triggers for scripting
    • // listen to the Collider.collisionStarted signalredGoalCollider.collisionStarted.add(function (collision : CollisionStarted) : void{_numPointB++;resetBall();});// do the same for Collider.collisionStopped…Working with triggers
    • Best practice: implement triggers using scripts.You will soon be able to bind them directly in the editor!
    • MK Optimizations A new file format for 3D content Readable with AS3, PHP, C++ and JavaScript Optimized for the web Lossy and lossless 3D compression 3D streaming (WIP) Optimized for mobile devices Automated shape-conservative 3D simplification Fast implementation Automated ATF compression for textures
    • *.dae, *.3ds, *.obj, …Common File FormatsPublish Optimized MK Scenes…editorAutomated optimizations
    • 05000100001500020000250003000035000 daedae (rar)objobj (rar)3dsmkmk (simplification)mk (compression)mk (compression +simplification)3D formats size comparison(lower is better)
    • 3D formats comparison020406080100120140File Size (MB) Downloading Time(seconds)Parsing Time(seconds)OriginalMK(lower is better)Collada
    • 3DScene Automated optimizations ATF compression Texture resizing 3D simplification 3D compressionPublishx10 faster rendering!
    • 3DScene Automated optimizations ATF compression 3D compression 3D streaming (WIP)Publishx20 faster download!
    • 3DSceneBuild your scene once,publish it for each device automatically.myScene.mksmyMobileScene.mkmyWebScene.mk
    • Simplification is also very cool to create multiplelevel of details for the same scene!
    • Next? Public beta next week Everything for free (for now…) Give us feedback! ShaderLab integration http://www.youtube.com/watch?v=yuR1e1PjU8Y Editor plugins Artificial intelligence framework/editor Particles framework/editor Animations editor Terrain editor
    • MERCI !