Presentation is loading. Please wait.

Presentation is loading. Please wait.

???.

Similar presentations


Presentation on theme: "???."— Presentation transcript:

1 ???

2 Speed up the 3D Application Production Pipeline
Dr. Oskar Guilbert Head of Developer Relations, France

3 Outline Graphics Training Criterion Software RW solutions RW support
Products RW Studio RW AI RW graphics RW Physics RW Audio Graphics Training Familiarization with components Exporter Plugin example Platfom PC/XBOX/PS2/GC specificities HLSL pipeline example

4 Criterion Software Created in 1993.
Offices in Guildford & Derby (UK), Austin (US), Tokyo and Paris. More than 200 employees. Two focused business units : Criterion Games, our internal game development studio which already released 12 games. Used to work with Ubi Soft, Acclaim, Sony... Criterion Software focused on middleware technology : RenderWare Platform and RenderWare Studio

5 A production-proven technology
More than 150 titles already released, More than 20 AAA, On current generation consoles and PC, 4 titles released with Ubi Soft More than 200 titles in current development, With the main actors of our industry : Sony Computer Entertainment, Electronics Arts, Activision, Namco, Atari, CapCom, Konami, Midway, Take 2, Ubi Soft, Sega…

6 Christmas 2003 – Spring 2004 Activision Sega Rockstar Lucas Art Namco
Call of Duty, The Movies Sega Sonic Heroes, HeadHunter: Redemption Rockstar Max Payne 2, ManHunt, Vice City XBox Lucas Art Secret Weapons Over Normandy Namco Dead To Rights 2, Kill.switch THQ BrokenSword: The Sleeping Dragon VUG ColdWinter Konami Turtles Ninjas

7 Criterion Fundamentals
An integrated development platform rather than a game engine : - To build easily a game engine specific for each of your games, - To allow you to customize your tools respecting your workflow, - To allow you to concentrate on the special effects which will make your game unique ( lightmap for Rayman R, Specularity for Burnout 2, Management of an important number of objects for GTA3 ...), - To build and increase the skill of the team We are challenged on : - Learning curve, - Immediate « Waouu » effect and flashy demo,

8 A modular and complete solution
Low level API for Rendering, Physic, Audio and AI. Authoring tools to build quickly your production workflow. Each component is independant and can be integrated with your own tools, Each component is optimized to work with the other components.

9 A dedicated support team
30 engineers dedicated to support our customers with a commitment of quality and delay. Support system helps us to respect our commitment and to keep a permanent communication with our customers, In Year 2003, +15K questions were posted on a worldwide basis : For 55 % the answer was given under 4 hours, For 40%, the answer was given under 24hours, For 5 %, the answer was given under 4 days,

10 Technology Overview Designers Artists Management Producers Programmers
PC Host Artists Management Producers Programmers Target

11 RenderWare Studio

12 RenderWare Studio Acquired Realimation IP and engineering group in July 2000 2 years of design, R&D and feedback Staff of 25 developing RwStudio Shipped 1.0 in September 2002 Next release: 2 in March 2003

13 RenderWare Studio Custom 3 Major Components Developer Tools Game Code
Game Framework Workspace Manager Workspace Game Code Manager Custom Controls Game Framework Target Hardware

14 RwStudio – Game Framework
Collaborative tool for Developers Artists Game Designers Producers Accelerate the game production pipeline : Share assets Tune in real time Game visibility from day 1 Interactive preview on PC/XBOX/PS2/GC

15 RwStudio – Game Framework
Provides an application framework for developers to build their game on top of Think of it as an implementation of the Manager comms interface Class factory, resource management, memory manager, event system Abstracts hardware-specific and design-time details of comms and file systems Provides a set of functionalities Rendering, animation, particles, controllers, triggers, cameras

16 RwStudio – Workspace Development environment for editing game data, placing game objects, tweaking game attributes Soft user interface Dockable windows, stacked dialogs, floating palettes Authoring tool for form design and scripting COM/VBScript-driven Hosts developer’s custom ActiveX controls Designed to be customized to the specifics of the game engine and developer’s workflow

17 RwStudio – Manager Back-end of RwStudio Maintains game database
Persisted in XML Asset-controlled by NXN AlienBrain Exposes data object model for access through COM or DLL Provides communications to running targets TCP/IP-based, connect to target anywhere Performs source-code parsing to generate list of available behaviors in game engine

