screen space decals in warhammer 40,000: space marine
DESCRIPTION
My Siggraph 2012 presentation slides on Screen Space Decals in Warhammer 40,000: Space Marine. SSD is similar to Deferred Decals, so I focused more on the problems we had and how we solved(or avoided) themTRANSCRIPT
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Screen Space Decals in Warhammer 40,000: Space Marine
Pope Kim Sr. Graphics Programmer
Relic Entertainment (past)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Traditional Decals
Sometime between 2008 and 2009, I was given a task
to implement a decal system
So I researched what other games are doing
Quick 2 min review on shooting a bullet against a wall
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
A Wall with 4 Verts
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Bullet Hits Here
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Want to Draw a Dent Texture
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
But How?
Draw this texture at the collision point
To draw a texture, we need a mesh
So let’s draw a textured rectangle mesh
But how can we generate the rectangle mesh that fits?
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Find Smallest Mesh Patch Covering It
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Duplicate the Mesh Patch
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
And Draw
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Two Traditional Solutions
1. (very easy) Increase the resolution of underlying
geometry
2. (not so easy) Magically calculate correct UV for each
verts
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
1. Wall with Many Verts
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
2. Calculate Correct UVs
(-4.5, -3.2) (3.4, -3.2)
(-4.5, 4) (3.4, 4)
(0, 0)
(1, 1)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Still Problems
1. Increase the resolution of underlying geometry
– Slower to iterate
– More memory foot print
2. Wasted rasterized area = too much overdraw
– Edge of textures must be transparent
– Wasted rasterized area = too much overdraw
– UV calculation is tricky with complex geometries
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
UV Calculation is Not Easy
How would you
calculate decals UVs
from this statue?
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Brilliant Idea?
So you would think we made Screen Space Decal to
solve these problems?
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Brilliant Idea?
So you would think we made Screen Space Decal to
solve these problems?
NO.
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Brilliant Idea?
So you would think we made Screen Space Decal to
solve these problems?
NO.
The old way was simply too hard for me….
But SSD ended up solving these problems.
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Screen Space Decals (SSD)
Similar techniques were introduced by other developers
in the recent years
Deferred Decals (Jan Krassnigg, 2010)
Volume Decals (Emil Persson, 2011)
SSD was developed independently, but the
implementation details is very similar
So a quick review
More on how we used SSD and solved the problems
with SSD
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
SSDs in Space Marine
Not just for FX
It's literally used everywhere:
Blood splat on the wall or ground
Stone wall decoration
Burnt mark on concrete slate
Ork painting
Rubble piles on the ground
Bullet holes
Explosion damage
......and list goes on
Yup, environment artists loved it!
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window SSD ON
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window SSD OFF
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Implementation Details
1. Draw underlying geometries onto scene
2. Rasterize a SSD box
3. Read the scene depth for each pixel
4. Calculate 3D position from the depth
5. If this position is outside of the SSD box, reject
6. Otherwise, draw the pixel with the decal texture
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window Given This Scene
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window We Want to Draw This
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 1. draw underlying geometries
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 2. rasterizer a SSD Box
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 2. rasterizer a SSD Box
No not this!
We want to use it as a
projection box
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 3. read scene depth for each pixel
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
4. calculate 3D position from depth
float2 screenPosition = clipPosition.xy / clipPosition.w;
float2 depth_uv = screenPosition * float2(0.5f, -0.5f)
+ float2(0.5f, 0.5f);
depth_uv += ScreenDimension.zw;
float sceneDepth = tex2D(DepthMap, depth_uv).r;
float4 scenePosView = float4(clipPosition.xy * sceneDepth
/ (Deproject.xy * clipPosition.w), -depth, 1);
Half-pixel Offset Basically
Deproject.X = ProjectionMatrix.M11;
Deproject.Y = ProjectionMatrix.M22;
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window
INSIDE
OUTSIDE
OUTSIDE
5. if outside of SSD box, reject
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
5. if outside of the SSD box, reject
• Simply transform the position to object space
• Then anything bigger than 0.5 is outside
position = mul(scenePosView, InvWorldView);
clip(0.5f - abs(position.xyz));
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 6. Otherwise, draw decal
// Decal Texture UV
float2 uv = position.xz;
uv += 0.5f;
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window Now Lighting is Free
Without SSD
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window Now Lighting is Free
With SSD
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window and combiner pass is same
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window and combiner pass is same
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window and combiner pass is same
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Mix-n-Match
Artists can choose not to draw decals either in Gbuffer
or combiner pass
Another free gift from light-prepass renderer
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window Both Gbuffer and Combiner
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window Only Gbuffer
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window Only Combiner
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
More Examples (both)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
More Examples (both)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
More Examples (GBuffer)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
More Examples (GBuffer)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
More Examples (Combiner)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
More Examples (Combiner)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Artist Control
Artists make *.ssdecal file,
which is just an XML
In level editor, artists can
drag and drop any SSD
From there, it’s
WYSIWYG & tweakable
per instance
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Problems & Our Solutions
1. Alpha Blending
2. Dynamic Objects
3. Side Stretching
4. Clipped Decals
5. Performance
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
1. Alpha Blending(Normal)
• Transparent objects in combiner pass are fine
• Transparent objects in Gbuffer are NOT
– Originally just alpha test
– Later enabled with Best Fit Normal by Crytek
– 3 months later, found a bug in our implementation of Best Fit
Normal: just same as our old normal buffer
– Artists never complained about weird normal blending. So we are
still doing it
– Mathematically wrong, but whatever
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
1. Alpha Blending(Spec Power)
• Alpha channel of Gbuffer is specular power
• Cannot simply use normal alpha blending
– alpha output from SSD shader is used for RGB(normal) blending
– Solution: Blend Factor!
AlphaBlendFunction = BlendFunction.Add;
AlphaSourceBlend = Blend.BlendFactor;
AlphaDestinationBlend = Blend.InverseSourceAlpha;
BlendFactor = ssd.SpecularPower / 255.0f;
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 1. Alpha Bleding(Spec Power)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 1. Alpha Bleding(Spec Power)
Power = 128
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 1. Alpha Bleding(Spec Power)
Power = 128
Power = 40
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 2. Dynamic Objects
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 2. Dynamic Objects
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
2. Dynamic Objects
• We could’ve attached the decal on moving objects
• But skinned mesh(e.g, ork arms) is still a problem
• So we simply didn’t draw any decals on dynamic objects
• Used a simple stencil buffer technique
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window Stencil
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 2. Dynamic Objects
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 3. Side Stretching
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
3. Side Stretching
• Happens when SSD box’s projection surface is not
completely inside of underlying geometry
• Tried different ways
• But ended up doing rejection based on the angle
difference between decal box and underlying normal
from GBuffer
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 3. Side Stretching
90 degree
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
3. Side Stretching
Anything above this
degree will be clipped
180 degree means no
clipping based on angle
We found 60 degree
works generally great
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
3. Side Stretching
1. Find box’s orientation In Vertex Shader:
output.Orientation = normalize(WorldView[1].xyz);
2. gNormalThreashold is cos(degree)
3. Read GBufferNormal and clip in Pixel Shader
float3 normal = DecodeGBufferNormal( tex2D(
GNormalMap, depth_uv ) );
clip(dot(normal, orientation) - gNormalThreshold);
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
3. Side Stretching
• Alternatives we tried instead of hard clip
– smoothly fade away based on angle between box orientation and
vertex normal: looks horrible on “round” pipes
– smoothly fade away based on angle between box orientation and
Gbuffer normal
• makes everything a bit too faint for existing arts
• With noisy gbuffer, artists liked hard clip more
• Still worth trying for your games
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
4. Clipped Decals
• Doesn’t happen often environment decals
– Thin decals carefully placed for performance reason
• Happens often with big FX explosion craters
– When camera is inside of a decal box
– No rasterization
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 4. Clipped Decal (OK)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 4. Clipped Decal (OK)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 4. Clipped Decal (BAD)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 4. Clipped Decal (BAD)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
4. Clipped Decals(Solution)
• When camera is colliding with a decal
• We draw backface with flipped z-test, instead
• Bad for Performance
– No Hi-Z
– But mostly problem with FX decals and we have an “amazing” way
of solving this (see next slides)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 4. Clipped Decal (Drawing Backface)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 4. Clipped Decal (Drawing Backface)
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
5. Performance
• Avoid rasterizing pixels that will be rejected
• Avoid turning off early-Z with flipped Z-test
• So basically make decals very thin
– Environmental Decals are easy to solve
– FX Decals are not so easy
• As a result, Space Marine always runs at 30+ FPS
except when FX Decals go crazy
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
Two ways of drawing this
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
Thick
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
And Thin
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
PS Operations Wasted
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
A lot of Orks throw explosive stuff
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
Which leaves large decals like this
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
Which leaves large decals like this
Sometimes 5 of them
stacked together
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
Which leaves large decals like this
Sometimes 5 of them
stacked together
Almost 5 fullscreen passes
= only time we go down to
25 FPS
Our Solution?
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
THIS!
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
THIS!
So much overlay!
So many particles!
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
THIS!
So much overlay!
So many particles!
don’t even notice it’s slow!
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window 5. Performance
THIS!
So much overlay!
So many particles!
don’t even notice it’s slow!
Was not intentional,
but saved us
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Special Thanks
• Relic Entertainment for allowing me to present this
• Space Marine rendering programmers
• Space Marine artists for producing amazing content and
pushing us to do more work!
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
References
• ENGEL, W. 2009, Designing a Renderer for Multiple Lights –
The Light Pre-Pass Renderer. In ShaderX7: Advanced
Rendering Techniques, Charles River Media
• KAPLANYAN A. 2010, CryEngine 3: Reaching the Speed of
Light, Siggraph 2011
• KRASSNIGG, J. 2010. A Deferred Decal Rendering
Technique. In Game Engine Gems 1, Jones and Barlett
• PERSSON, E. 2011. Volume Decal. In GPU Pro 2, A K Peters
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
Got Questions?
• More info on Space Marine rendering engine:
http://www.popekim.com/2011/11/slides-rendering-
tech-of-space-marine.html
• Twitter: @BlindRenderer
• E-mail: [email protected]
Edit this text to create a Heading
This subtitle is 20 points
Bullets are blue
They have 110% line spacing, 2 points before & after
Longer bullets in the form of a paragraph are harder to
read if there is insufficient line spacing. This is the
maximum recommended number of lines per slide
(seven).
Sub bullets look like this
This slide has a 16:9 media window