shader study 2007.5.30 이동현. vision engine games helldorado the show warlord

19
Shader Study 2007.5.30 이이이

Upload: noel-page

Post on 04-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Shader Study

2007.5.30

이동현

Page 2: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Vision engine

http://www.trinigy.net/ Games

HelldoradoThe ShowWarlord

Page 3: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord
Page 4: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord
Page 5: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord
Page 6: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord
Page 7: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Shaders in the Vision Engine Multi-platform game engine

Page 8: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Shaders in the Vision Engine Effects Fallback

Fallbacks are alternative, usually simpler, versions of a complex shader that are used whenever the hardware requirements for a shader version higher up in the hierarchy are not met.

Page 9: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Shader tool in V.6.0

Page 10: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Assigning Shaders to Geometry Static Effects

Statically assigned by the artists. Do not need to be updated, removed, or replaced in runtime.

Dynamic Effects Volumetric fog Dynamic lighting

Page 11: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Dynamic Effects – point light

Do not want to assign the shader to all the objects in a scene

Page 12: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Shader assignment types Shaders that are statically assigned by artists in the production

tools: material properties, rendering styles. Shaders that are dynamically assigned in the game code – for

example, when highlighting selected objects. Volume-based shader assignments-useful for dynamic lights,

volumetric effects, and the like.

Page 13: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Rendering order Base pass

Base texture * static lighting Ex) Objects that do not have dynamic light

Zcull Save pixel processing power

Opaque objects front-to-back in order to improve early Z rejection.

Translucent objects Sorted back-to-front, to minimize visual artifacts.

Addition rendering passes The problem of finding the right rendering order gets a little more

complex.

Page 14: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Rendering order – cont There are shaders which have to be drawn before the usual

base*lighting pass is rendered. Cartoon outline shader – use vertex program to extrude the rendered geometry

along the normal vectors.

Drawn as an additive blend pass after the base*lighting pass. Such as additional rendering passes for dynamic lights.

Should be rendered after almost everything else. For effect Not properties of the rendered surface itself, but rather properties of the space

between the rendered surface and the camera.

Page 15: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Rendering order – cont

A bad idea If static geometry is actually behind the translucent primitives?

All effects on translucent primitives would have to be rendered right after rendering the primitive itself. – not very feasible due to performance reason.( too many state changes )

Render the effects passes separately for opaque and translucent primitives.

Page 16: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Rendering order – cont

As long as the artists know how to handle translucent geometry and are aware of the fact that there are limitations to be considered, a loop like the above one will be sufficient.

The problem that still has to be solved is the rendering order between the base pass and the shaders applied to the same geometry. Multi-pass rendering with multiple shaders. Render pass property is set to each fallbacks. This way, it is possible to render to render the cartoon outlines mentioned above

before the base pass is drawn, and if the geometry is illuminated by a light source, a lighting shader can be rendered on top of the base pass.

Using a sorting key ensures that the fog is always rendered last.

Page 17: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Shader Callback Functions Per-frame callback function. Per-primitive callback function.

Called for each single triangle but rather on batches of triangles.

Fur shader. – the shader loops through each single shell and increases the normal extrusion distance in each iteration.

Page 18: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Reducing Overhead for State Setup Shader-based rendering pipeline

Batching triangles with the same shader setup Reducing state setup changes.

A sorting key encoded into a single 64-bit value. Int64 iKey = (iUserKey<<48) | (iDistance<<16) | iStateSetupID;

The batches might differ in their individual diffuse base texture

Page 19: Shader Study 2007.5.30 이동현. Vision engine     Games Helldorado The Show Warlord

Textures

Procedurally generated textures into the shader system of the Vision Engine.

Custom modifier functions have to be implemented and registered and can finally be accessed in the shader definition.

Examples Converting height maps to vector maps( though for fine details, using dedicated art

tool plugins is recommended) Normalization cubemaps. All kinds of gradients and characteristic functions for texture lookups. Cel shading lookups with dedicated mipmap levels. Creating texture alpha channels for texture “color key” emulation.