18 RwStudio – Fundamentals
Two-way, real-time connection to running game on multiple targets Automatic game editor UI generation via behavior source code mark-up Integrated asset management for team environments Encourages component-base game engine design (flexible) Encourages data-driven game engine design (content-oriented)

19 Renderware Studio demo :
UI Examples framework Game Genre Pack : FPS Behavour structure

20 RenderWare AI This presentation document has been designed to introduce RWAI to prospects. It focuses on demos that illustrates different technology elements. The agenda is the following Introduce Kynogon Get customer on board on what AI is Technology structure Technology content with demos Perception (5 demos) Pathfinding (3 demos) High level behaviors (2 demos) Decision & team (4 demos) Performances (1 demo) Tools (1 demo) Studio integration This document comes with the customer FAQ which gives you answers to more than 100 questions customers might ask. It is very important to get familiar with the demos and not to run them for the first time in front of the client. You have to make sure you understand how to launch demos, identify the best view angle, etc. Demos (standard elements) To launch a demo Double click on the demo icon ; For Kynogon home made art work demos, press tab to activate the below menu You navigate via the keyboard arrows: up & dow to change topics, right & left to select. Activate AI needs to be turned ‘On ‘ to activate RWAI. Press tab twice to remove menu

21 RenderWare AI has been developed by Kynogon, Criterion Software partner for AI
Virtual Character behavior Network 3D engine Pathfinding Perception Emotions Cooperation Adaptability Learning RWAI presentation starts by introducing Kynogon, the company who developed RWAI : Kynogon expertise is on AI middleware ; Kynogon is based in Paris ; Kynogon Headcount is 15 ; Kynogon started in 2000. Kynogon became Criterion partner in Criterion has evaluated several technologies and selected Kynogon because of : Performances ; Richness of functionalities and tools portfolio ; No black box, the technology is open for customization, etc. and close to Criterion philosophy ; Structured approach ; Kynogon does not focus only on high level decision making process ; Technology is easy to implement ; Kynogon had first experiences in game development. Kynogon technology complements Criterion product range. With Graphic, Audio, Physics and AI, Criterion provides developers a complete integrated set of tools. AI is vague and we prefer talking about Non Player Character Behavior NPC behavior paradigm is detailed next slide it covers a wide range of topics (pathfinding, perception, learning, etc…) and therefore a wide range of technology (plannification, statistics, neural networks, evolutionist algorithms, reinforcement learning, etc.) Behaviour Interfaces Game / simulation engine Physic engine Sound engine Sound Kinematics Scenario Graphics Animations

