Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

Go Parallel – Multicore Programming & Game Development

Ähnliche Präsentationen


Präsentation zum Thema: "Go Parallel – Multicore Programming & Game Development"—  Präsentation transkript:

1 Go Parallel – Multicore Programming & Game Development
“Die Bedeutung von Multicore in der Spieleentwicklung bei Crytek” Keynote from Gaming ISV ISV: Independent Software Vendor Martin Mittring Lead Graphics Programmer

2 Einer für alle, alle für einen
“Die drei Musketiere” Alexandre Dumas, 1844 Wikipedia: The Three Musketeers (Les Trois Mousquetaires) is a novel by Alexandre Dumas, père. It recounts the adventures of a young man named d'Artagnan after he leaves home to become a musketeer. D'Artagnan is not one of the musketeers of the title; those are his friends Athos, Porthos, and Aramis—inseparable friends who live by the motto, "One for all, and all for one". The same day, d'Artagnan is challenged to a duel by three musketeers: Athos, Porthos, and Aramis, who happen to be very close friends and who encounter d'Artagnan one after the other. The four men meet and, d'Artagnan begins to fight Athos (the first challenger). They are interrupted by the Cardinal Richelieu's guards, who threaten to arrest them because duels are forbidden by royal decree. The three musketeers and d'Artagnan unite to defeat the Cardinal's guards. In this manner, the young Gascon earns the respect and friendship of Athos, Porthos and Aramis, and becomes a soldier in the Royal Guard. This is the first step in becoming a Musketeer. It’s interesting but the wikipedia English version reads different from the German one. The English version was marked as too long and detailed. The German version has more structure, a smaller plot, list of people, references to different kind of media. The language in the German version sound less positive and the English one reads more like an Adventure. Different mentalities? Let me tell you about Crytek – because we have a lot of different mentalities – but we all fighting for the same – and it somehow works out. 1894, Maurice Leloir ( )

3 Crytek Hauptstudio in Frankfurt
3 weitere Studios (Kiev, Budapest, Sofia) Firmensprache Englisch 30+ Nationalitäten CryEngine 1: PC CryEngine 2: PC, XBox360, PS3

4 Crytek Spiele Crysis* Far Cry 2007 Electronic Arts PC 2004 Ubisoft PC
* nun auch Crysis Wars und Crysis Warhead

5 Computer Spiele Industrie
Produktion: Game (Spiele spezifischer Quellcode) Engine (Wieder verwendbarer Quellcode, Groß, Lizenzierbar) Tools (Editor, Resource Compiler, Plug-ins) Art, Design (3D Objekte, Texturen, Levels) Meilensteine (CXP, Demo, Konkurrenz, Technologie Fenster) Real-time, mehrere Plattformen, Mehrspieler, Cheating Technologie ist im schnellen Wandel: CPU, Fixed Function, Shaders, … , erneut CPU? Marketing, Publisher, Die meisten Spiele werfen keinen Gewinn ab Qualität gegen Performance Wenige % Performance erfordern mehr und mehr Arbeit Multithreading macht es nicht leichter [Sutter05] Production: Went from one guy developing a full game in the kitchen to more than 100 professionals working together years for one game. It’s hard to find good people, challenging to work together because a creative process doesn’t scale easily to multiple people, we need team players, specialists and people giving the overall direction. Engine (reusable code, big , license business): A big engine is an engine with a big source code base. It can provide a lot of features but maintaining, porting, optimizing, finding a bug is much harder. More people are required and that also means communication overhead. An engine can be licensed or licensed out, the first one simplifies game production but is rarely innovative, the second one can bring in extra money but it additional effort. We produce so much data each day, we run into all sort of problems: network bandwidth, storage capacity, main memory limits, shader compilation time, … CXP: Core X Playable – basically a small version of the game polished to define the game look and feel early during production Multiple platforms: XBox360,PS3, maybe Wii, PSP, wide range of PC hardware configuration Marketing: Technology helps to get attention Multithreading does not make it easier: but there is no way around [Sutter05]: The free lunch is over – CPU are not getting faster without doing effort on programmer side, for a while CPUs became faster without us doing anything

