• Keine Ergebnisse gefunden

Rendering in Games

N/A
N/A
Protected

Academic year: 2022

Aktie "Rendering in Games"

Copied!
30
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Page 1

Modern computer and video games rendering techniques and how they can be used besides games in other fields

of computer graphics such as cinematic rendering.

Folker Schamel, Spinor GmbH

Talk presented at Eurographics 2006, Vienna, Austria

(2)

Page 2

Rendering in Games

Performance is very important.

Below 20 fps is not acceptable in any situation.

Static vertex / index buffers.

Skinning on the GPU.

Waving grass, plants, tree on the GPU

Good quality by simple tricks.

Many detailed textures.

No wasting of polygons.

A lot of faking.

For example shadowing.

(3)

Page 3

Rendering in Games

Static world and dynamic objects often use different rendering techniques.

For example regarding shadowing and animation.

Special effects play an important role.

For example particles (explosions, clouds).

Normal mapping

Post rendering effects.

APIs: Direct 3D and console APIs.

Open GL is basically not used anymore for games.

(4)

Page 4

Precalculated

Lighting and Shadowing

Runtime performance is always the same for any number of light sources.

Artist can use any number of lights she wants.

Typical techniques are:

Precalculated lighting in texture maps.

Precalculated radiosity as lightmap.

Precalculated specularity

For example stored in per-vertex or per-texel spherical harmonics

(5)

Page 5

Partial Precalculated

Lighting and Shadowing

Position-dependent precalculated lighting for dynamic objects.

For example storing spherical harmonics

coefficients for different positions in the world and interpolate between them for rendering a character.

Projected textures on dynamic objects.

For example lighting of church window onto characters.

(6)

Page 6

Per-Object Shadowing Textures

Shadowing texture per-object,

which is projected onto the environment.

Possible rendering techniques:

Applied in main rendering pass.

Separate additive lighting pass.

Rectangle rendered in screen space.

(7)

Page 7

Per-Object Shadowing Textures

Simple dynamic soft shadows.

More efficient filtering than depth shadow maps:

Work is logarithmic instead of linear in softness.

Allows faked distance dependent softness.

Requires render-to-texture per object each frame.

Does not scale well with many objects.

(8)

Page 8

Shadow Volumes

Simple shadow volumes:

Dynamic objects cast shadow onto environment No lighting computations.

Shadowed area is just darkened.

Full-scene shadow volumes:

Each object can cast shadows onto itself and all other objects.

Per pixel lighting possible.

(9)

Page 9

Shadow Volumes

Shadow volume extrusion with DX9:

Exact extrusion not possible on GPU in vertex program.

Theoretically possible on GPU by render-to- vertex-buffer, but not used in practice.

Approximated extrusion possible on GPU in vertex program. But has more artifacts.

Shadow volume extrusion with DX10:

Will support exact extrusion in geometry shader.

(10)

Page 10

Shadow Mapping

Full-scene shadowing

Quite simple to implement.

Quite efficient.

Used in many games.

Main problem: Depth map pixel artifacts.

(11)

Page 11

HDR

Combined with post rendering effects

For example blooming

Float textures:

Problem: Blending and transparencies.

Alternative to float textures:

Non-linear mapping of color space.

(12)

Page 12

Larger Levels

Visibility techniques.

Precalculated, e.g. PVS.

Manually defined, e.g. portals.

Realtime on CPU.

GPU-based occlusion culling.

Streaming

(13)

Page 13

based award winning Dreamfall on console and PC

(captured from PC; resolution of screenshot reduced)

(14)

Page 14

Natural Future Trends

Simple, but effective:

More polygons.

More complex pixel programs.

Higher resolution.

More and better antialiasing.

(15)

Page 15

Advanced Streaming

No stuttering

Handle all streaming in a separate background thread.

Requires a thorough multithreading architecture

Swapping out game states

Allows huge mutable game worlds

(16)

Page 16

Multithreaded Rendering

Main thread does no work for rendering at all.

For example, rendering thread(s) do scene traversal and animation evaluation.

Expensive work can be handed over to pooled threads.

For example, animation state evaluation for individual characters is a good candidate.

(17)

Page 17

Future Trend:

Better Rendering Quality

Better lighting:

Better real-time lighting and shadowing.

More dynamic light sources.

(18)

Page 18

Realistic hard and soft shadowing

from high-performance real-time area lights

(captured from Xbox 360 running in HD; resolution of screenshots reduced)

(19)

Page 19

Realistic hard and soft shadowing

from high-performance real-time area lights

(captured from Xbox 360 running in HD; resolution of screenshots reduced)

(20)

Page 20

Changes you can update live include:

- Textures - Sound files - Shaders

- Vertex and pixel programs - Lights

- Object positions - Object geometry - Mapping coordinates - Animations

- Game logic objects (incl. error handling) - Perch scripts (incl. error handling)

- ...

Shark 3D Live Editing

Update changes inside editing tools(for example 3ds Max, Maya, Photoshop,

proprietary tools) live into the running engine

on all platforms (including consoles).

