370 likes | 485 Views
Devmania 2009. breezEngine. Tobias Zirr. Architecture. Languages & Libraries. C++ HLSL / FX C++/CLI C# DirectX 9 Assimp PhysX TinyXml zLib libPNG .NET Framework 2.0. Modules & Responsibilites. Modules & Responsibilites. Prototype. More on that in a moment. Design Goals.
E N D
Devmania 2009 breezEngine Tobias Zirr
Languages & Libraries • C++ • HLSL / FX • C++/CLI • C# • DirectX 9 • Assimp • PhysX • TinyXml • zLib • libPNG • .NET Framework 2.0
Modules & Responsibilites Prototype More on that in a moment
Design Goals breeze • Simple structure & intuitive interface • Minimal effortwhenincorporatingnewlydevelopedcomponents • Comprehensivecollectionofhighly flexible conceptsservingdevelopersas a frameworkProperties, Controllers, Synchronization, Animation, Entities, Entity Nodes, Effect Binders, Renderables, Lights, Scene Nodes, MeshBuilders…
Material Management • Once upon a time… • typedefstructD3DMATERIAL9 { D3DCOLORVALUE Diffuse; D3DCOLORVALUEAmbient; D3DCOLORVALUESpecular;D3DCOLORVALUEEmissive;float Power;} D3DMATERIAL9, *LPD3DMATERIAL9; • Wheretoputnew material properties?
Material Management • Material propertymanagementoptions • Variousdistinctdatastructures per shader (group)
Selectiveapplicationofshaders Pioneerproject Specificshader FFP Specificshader
Selectiveapplicationofshaders Pioneerproject Hard-codedspecialdatastructure
Material Management • Material propertymanagementoptions • Various distinct data structures per shader (group) • Enhanced „über“ datastructureselectivelyboundby multiple overlappingshaders (shadergroups)
FFP/Shader mix Pioneerproject Default datastructure Additional texturedata Additional constantdata
Material Management • Material property management options • Various distinct data structures per shader (group) • Enhanced „über“ data structure selectively bound by multiple overlapping shaders (shader groups) • Dynamic datastructures • Nohard-codeddatawhatsoever • „Tweakables“ areloadedfromtherespectiveeffectfilesatruntime, resulting in totally individual datastructuresforeachshader
Compatibility • In manyplaces, FFP compatibilityrequires multiple render paths • In a pure shaderenvironment, dynamicmaterialsofferbothmaximumflexibilityand optimal handlingatthe same time • With FFP legacydropped, therendering API turned out substantiallyslimmer
Compatibility • In manyplaces, FFP compatibilityrequires multiple render paths • In a pure shaderenvironment, dynamicmaterialsofferbothmaximumflexibilityand optimal handlingatthe same time • With FFP legacydropped, therendering API turned out substantiallyslimmer if(shaderModel < 2) throw „Go buy a newcomputer!“;
Live Demo Material Tweaking
Render Tree Constructedeveryframeanew!
Live Demo Post Processing
The Permutation Problem • Importantpivotalpoints • Transformation • Simple Rendering • Instanced Rendering • GPU-side Animation • Lighting • Multiple lightsin arbitrarylight type combinations • Shadows & projectedtextures (on / off) • Material • Albedo, normal und reflectiontextures • Manifoldvariationsof different lightingmodels
The Permutation Problem • Possibleapproaches • Über/Super shaders • StaticBranching • Pre-compilationof all referencedcombinations • Inferred (/ Deferred) Lighting • Optimal separationbetweentransformation, lightingand material makespre-compilationof multiple combinationssuperfluous • Usedby well-knowncompanies:„ The combination of deferred lighting and this technology [= ubershaders & material layers] allows CryENGINE® 3 to avoid the traditional shortcomings of UberShaders alone.” – CryENGINE 3 Specifications, Crytek.com • Dynamic ShaderLinkage • DirectX 9 Fragment Compiler • DirectX 11 Interfaces
The Permutation Problem • A Super Shadercompromise • Material ashighestcriterionof order • Possiblecombinationsoflighttypesaredefinedasseparate passesandmarkedaccordinglybytheshaderdevelopertoenableEffect Binders tochoosetherightpassesatruntime • Transformation isperformedby a centralbaseclassthatknows all thetransformationtypesrequiredbyspecificentities, similartothe super shadertech-nology Classesand Interfaces areavailable in HLSL since November 2008 (even in DirectX 9)
A Super ShaderCompromise • Benefitsofthecomprimise • Selectionofshaders intuitive, beingequivalentwithchoosing an object‘s material • Administration effortreducedfrom 3 to 2 pivotalpoints • Lean shaders due to elegant abstractionusingthenew HLSL languagefeatures • Caveatsofthecompromise • Complexityonlyreduced on thesurface, in effect all permutations still needtobepre-compiled
Scene Management • Scene classesperformnothing but simple frustumculling • Noinformation on thestructureofthescene • Specializationrealized via implementationofthe Scene Nodeinterface • Landscapesusuallyalreadymaintainquadtreesbythemselves • Portal/sectorsystem in a separate Scene Node
Live Demo Amsterdam Physics
Live Demo Ghosts