Sunday, August 4, 2019

Research (Decals)

What is a Decal?

  • Shader
  • Used for placing material onto pre-existing material.
  • Decal can also be layered, simple or complex
  • It can be art directed.

There are many types of decals such as...
  • Mesh based
  • Deferred Screen Space decals
  • Dbuffer Decals (UE4)
I'll be focusing on Dbuffer Decals in UE4 in my Rage 2 Interior Scene
  • This type of decal will not work for skinned meshes. Can attach but will slide not deform
  • It is also projected on a plane, draws info about objects to each pixel.
Render a Screen aligned quad or box 
  • Pixel shader reconsructs pixel position from G-bufer and project decal texture onto it.
  • Only works with deferred rendering
  • In UE4, this can be written into Dbuffer, to allow for decals to display with indirect/static lighting.


Rage 2 Scene without Decals
With Decals
(Decals can pickup lighting info due to lightmaps.)
Wall itself with Decals
Can do more than just flat colors, can mimic water effects, etc

Runny pipe with rust decal effects.

Benefits of using Decals
  • Control over placing textures, adding Variety
  • Visually, allow us to see changes faster than modifying a mesh or modifying materials.
  • Decals for both planar projections and mesh-based. Decal methodology applicable for other VFX.

Issues or downsides to Decals

•Overdraw
•Layering decals means you are layering opacity
•More stacked decals = more overdraw = more expensive…

•Z-Fighting
•Mesh based decals, Plane hosted decals will in some instances cause Zfighting

•Static Planar Projections
•Stretching
•Will project on all actors inside projection area unless specified.

•Blend visibility
•Fix: Early Z-pass to include opaque and masked meshes
•Great for alpha heavy scenes.
•Improves overdraw on Pixels BUT moves some of that cost to pre-pass and effectiveness is really depended on triangle count vs overdraw...

•Limitations
•Normal blending doesn’t wrap correctly – artifacts
•MIP/MAP not fully implemented in UE4, so 2x2 block artifacts in some cases
•Can’t be streamed (ue4)
•Decal ID (assign to certain object) is not completely implemented in UE4

Decal Pricing. How to mix/max
•Instead of manually texturing every object in the scene, use seamless/tileable (procedural) textures, and use Decals as a way of adding in variety.
•Can not simply rely purely on Decals to do heavy lifting and expect optimized results.

•When to use which decal?
  • Context/Budget based.
  • How reusable are decals? (Instancing)?
  • How many draw calls compared to texturing differently?
  • Can you incorporate it into existing textures that are being reused?

•Decal performance depends on shader complexity and screen space
•Mesh complexity is NOT affected by the decal.
Decals use opacity masks, however since Decal blend modes are translucent, they CAN accept a value for transparency.

Research (Decals)

What is a Decal? Shader Used for placing material onto pre-existing material. Decal can also be layered, simple or complex It can be a...