(21)

Page 21

Static trees

(BSP, static octree, ...) - Do not work well for dynamic objects

Scene graphs

- Do not work well for dynamic objects

- Do not work well with advanced non-local rendering techniques

- Unnatural relation between logical object hierarchy and spacial relations

Generic

object space

- Works excellently for many dynamic objects

- Works excellently for advanced non-local rendering features

- Shaders have generic access to object space

- Decouples logical object hierarchy and spacial relations

Open Architecture

by Generic Scene Management

A generic scene management is an important foundation

for high-end rendering features and for modularity in the renderer.

(22)

Page 22

Renderable elements

Backends

Shader components

DirectX Console OpenGL DRU Utilities

Hardware Graphical Representation

Mechanism 3d State

Mechanism

Shader Manager

Render Job Mechanism Instancing

Mechanism

Shader Component

Groups

Object Space Database Shader

Component Linker

Registration

Generic Enumeration Vertex/Pixel

Shader Manager Generic parameter passing Generic

Static Dataflow Mechanism

Generic Dynamic Dataflow Mechanism

Render target management Batch Management

Non-local Dynamic Communication

Shark 3D as

Generic Open Renderer Platform

(23)

Page 23

The main rendering code is completely independent from particular advanced rendering features.

Shark 3D Modularity Sample:

Main Rendering Code is Generic

s3d_CEngGfxTaskArray TaskArray;

s3d_CEngGfxCycle *Cycle = CollectNewCycle(

Run, Cam, m_Trigger, TaskArray);

s3d_CEngUtilGfxElemJobBegin::AddGfxBegin(

m_MsgHandler, m_Info.GetChars(), Cycle,

m_DestProp, m_ClearParam, TaskArray, BeginMain);

s3d_CEngUtilGfxUtil::ExecTaskArray(TaskArray, 0);

Shark 3D's main rendering code:

(24)

Page 24

Examples: Different lighting techniques; multiple passes; rendering order; simple shadow volumes &

shadow maps; advanced soft shadowing techniques;

dynamic mirroring (planar, environment map etc.); post rendering effects; various render-to-texture techniques;

effects requiring complex scene enumeration; PVS; ...

Even advanced, non-local rendering techniques

can be implemented in separate modules.

Shark 3D Modularity Sample:

Rendering Features in Modules

class s3d_CEngGfxElem: public s3d_CUtilRecogEyeBase {

public:

s3d_CEngGfxElem();

virtual void GfxElemExec(

s3d_CUtilRecogBase *GfxElemCtx, s3d_CUtilAtom *Trigger,

s3d_CDrvVarBlk_cr ParamVarBlk, s3d_CEngGfxTaskArray &TaskArray);

};

Generic interface for implementing rendering modules in Shark 3D:

(25)

Page 25

Shark 3D

Modular Shader System

std

redirect rectmesh

bundle

directtexchan drvlightcoll

drvlightenum

group lightenter lightenum lightparam

projmat regionenter

meshenter

multi paintmesh

constvec variants

special

filter func opticsdirect

opticstex particenter

shvol enum

occluder

user

user 2 user 3 user 4 user 4 user 5 perform

combineparam

lenparam billboardmesh

envmap multilight screenparam

plain projtotex

addvec

animactu animgen

collexec coloralpha

constfloat constmat duptexchan

fog modelmesh

modeswitch

mulmat totex

translmat

user 1

Sample of Shark 3D standard shader components:

(26)

Page 26

is used by three of the four biggest German broadcasters

(captured from TV; resolution of screenshots reduced)

(27)

Page 27

Game Renderer Features

usually not used for non-Gaming

Large world management usually not needed

No need for example for PVS, portals

Console platform support

(28)

Page 28

Game Renderer Features

usually used also for non-Gaming

Most rendering features

Including lighting and shadowing

Performance optimizations

Runtime optimizations and tool pipeline optimizations

(29)

Page 29

Additional Features

required for non-Gaming

Distributed rendering.

For example, Shark 3D was used for Cave rendering

Linux platform support.

(30)

Page 30

Thanks for your attention!

Referenzen

ÄHNLICHE DOKUMENTE

Given a shadow map depth value distribution with mean and variance (for certain kernel), the probability P(x >= d) that a random depth value z drawn from this distribution

GLSurfaceView.Renderer interface Rendering runs in own thread..

// shadow texture coords in projected light space SM_tex_coord = texture_matrix * V_cam * M * vertex;.

extend our model of light transport for materials that allow perceivable light penetration and.. perceivably interact

Translating scene graph input structure directly (in one step) into graphics instructions is hard. Can we approach the

At each bounce, use light source sampling to get direct illumination Use BRDF sample to generate new direction to collect indirect light.

[1] Physically Based Rendering (course book, chapters 8 and 9 for materials, chapter 11 for volume rendering) [2] Background: Physics and Math of Shading by Naty Hoffman. [3]

apply skeletal animation in skeleton space for each affected vertex compute deviation from relevant poses in pose space (a falloff ensures that only the most „relevant“ poses