6 Spiel-Engine Herausforderungen
Verschiedenste HW (x CPUs, GPU, Speicher) Riesige Welten Produktionsprobleme (Kosten, Zeit, Termindruck) Massen Mehrspieler Qualitätserwartung (HDTV, Anti-Aliasing, Stereo Darstellung, stabile Frame Rate, „Uncanny Valley“) Uncanney Valley: e.g. Final Fantasy Das Diagram rechts unten zeigt das Uncanney Valley (Unheimliches Tal), mehr Details siehe Wikipedia

7 Multiprocessing in Game Engines
CPU (z.B. Doom) += Grafikkarten (Fixed Function) (z.B. Far Cry) += GPU (Shaders) (z.B. Far Cry) += x CPU (MT performancekritische Teile) (z.B. Crysis) Job basierend? Verteilt? Spezialsprache? Far Cry supported fixed function texture blending (required for e.g. GeForce4MX) and pixel shader (up to 3.0, but we avoided dynamic branching for performance reasons)

8 Warum Grafikkarten schnell sind?
OpenGL/DirectX = Erfolgreichste Multiprocessing Sprache? SIMD, VLIW (nicht immer) Optimiert für eine Anwendung (z.B. bi-linearer Filter, Speicherorganisation) Latenz wird versteckt durch verschränktes abarbeiten von Datenpakten SIMD: Single Instruction Multiple Data VLIW : Very Long Instruction Word Das Bild rechts unten zeigt wie ein Paket abgearbeitet wird, eine Instruktion mit hoher Latenz (>1 Taskzyklus) bremst dabei die nachfolgenden Befehle (abwärts) aus. Werden hingegen mehrere Pakte verschränkt abgearbeitet, läßt sich die Latenz verstecken

9 Kommen wir jetzt zu etwas völlig anderem

10 Dreiecks Rasterisierung
Fest verdrahtet in Grafikkarten Softwarerendering wird weiterhin benötigt (z.B. in CryEngine um Objekte auf Verdeckung zu testen) SW Rasterisierung hat ein Come-back (Larrabee) Gutes Beispiel wie ein Algorithmus parallelisiert werden kann … nun im Detail HW: Hardware SW: Software

11 Dreiecks Rasterisierung Gegeben: 3 Eckpunkte float2 2D Bildraster

12 Wo soll rasterisiert werden? Eine klare Definition ist essenziell:
Pixelzentrum im Dreieck, Pixels am Rand je nach Kantenrichtung (Ganzzahl) => Keine Löcher => Kein Kanten überzeichnen

13 Klassischer Ansatz Scan-Line Algorithmus Sonderfälle
Serieller Algorithmus

14 Halb- Raum Die drei Kanten definieren drei Halb-Räume,
Im Dreieck wird zu 3 Halb-Raum Tests Umschließendes Rechteck wäre ineffizient

15 Halb- Raum Pakete Paket von mehreren Pixeln muß bearbeitet werden
wenn teilweise im Dreieck Umschließendes Rechteck ist effizient für kleine Dreiecke

16 Drei Paket Typen Vollständig außerhalb => Paket verwerfen
Vollständig innerhalb => Alle Pixel bearbeiten Teilweise innerhalb => Pixel Test nötig

17 Halb- Raum mit Paketen SIMD freundlich
Ganzzahl Arithmetik (exakt, schnell) Vermeidet Verzweigungen Cache freundlich [Nicolas04] SIMD: Single Instruction Multiple Data

18 Kommen wir jetzt zu etwas völlig anderem

19 Drei Render Algorithmen
Rasterisierung (keine Folie) Ray-tracing (vier Folien) REYES (drei Folien) Die drei Methoden im Vergleich (eine Folie) (kein kompletter oder gerechter Vergleich)

20 Ray-tracing Einfach auf CPU (Stack Rekursion)
[Hauser02a] Ray-tracing Einfach auf CPU (Stack Rekursion) Raumunterteilung um Strahltests zu beschleunigen Rechenintensiv Elegante Lösung Parallel aber nicht cache freundlich Real-time problematisch Computationally intensive: Compared with rasterization Elegant solution: Compared to the rasterization hacks Image made with 3dsMax by Martin Mittring