22 Behavior generation paradigm Production constraints
To give behaviors to Non Player Characters via a fast and efficient production process Behavior generation paradigm Perception Decision Action Understand situation Decide what to do Do it Perception is key: bad perception leads to wrong behavior Decision is only one part of NPC behavior 3D Pathfinding is the foundation of NPCs behavior Usually AI frightens developers. They understand high level decision making processes with autonomous NPCs. Then developers loose control of their game : NPCs make autonomous decisions not in line with their scenario. Decision is only one part of AI and usually it is scripted. Decision is not key. On the other hand, perception is a major issue. Without a good perception, there is no relevant decision or action. For example, a detailed perception will give NPCs the ability to position themselves properly. they will then be able to hide, to oraganize opposite flank assault, to surround enemies, to protect a VIP, etc. In today video games, NPCs have very limited perceptions: they are like blind men with a stick. It is therefore very difficult to give them advanced behaviors. RWAI has focused on perception RWAI perception mechanisms are base on: a world modeling specific to behaviors. You need a modeling from a rendering perspective (polygons) or a physics perspective (collision meshes). You also need a modeling from a behavior perspective: the Pathdata. (see demo 2- Automatic Pathdata Generator) a revolutionary 3D topology dynamic analysis. This analysis gives NPCs a deep understanding of their environment so that they can implement adequate behavior (see demo 4-3D topology dynamic analysis. Concerning action, RWAI proposes a portfolio of high level actions that help developers quickly implement behaviors. NPC topology analysis is usually limited (blind man with a stick) Games do not need completely autonomous NPCs (scenario) Action portfolio must be rich enough to implement diverse behaviors Production constraints Production tools to accelerate production and empower game designers High level performance Multi-platform environment

23 RenderWare AI 3.7 offers functionalities for NPC in-depth perceptions
Classic perceptions (see, hear, smell) including optimized visibility tests between entities Topology advanced understanding : Modeling: PathData automatic generation & edition Advanced 3D topology analysis Again we insist on the fact that perception is key (see slide #3) There are two kind of perception services: Perception services that ensure performance of basic functionnalities. For example, visibility tests are not state of the art technology. Developers do not need RWAI for that. However, these tests can become CPU demanding and need clever optimisation. One visibility test between two entities is not an issue, but between 50 entities, it means 50 X 50 tests at the same time! RWAI offers solution to handle performance. RWAI offers a complete set of perception functionnalities: Any type of perception emitted by a source can be handle by RWAI (Sounds, Smells, etc.) RWAI offers tools to automatically generate an optimised modeling of the world relevant from a behavior perspective. RWAI includes advanced functionnalities to ensure sophisticated understanding of worl topology Demo 1: sound manager See page 1 for standard procedure When you move, you leave yellow marks. These yellow marks are characterised by a source (you), an intensity, a duration. They could be sounds, smells, pheromons, etc. The termite is percieving these sounds and follows you. If you move too fast, termite can loose you. Demo 2: Automatic Pathdata Generator This demo illustrate a tool that generates automatically the modeling of the world. This modeling will then be used for pathfinding and topological analysis. There are basically 2 phases: Entities explore the world. They move using developer game engine which ensure full compatibility. If in his game engine an entiy is not able to walk when the slope is over 10%, there will not be any pathdata generated when slopes exceed 10%. The data generated are optimised to minimize CPU and memory consumption. The final result is presented in a graph form but be careful, the graph is not the paths entities will always follow! They can walk outside of the graph! Integration in the production Automatic PathData Generator 3D topology dynamic analysis Sound Manager PathData Editor

24 RenderWare AI 3.7 offers decision & team functionalities
Scripting C brains support C++ brains support LUA script brains support Team Dynamic team composition Communication between team-mates Body guards Team hide Hide & Shoot

25 Advanced 3D Pathfinding : dynamic constraints, game engine objects management and high level performance Complex 3D topology support Advanced trajectory identification Shortest path Stealthiest path Dangerous zone avoidance Custom constraints support Multiple path following modes / multiple Heuristics modes Dynamic avoidance between entities. Dynamic PathObjects (doors, elevators, ladders, barrels, boxes, ...). Path constraints Random Path PathObjects

26 A set of ready-to-use agents (high level actions)
Fighting agents Contact attacks Shoot Custom agent support Formation (next release) Triangle Column Square Cooperation agents (next release) Body guards Opposite flank assault Ambush Movement agents Goto Follow Flee Wander Follow path Hide (relative or absolute) Imitator agents Agents

27 RenderWare AI has been designed for high performances on consoles
Time-slicing mechanisms Customizable memory management Spiders

28 RenderWare AI offers easy-to-use production tools
Architecture Configuration Automatic PathData Generator PathData Editor Automatic Behavior Generator via cloning

29 A powerful integration in RenderWare Studio via RwAi toolkit
Encapsulation of all RenderWare AI concepts inside RenderWare Studio behaviors Easy parameters edition of RenderWare AI in RenderWare Studio workspace including runtime capabilities Integration of RenderWare AI tools in RenderWare Studio layouts Ready-to-use NPCs with AI capabilities

30 RwAi Toolkit default behaviors RwsAiWorld behavior attributes
object RwsAiWorld behavior attributes

31 Specific game behaviors for AI driven NPCs
CAIMonster Behavior object Specific game behaviors for AI driven NPCs CAIMonster AI behavior attributes (pathfinding)

32 Architecture configuration
RenderWare AI core technology can be split into 4 layers open for customization Layer Definition Tools Decision Articulation of agents Script Autonomous decision decision design Script language compiler Agents Elementary behavior (hide, go to, over-take) behavior production Automatic behavior generator through player cloning RWAI core technology has been designed for video game. RWAI core technology comes as : a stand alone version and can be used in any environment including non RenderWare technologies ; A middleware part of RenderWare suite with default integration functions ; Integrated into RenderWare Studio (RWAI toolkit). Architecture: Integration: RWAI can be easily integrated into your game engine. It is a one day work. There are 3 glues to develop: How to feed information from your game engine into RWAI ; How to translate RWAI decisions into your game engine format ; Ensure ray tracing and visibility test functionalities interface. A specific test will help you ensure that the integration is correct. We can support you to integrate RWAI (even with one of our resource). Openess: like any other renderware products, RWAI is not a black box, but it is open. You can take functionnalities ‘as is’, customize them, develop your own, etc. Performance: RWAI has been design to run on game consoles. It uses time-slicing mechanisms to optimize CPU consumption ; Maximum CPU consumtion can be set up as a parameter ; It proposes flexible memory management systems to minimize dynamic allocation. There are two kind of services: PIERREPIERREPIERRE Agents: an agent is an elementary behavior. See slide #8 for the list of agents available in RWAI. All RWAI agents can be customized and developers can add their own agents. Decision: the decision logic is developed into a « brain ». Deciding is secting the relevant agent. It is the role of the brain to identify when a NPC decides to attack, to flee, to hide, etc. RWAI offers scripting decision mechanism. Developers can use their own script langage, use their FSM, etc. Next RWAI version will include FSM. A good middleware is a middleware with good tools. At each layer, RWAI proposes tools that significantly accelerate production. Data can be generate automatically, 200 parameters are exposed for tuning, etc. Services CPU demanding algorithms Algorithms shared by Agents data production Automatic PathData generator PathData Editor Automatic CircuitData Generator CircuitData editor Architecture Integration Performance Openness Architecture configuration Architecture configuration tool

33 RenderWare AI 3.7 represents a massive development
4 platforms: PC (Windows & Linux), Playstation 2, Xbox, GameCube 8 compilers: Visual C++, Code Warrior, SN System, GCC 3 brains 6 tools 11 services More than 50 agents 200 script functions 200 parameters Over 600 pages of documentation Straightforward slide RWAI runs on all consoles/compiler.

34 Next RenderWare AI release
Streaming of pathfinding Finite State Machine On the shelf team behaviors Formation agents Racing functionalities Automatic CircuitData generation Ergonomic CircuitData editor Automatic car characteristics extraction Trajectory computation Dynamic avoidance of other vehicles Overtaking local topology dynamic analysis PathData streaming

35 RenderWare AI is a multi-genre technology
FPS Action/Adventure RTS / RPG Sport Racing Architecture AI Configuration (CPU consumption, etc…) Perception Classic perception Seeing Hearing Smelling 3D topology dynamic understanding Modeling Topology dynamic analysis Automatic pathdata generation Pathdata edition Circuit perception Circuit data automatic generation Circuit data edition Pathfinding & Behavioral Agents 3D pathfinding including: Constraints (furtiveness, etc…) Dynamic obstacle avoidance Path objects management (doors, etc…) Streaming Speed Over take Go to Follow character Team agents Fish tail Bump Follow path Hide Shoot Flee Close combat Formation Automatic behavior generation via player cloning Decision Script Team Finite State Machine

36 Production process improvement
INNOVATION Dynamic 3D pathfinding Complex topology Automatic animation Group strategy modeling Emotion modeling Automatic data generation Automatic behavior generation Etc… PRODUCTION PROCESS AI developments Selection Marketing constraints Test & debug Pre-prod Prod Tuning Without RWAI AI on critical path With RWAI On the shelf solutions Open architecture Parameter driven solutions Production tools AI developments Developments IA FOCUS ON CORE BUSINESS (application dev.) Earlier AI developments Easy prototyping More time for tuning INCREASE PROFITABILITY Innovative technology Budget control Flexible costs AVOID EXPERTISE DEVELOPMENT RISKS Turnover Feasability Developers hot buttons

37 RenderWare Graphics

38 RenderWare Graphics Runtime Technology Toolchain Technology
Rendering Pipelines Low-level Services Toolkits Toolchain Technology Exporters Tools

39 RwGraphics – Rendering Pipelines
General Static mesh, skinned mesh, multi-texturing Special-cased Cloning, particles, optimized lighting setups, reduced weight skinning, bezier patch primitives, lightmaps Platform-optimized Over 150 hand-written VU pipelines for the PS2 Optimizing vertex/pixel shaders for DX9 and XBOX Hand-optimized assembler pipelines for the GameCube, hardware skinning when available Custom-built pipelines

40 RwGraphics – Low Level Services
DMA Manager with API Texture cache management Pipeline construction kit PDS pipeline delivery system Dynamic vertex buffer management Renderstate cache Native geometry/texture instancing Plug-in architecture Overloadable file system Overloadable memory manager with freelists and memory hinting Cameras, rasters, render targets Video-mode selection (including anti-aliased) Streaming toolkit

41 RwGraphics – Toolkits Animation Scene Management
Platform-optimized file systems Streaming, asynchronous loading 2D shapes, animation, interactivity Particle Systems Math (quaternion, quantization, barycentric, splines, random, …) File-packaging (dictionaries) Intelligent Pipeline Selection

42 RwGraphics – Exporters for Artists
Support latest versions of Max and Maya Exports geometry, animation, materials, lights, cameras, splines, user data Create partitioning hints Create particle effects Support dual-pass, normal maps, emboss, environment maps, toonshading, UV animation, normal map Use standard materials or RenderWare materials Xbox and GameCube specific materials Support Bezier patches Preview on-target using Visualizer (with metrics) Use lightmaps generated by art package Scriptable

43 RwGraphics – Exporters for Programmers
XML template-driven export settings (per-asset and per-project) Export directly to binary runtime format (RWS) or to intermediate XML format (RF3) Mipmap generation Customizable through OpenExport SDK Tri-stripping, partitioning, conditioning, UV limiting Platform-specific instancing Integration into build process

44 3D Model in Max or Maya RwGraphics Exporter Intermediate XML Export Templates Textures Asset Compiler Runtime Binary Stream R U N T I M E

45 RwGraphics – Tools SWF-to-Maestro PVS editor Instancer
Toonshader editor Xbox/GameCube Material Editors Visual Build Tool RF3 Compiler Light map editor

46 RenderWare Physics

47 RenderWare Physics Partnership with MathEngine beginning in early 2002
Acquired MathEngine IP and hired MathEngine engineers in June 2003 Using MathEngine’s physics expertise and solver technology for RenderWare Physics

48 RwPhysics – Basics Rigid-body dynamics
Constraint-based iterative solver Collision primitives Sphere, capsule, triangle, box, cylinder, plane, convex polyhedra Aggregates, grids, triangle lists Joint types Ball-and-socket, hinge, wheel hinge, zero-twist, universal, constrained angular, sliding/prismatic Pipeline-oriented physics step Find active pairs, generate contacts, partition, generate fixed volume contacts, update velocities, update friction, update positions, find moving objects Pipeline steps are optional, customizable

49 pipeline Object Manager Generate candidate pairs find intersections
RwpObjs Candidate pairs Calc pos and vel corrections Update pos and velocity Render ContactQuads and joints Position changes and forces New TMs

50 RwPhysics – Features Optimized ragdoll object based on particle physics 11 parts, 10 joints Joints are limited ball-and-socket or hinge Pre-built vehicle SDK optimized for speed not realism Get up-and-running quick with robust, stable vehicles VU0/CPU tightly synchronized VU0 in micromode Inner loop has no D$/I$ misses Data completely stored in scratchpad if under 320 row constraints GJK collision completely VU0 (faster than SCEI’s) x86 and SSE optimizations for data structures, loops

51 RenderWare Audio

52 RenderWare Audio Dolby Digital (where available in hardware), Dolby Pro Logic I/II Streaming audio Multiple streams divided into multiple segments divided into multiple sub-streams Unlimited virtual voices Dynamically mapped to hardware voices based on audibility and/or priority Listener-oriented 2D Frequency, gain, pan (left-to-right) 3D adds… Position, velocity Minimum/maximum distance Doppler, reverb, roll-off

53 RwAudio – RwaEditor Converts WAVs to platform-specific formats
Packages wave dictionaries Assembles streams, segments, sub-streams Set audio format details

54 RW Graphics training Familiarization with components Platforms
Rendering core Plug-ins and toolkits Exporter and visualizer Platforms Multiplatform architecture optimized for each platform Specific features by platform (PC/XBOX/GC/PS2) DX9, Pixel/Vertex shader and HLSL support Code example : writing a HLSL pipeline

55 RenderWare Graphics Architecture
How the RenderWare Graphics library fits into a typical application. Application RW plugin plugin toolkit RW plugin RW toolkit RW toolkit RpWorld RwCore Hardware

56 Rendering Core Glue that joins all the components together
Stream management : RwStreamOpen, Memory management : RwMalloc Basic rendering functionality. Engine initialization RwEngine Camera Management RwCamera Platform specific rendering functions : RwD3D9CreateVertexBuffer RwD3D9IndexBufferCreate RwSkySetTrueCliper

57 RenderWare Plugins The keys to RenderWare Graphics extensibility.
RpADC Address Control flag generation RpAnisot Anisotropy extension for extending textures RpCollision Collision-detection extensions RpDMorph Delta morphing and delta animation extensions RpHAnim Hierarchical animation plugin RpLODAtomic Level Of Detail extensions for RpWorld's "RpAtomic“ object RpLtMap Render geometry using detailed static lighting information from lightmap textures. RpMatFX Multi-pass special effects, such as environmental mapping, bump mapping, 2-pass RpMipmapKL Texture mipmap "K" and "L" value extensions RpMorph Morph-target animation extensions RpPatch Bézier patch rendering engine RpPrtStd Particle animation plugin RpPTank Creation, management and rendering of usercustomizable particles RpPVS Fast visibility culling extension for RpWorld, usingPotentially Visible Sets RpRandom Platform-neutral random number generator RpSkin Skinned model rendering extensions with multiple bone weights per vertex RpSpline Spline manipulation extensions RpUserData Provides functionality for storing user defined data with geometry RpUVAnim Attaches UV animations to materials RpWorld Provides RenderWare Graphics' Retained Mode API –specifically, the scene graph portion of it The keys to RenderWare Graphics extensibility. Extend existing objects in both the Core Library and other Plugins – and add their own objects. RenderWare Graphics‘ high-level APIs are all implemented as Plugins.

58 Renderware Toolkits Don’t extend but
Rt2d Advanced 2D Graphics API utilizing underlying 3D graphics hardware Rt2dAnim Animation of 2D objects RtAnim Create, stream and play keyframe animation. RtBary Mapping points between the barycentric space and Cartesian space RtBezPat Bézier patch generation utility library RtBMP Microsoft® Windows® Bitmap image format handling RtCharset A bitmapped character library RtCmpKey Keyframe system supporting compressed matrix animation RtDict Generic containers of named objects RtFSyst File system manager and custom file systems RtGCond Geometry Conditioning RtIntersection Polygon and line intersection testing functions RtLtMap Generation of lightmap textures - used with RpLtMap RtMipK Texture mipmap "K" value calculation functions RtPick Object-picking functions RtPITexd Platform independent texture dictionary streaming RtPNG Portable Network Graphics image format handling RtQuat Quaternion manipulation functions RtRAS Sun® Raster image format handling RtRay Ray-casting functions used for picking RtSkinSplit Skin & Geometry splitter for large bone count models RtSlerp Spherical Linear Interpolation functions RtSplinePVS Utility functions to allow PVS generation using spline paths RtTIFF Tag Image File Format image format handling RtTile Tiled rendering functions (used mainly for very highresolution renderings) RtTOC Table Of Contents for a stream RtVCAT Vertex Cache Aware Tri-stripper RtWing Winged edge/half-edge RtWorld Utility functions to be used in conjunction with RpWorld RenderWare Graphics Architecture RtWorldImport Utilities for creating RpWorld objects from foreign data formats Don’t extend but to make use of RenderWare Graphics features. conversion optimization management on-line and off-line

59 Using RW plugin Use the default memory handler with freelists and set arena size : RwEngineInit( NULL, 0, resArenaSize) Attach plugins : /* Attach Plugins */ if (!RpWorldPluginAttach()) { /* Something went wrong so, */ /* either display an error message, */ /* or just crash.*/ return FALSE; } Code to choose display device, format and other parameters : RwEngineOpen(&openParams); /* Start Engine */ RwEngineStart(); /* "We have ignition!" */ With the plugins attached, calling their functions is now possible: ... /* Render World */ RpWorldRender(); /* Render the RpWorld object. */ As with toolkits, plugins also have to have associated libraries and header files that must be included in your build. Merely attaching them is not enough.

60 Creating your own Plugin
2 parts : An exposed one : other developers will use Housekipping tasks : initialization, shutdown, memory allocation, attachment to other plugins, steaming Extention vs Derivation Do we need to extend all the objects ? (add physic data to physical and not physical objects) A new object can be created only if necessary

61 Plugin Attach RpClumpPhysicsPluginAttach(void) { RwInt32 offset; /*
* Register global space... */ GlobalOffset = RwEngineRegisterPlugin(sizeof(PhysicsGlobals), MAKECHUNKID(rwVENDORID_CRITERIONTK, rwID_EXAMPLE), PhysicsGlobalDataConstructor, PhysicsGlobalDataDestructor); if( GlobalOffset < 0 ) return FALSE; * Register clump extension space... LocalOffset = RpClumpRegisterPlugin(sizeof(PhysicsLocals), PhysicsDataConstructor, PhysicsDataDestructor, PhysicsDataCopier); if( LocalOffset < 0 ) return FALSE; * Register binary stream functionality for extension data... offset = -1; offset = RpClumpRegisterPluginStream( PhysicsDataReadStream, PhysicsDataWriteStream, PhysicsDataGetStreamSize); if( offset != LocalOffset ) return FALSE return TRUE; }

62 Constructor Exemple #define PHYSICSLOCAL(clump, var) (RWPLUGINOFFSET(PhysicsLocals, clump, LocalOffset)->var) static void * PhysicsDataConstructor(void *clump, RwInt32 offset __RWUNUSED__, RwInt32 size __RWUNUSED__) { if( LocalOffset > 0 ) PHYSICSLOCAL(clump, speed) = 0.0f; PHYSICSLOCAL(clump, bounciness) = 0.0f; PHYSICSLOCAL(clump, active) = TRUE; } return clump;

63 Exporter and Visualizer
Template files modification by the UI Scripting RenderWare_Exporter.AssetMgr.SetCustomizedAssets(true) select $MyCharectorRoot -- Create asset of the current selection myAsset = RenderWare_Exporter.AssetMgr.CreateAsset() -- Change the name of the asset so we know it's special. myAsset.baseObject.name = "Script created Asset 01“ -- Change the template of the asset. myAsset.template_name = "Animated Hierarchy.rwt“ -- Change the options of the asset to animated hierarchy options, setting a start and end animation time. myAsset.options = #("INT:EXPORTENDTIME=40", "INT:EXPORTSTARTTIME=20") Exporter API Filter Scene graph modification, … How to extend the exported datas : Plugin with the api (exemples) User data (by script) -- export data for an object custAttributes.add $Box01 myattrib $Box01.mydata.TargetApp = "RenderWare" $Box01.mydata.DataType = "Object" $Box01.mydata.myint = 1 $Box01.mydata.myfloat = 2.5 $Box01.mydata.mystring = "Test"

64 Platforms Multiplatform hierarchy optimized for each platform :
RW Plugin implementation using Sctatch pad, VU code, …. on PS2 Vertex/Pixel Shader, SSE, MMX, …. on PC and Xbox Additionally supported features for specific target platform : HLSL and DX9 Pixel/vertex shader VU and VCL framework and examples

65 Code exemple : HLSL Pipeline
This RW example is a modified clmpview app that supports fx file set to RpMaterial. The fx file can be applied to a material by dropping the fx file onto the window when a dff is loaded. Or by setting a fx file to the RpMaterials.The pipeline has support for standard RenderMonkey matrices and vectors such as the world view projection matrix. For example a shader using the variable world_view_proj_matrix the pipeline will know to upload the world view projection matrix to this variable. The code for this can be found in SetStdRenderMonkeyShaderConstant. When a fx file is load the menu is updated to include the shader constant variables so these can be adjust at runtime. Standard RenderMonkey variables are not added to the menu.

66 Fx file example // a white surface, lit by a white light
// the light color and direction can be changed in the viewer float4 mylightcolor = { 1.0, 1.0, 1.0, 1.0 }; float3 lightDirection = {0.0f, 0.0f, -1.0f }; technique T0 { pass P0 pixelshader = NULL; fvf = XYZ | Normal; vertexshader = NULL; // enable a single, colored light MaterialDiffuse = {1.0, 1.0, 1.0, 0.0}; MaterialAmbient = {0.1, 0.1, 0.1, 0.0}; LightType[0] = DIRECTIONAL; LightDiffuse[0] = (mylightcolor); LightSpecular[0] = {0.0f,0.0f,0.0f,0.0f}; LightAmbient[0] = {0.0f,0.0f,0.0f,0.0f}; LightDirection[0] = (lightDirection); LightRange[0] = f; LightEnable[0] = TRUE; Lighting = TRUE; CullMode = None; ColorOp[0] = SelectArg1; ColorArg1[0] = Diffuse; ColorOp[1] = Disable; }

67 How to attach the fx file to the material
To set a fx file to a material userdata is used. This can be set in Max using Max Script as explain in the chapter "5.4 Adding Custom Data" of TechnicalArtistGuide.pdf. The userdata should be called "fxfile" and the data should be the path of the fx file. An example file ./models/gumbo.max is supplied and has two materials body and tusk and each material has its onw fx file. MaterialAlways is the code for loading the fx file from the material userdata. If the file does not exist, the directory ./models/ will also be searched.

68 The rendering pipeline
The pipline creation : tatic void PipelineOpen(void) { RxPipeline *pipe = NULL; RxPipelineNode *allinone = NULL; RxLockedPipe *lpipe; RxNodeDefinition *nodedef = NULL; void *success; assert(0 == Module.numInstances); pipe = RxPipelineCreate(); nodedef = RxNodeDefinitionGetD3D9AtomicAllInOne(); assert(pipe); lpipe = RxPipelineLock(pipe); assert(lpipe); success = RxLockedPipeAddFragment(lpipe, NULL, nodedef, NULL); assert(success); success = RxLockedPipeUnlock(lpipe); allinone = RxPipelineFindNodeByName(pipe, nodedef->name, NULL, 0); assert(allinone); RxD3D9AllInOneSetInstanceCallBack(allinone, myInstanceCB); RxD3D9AllInOneSetRenderCallBack(allinone, myRenderCB); RxD3D9AllInOneSetLightingCallBack(allinone, NULL); Pipeline = pipe; return; }

69 The instance callback … Create the vertex buffer
numTextureCoords = RpGeometryGetNumTexCoordSets(geometry); if (numTextureCoords) { RwInt32 n; for (n=0; n<numTextureCoords; n++) declaration[declarationIndex].Stream = 0; declaration[declarationIndex].Offset = offset; declaration[declarationIndex].Type = D3DDECLTYPE_FLOAT2; declaration[declarationIndex].Method = D3DDECLMETHOD_DEFAULT; declaration[declarationIndex].Usage = D3DDECLUSAGE_TEXCOORD; declaration[declarationIndex].UsageIndex = n; declarationIndex++; offset += sizeof(RwTexCoords); vertexStream->stride += sizeof(RwTexCoords); vertexStream->geometryFlags |= (rpGEOMETRYLOCKTEXCOORDS1 << n); }

70 Render callback static void
myRenderCB(RwResEntry *repEntry, void *object, RwUInt8 type, RwUInt32 flags) { while (numMeshes--) {… material = (const RpMaterial *)instancedData->material; effectData = DX_EFFECT_MATERIAL_GET_DATA(material); d3dxEffect = effectData->d3dxEffect; hr = d3dxEffect->lpVtbl->Begin(d3dxEffect, &numPasses, 0); if (SUCCEEDED(hr)) for (i=0; i<numPasses; i++) { … if (noTextures) const D3DCAPS9 *d3dCaps; d3dCaps = (const D3DCAPS9 *)RwD3D9GetCaps(); for (j=0; j<d3dCaps->MaxTextureBlendStages; j++) IDirect3DDevice9_SetTexture(D3DDevice, j, NULL); } for (j=0; j<effectData->numHandles; j++) switch (effectData->handles[j].type) case MAT_EFFECT_HANDLE_FLOAT: d3dxEffect->lpVtbl->SetFloat(d3dxEffect, effectData->handles[j].handle, effectData->handles[j].d3dVector.x); break; …} d3dxEffect->lpVtbl->Pass(d3dxEffect, i); if (resEntryHeader->indexBuffer != NULL) RwD3D9DrawIndexedPrimitive((D3DPRIMITIVETYPE)resEntryHeader->primType, instancedData->baseIndex,0, instancedData->numVertices, instancedData->startIndex, instancedData->numPrimitives); instancedData++;

71 Thank you


Download ppt "???."

Similar presentations


Ads by Google