21 Ray-tracing Generationen 1/3
Rekursive Strahl-verfolgung Harte Schatten, perfekte Reflektionen / Lichtbrechung, Verdeckung gelöst, Adaptives AA Image from NVidia real-time raytraing demo running on GPU

22 Ray-tracing Generationen 2/3
Verteilte Strahl-verfolgung [Carp84] mehr Integrations-Samples: Bewegungsunschärfe, unscharfe Reflektionen, Weiche Schatten, DOF, IBL Integration Image is the first famous distributed ray-tracing image

23 Ray-tracing Generationen 3/3
Globale Beleuchtung mehr Integrations-Samples: Indirekte Beleuchtung © GNU Free Documentation Licensee

24 REYES, Renderman Lucasfilm Computer Graphics (jetzt Pixar)
REYES (Render Everything You Ever Saw) Stylized (Cartoony) 10VAX, 2xCryXMP-2, 1xCray XMP-4 , the most powerful machine at the time (four CPUs working in parallel) 1982 XMP GFlop Todays latest GPU ~1TFLOP Motion Blur: Ed Catmull also made an attempt at this problem. He created a situation of friendly competition in the group which resulted in both teams producing a better result than they would have been without the rivalry. Actually Ed solved the problem too. Rob and Loren invested the “REYES” (Render Everything You’ve Ever Seen / Render Everything You Ever Saw) system. Rob also invented the shade trees. What we now use as shaders on the graphics hardware is basically the same. 1984 Lucasfilm Computer Graphics (jetzt Pixar) Verwendet in Pixar und vielen anderen Filmen: Wall-E, Ratatouille, Transformers, Cars, … [Pixar08]

25 REYES Rekursive Aufteilung in dice-able Primitiven
Sichtbare dice werden grids von Mikropolygonen (~ Pixel Größe) Schattierung pro grid Mikropolygon oder Punkt (Farbe und Position) Renderman Shader Sprache (C ähnliche Syntax) Renderman shader language: similar to HLSL/CG

26 REYES: Mikropolygon Abtastung
Ein Pixel besteht aus vielen verteilten Abtastpunkten DOF, AA, Bewegungsunschärfe (effizienter, weil nach Shading) A-Buffer für OIT Tiled Rendering für bessere Speicher Lokalität, für weniger Speicherverbrauch, für Parallelverarbeitung OIT: Order independent transparency DOF: Depth of Field AA: Anti-aliasing

27 Die drei Methoden im Vergleich
Rasterisierung: Aug-Strahlen, Dreiecke, Transparenzproblematik, GPU Ray-tracing: perfekte Reflektionen / Lichtbrechung, Dreiecke sind limitierend, weniger Real-time: Verteiltes Ray-tracing, Global Illumination REYES: Displacement Mapping, Level of Detail, Anti-Aliasing Shading / Beleuchtung ist orthogonal zur Methode [Hauser02b] Film Realismus statt physikalischer Korrektheit Ambient Occlusion, Hybride Lösungen Movie realism instead of physically correct: Control of the image, light placement, Lighting as a design tool (Stilmittel) AO: Ambient Occlusion, a very well established method used in movie industry and games, much faster to compute than GI and often more controllable.

28 Fazit “Die Bedeutung von Multicore in der Spieleentwicklung bei Crytek” PS3 (1*2+7 Cell) XBox360 (3*2 PowerPC) Intel/AMD (1/2/4/?) Multi / Many Cores? Diese Präsentation soll motivieren, dafür benutzte ich mein Lieblingsthema: Computergrafik

29

30 Querverweise [Nicolas04] Advanced Rasterization, DevMaster.net [Carp84] Distributed Ray Tracing, Siggraph [Hauser02a] CGR4- Raytracing (German) [Hauser02b] CGR4- Beleuchtung (German) [Sutter05] Herb Sutter, The Free Lunch Is Over Dr. Dobb's Journal, 30(3), March [Pixar08] Renderman Movies


Herunterladen ppt "Go Parallel – Multicore Programming & Game Development"

Ähnliche Präsentationen


Google-Anzeigen