SlideShare a Scribd company logo
1 of 88
Download to read offline
Dynamic Wounds on Animated Characters
in UE4
Michał Kłoś, Layopi Games
Game Industry Conference 2017
Download Slides
About me
Now Shader/VFX Artist Lead at Layopi Games
Lead Native Dev at VR Global
Unity & Web Dev at TK Games
Agenda
• Intro to wounds in games
• Popular methods
• Effect features and problems
• Effect meets profiling and gameplay
• Final comparison
Intro to wounds in games
Intro to wounds in games
Wounds and dismemberment:
• Mortal Kombat
• Metal Gear Solid
• Dead Space
• Fallout
• Shadow Warrior 2
• Shadow of Mordor
and many more …
https://www.youtube.com/watch?v=RIUYi9JuMKQ
Fallout
Mortal Kombat
Dead Space
Shadow Warrior 2
Metal Gear Solid
Intro to wounds in games
Why game need wounds:
• Visual feedback to damage
• Minimize UI, Healthbars
• Give satisfaction from combat
• Juiciness: persistence
Intro to wounds in games
Does your effect make sense? Need to follow character and game design!
vs vs
Intro to wounds in games
Alternatives?
Fixed presets
… why not combine both?
Hellblade: Senua's Sacrifice
www.youtube.com/watch?v=5aAgBAO9Lwc
Intro to wounds in games
Popular methods:
• Ryan Brucks Unwraped Capture
• Tom Loomans PreSkinned Position
?
Dedicated system fitting:
• Creative and Art Director’s
Vision
• Game Requirements
Intro to wounds in games
Popular methods:
• Ryan Brucks Unwraped Capture
• Tom Loomans PreSkinned Position
?
Dedicated system fitting:
• Creative and Art Director’s
Vision
• Game Requirements
Case study: fighting with blades
Decal projection makes it slide on animated meshes, it is bad!
Material with masked damage even allows for animation of strokes, we want this!
Popular methods
Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve
https://alex.vlachos.com/graphics/Vlachos-GDC10-Left4Dead2Wounds.pdf
Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve
https://alex.vlachos.com/graphics/Vlachos-GDC10-Left4Dead2Wounds.pdf
Their problems
• Memory limits
• Performance Constraints
• Character variations
• LOD
• Avoid mesh generation
Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve
https://youtu.be/5_G79LJ_l2Y
Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve
https://www.youtube.com/watch?v=CHbnP5SAMzI
Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve
https://alex.vlachos.com/graphics/Vlachos-GDC10-Left4Dead2Wounds.pdf
Popular Methods
• Ryan Brucks Unwraped Capture
• Tom Loomans Preskinned Position
Popular Methods
Problems
• Calculate mask on surface of animated geometry
• Keep updatable mask between frames
Popular Methods
• Ryan Brucks Unwraped Capture
• Requires SceneCapture
• Each masked pixel need captured position
• Copy animation or use animated mesh
• Tom Loomans Preskinned Position
Popular Methods
• Ryan Brucks Unwraped Capture
• Requires SceneCapture
• Each masked pixel need captured position
• Copy animation or use animated mesh
• Tom Loomans Preskinned Position
• Hit calculation done in Rest Pose
• Hit need transformation into Rest Pose
ex. Bone Transform from Trace
Popular Methods
Ryan Brucks Unwraped Capture explained
Ryan Brucks Unwraped Capture explained
Ryan Brucks Unwraped Capture explained
Popular Methods
Ryan Brucks Unwraped Capture explained
Ryan Brucks Unwraped Capture explained
Ryan Brucks Unwraped Capture explained
Unique UV, outtake on texture morph animation that happens when UVs are mirrored
Tom Loomans PreSkinned Position explained
Red: Animated Bone Transform, Green: RestPose Transform, Blue: Inverse Animartion + RestPose Transform
Tom Loomans PreSkinned Position explained
Effect features and problems
Effect Features and Problems
• Blending with character material
• Fitting shape of obstacle
• Dotted on fast movement of obstacle
• Variable number of obstacles and draw calls
• Impact of hit
• Hits from random limb collisions
MaterialAttributes Functions, Blending with mask
Ryan Brucks Unwraped Capture, Require 2 RenderTargets per each Character
Effect Features and Problems
Fitting shape of obstacle
Signed Distance Fields (SDF)
What info gives us SDF?
Signed Distance Fields (SDF), What info gives us SDF? https://www.shadertoy.com/view/ldK3zD
Effect Features and Problems
Fitting shape of obstacle
http://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float sdSphere ( vec3 p, float r ) {
return length(p)-r;
}
Effect Features and Problems
Fitting shape of obstacle
http://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float sdCapsule (vec3 p, vec3 a, vec3 b, float r) {
vec3 pa = p-a, ba = b-a;
float h = clamp(dot(pa,ba)/dot(ba,ba), 0.0, 1.0);
return length(pa-ba*h)-r;
}
Appear dotted on fast movement of obstacle
Effect Features and Problems
Appear dotted on fast movement of obstacle
Keep info from previous frame
Sphere + Sphere = Capsule
Capsule + Capsule = Quad
+
+
=
=
Effect Features and Problems
http://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float dot2(in vec3 v) { return dot(v,v); }
float udQuad (vec3 p, vec3 a, vec3 b, vec3 c, vec3 d) {
vec3 ba = b-a; vec3 pa = p-a; vec3 cb = c-b; vec3 pb = p-b;
vec3 dc = d-c; vec3 pc = p-c; vec3 ad = a-d; vec3 pd = p-d;
vec3 nor = cross(ba, ad);
return sqrt((sign(dot(cross(ba,nor),pa))
+sign(dot(cross(cb,nor),pb))
+sign(dot(cross(dc,nor),pc))
+sign(dot(cross(ad,nor),pd)) < 3.0)
? min(min(min(dot2(
ba*clamp(dot(ba,pa)/dot2(ba),0.0,1.0)-pa),
dot2(cb*clamp(dot(cb,pb)/dot2(cb),0.0,1.0)-pb)),
dot2(dc*clamp(dot(dc,pc)/dot2(dc),0.0,1.0)-pc)),
dot2(ad*clamp(dot(ad,pd)/dot2(ad),0.0,1.0)-pd))
: dot(nor,pa)*dot(nor,pa)/dot2(nor) );
}
Effect Features and Problems
http://iquilezles.org/www/articles/distfunctions/distfunctions.htm
Effect Features and Problems
Splines?
Read bone animation trail from SkeletalMeshComponent?
Interpolate 2+ frames?
Did not tried
https://www.shadertoy.com/view/XdB3Ww
Effect Features and Problems
Variable number of obstacles and draw calls
Draw sum of all of them at once and count instructions
Editor do not support Material Parameters Arrays
but Global Shaders do.
Variable number of obstacles and draw calls
Effect Features and Problems
Impact of the hit
Brush like feeling vs Impact - what gives impact
Trigger stroke with Collision Trace
Trigger stroke with Collision Trace
Effect Features and Problems
Impact from random limb collisions
Animation notify with info about currently active limb for damage
Animation notify with info about currently active limb for damage
Effect Features and Problems
Multiple Characters at once
Mesh occlusion - Extents Size
Effect meet profiling and gameplay
Effect meets profiling and gameplay
Profiling and 1ms budget for VFX
UE profiling tools
SceneCapture vs RenderMaterialToTexture Performance
RenderTarget performance vs quality
WorldSpace vs LocalSpace
Blueprint for sequencer, easy to debug
Blueprint for sequencer, easy to debug
Effect meets profiling and gameplay
Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
Effect meets profiling and gameplay
Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
Numbers per MaskRenderTarget resolution:
2048 x 2048 px (RGB8, 16 MB),
SceneCapture 5.22 ms per Character
MaskRenderTarget 0.35 ms per obstacle
1024 x 1024 px (RGB8, 4 MB),
SceneCapture 1.77 ms per Character
MaskRenderTarget 0.09 ms per obstacle
512 x 512 px (RGB8, 1 MB),
SceneCapture 1.02 ms per Character
MaskRenderTarget 0.025 ms per obstacle
Effect meets profiling and gameplay
Solution:
Transform Hit to Rest Pose instead of SceneCapture
Effect need texture mask done with DrawMaterialToRenderTarget
but it draws on quad with no info about Rest Pose
...so bake RestPose to texture at start and sample each time
Effect meets profiling and gameplay
Interface for gameplay
Enqueue calls each frame and restrict limit
Service with Logic - Component with State approach,
easy to plug to character
Feed with WorldSpace vs LocalSpace
Interface for gameplay, stuctures and components
Interface for gameplay, WorldToLocal Character transformation
Interface for gameplay, MaskRenderer execution
Effect meets profiling and gameplay
Alternatives:
• Global Shaders
• ShaderDemoPlugin by Temaran
• Pixel Shader Example
• Compute Shader Example
Fork it!
Effect meets profiling and gameplay
www.unrealengine.com/en-US/blog/how-to-add-global-shaders-to-ue4
// MyTest.usf
// Simple pass-through vertex shader
void MainVS( in float4 InPosition : ATTRIBUTE0, out float4 Output : SV_POSITION ) {
Output = InPosition;
}
// Simple solid color pixel shader
float4 MyColor; float4 MainPS() : SV_Target0 {
return MyColor;
}
Global Shaders, finally!
Effect meets profiling and gameplay
ShaderDemoPlugin by Temaran
ShaderDemoPlugin by Temaran, Shader class declaration
ShaderDemoPlugin by Temaran, Uniform Structs declarations
ShaderDemoPlugin by Temaran, usage in code
ShaderDemoPlugin by Temaran, adding render command to RHI
Final comparison
Final Comparison
vs
RestPose stays in budget SceneCapture does not
Demo
Demo
Demo
Takeaways
• Make sure your effects meet design of game and characters
• Effects give visual feedback to game events
• SceneCapture renders whole scene with lights and shadows
• SceneCapture may be performed only at start or even offline saved as asset
• Rest pose is best approach for calculations
• DrawMaterialToRenderTarget is rather cheap
Questions?
Thank you
@_spolsh
github.com/sp0lsh
michal.m.klos@gmail.com

More Related Content

What's hot

「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発Unity Technologies Japan K.K.
 
NPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTER
NPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTERNPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTER
NPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTERエピック・ゲームズ・ジャパン Epic Games Japan
 
UE4×ADX2を使ったゼロから始めるサウンド開発
UE4×ADX2を使ったゼロから始めるサウンド開発UE4×ADX2を使ったゼロから始めるサウンド開発
UE4×ADX2を使ったゼロから始めるサウンド開発CRI Middleware Co., Ltd.
 
191019 Forward / Deferred Rendering
191019 Forward / Deferred Rendering191019 Forward / Deferred Rendering
191019 Forward / Deferred RenderingKWANGIL KIM
 
Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite
Physically Based Sky, Atmosphere and Cloud Rendering in FrostbitePhysically Based Sky, Atmosphere and Cloud Rendering in Frostbite
Physically Based Sky, Atmosphere and Cloud Rendering in FrostbiteElectronic Arts / DICE
 
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)Philip Hammer
 
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현MinGeun Park
 
Star Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processingStar Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processingumsl snfrzb
 
個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTER
個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTER個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTER
個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTERエピック・ゲームズ・ジャパン Epic Games Japan
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationTaking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationGuerrilla
 
UE4 LODs for Optimization -Beginner-
UE4 LODs for Optimization -Beginner-UE4 LODs for Optimization -Beginner-
UE4 LODs for Optimization -Beginner-com044
 
Bindless Deferred Decals in The Surge 2
Bindless Deferred Decals in The Surge 2Bindless Deferred Decals in The Surge 2
Bindless Deferred Decals in The Surge 2Philip Hammer
 

What's hot (20)

「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発
 
大規模CSゲームにおけるライトマス運用
大規模CSゲームにおけるライトマス運用大規模CSゲームにおけるライトマス運用
大規模CSゲームにおけるライトマス運用
 
NPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTER
NPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTERNPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTER
NPRキャラクターレンダリング総結集!今こそ更なる高みを目指して | UNREAL FEST EXTREME 2020 WINTER
 
Press Button, Drink Coffee : An Overview of UE4 build pipeline and maintenance
Press Button, Drink Coffee : An Overview of UE4 build pipeline and maintenancePress Button, Drink Coffee : An Overview of UE4 build pipeline and maintenance
Press Button, Drink Coffee : An Overview of UE4 build pipeline and maintenance
 
UE4×ADX2を使ったゼロから始めるサウンド開発
UE4×ADX2を使ったゼロから始めるサウンド開発UE4×ADX2を使ったゼロから始めるサウンド開発
UE4×ADX2を使ったゼロから始めるサウンド開発
 
191019 Forward / Deferred Rendering
191019 Forward / Deferred Rendering191019 Forward / Deferred Rendering
191019 Forward / Deferred Rendering
 
Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite
Physically Based Sky, Atmosphere and Cloud Rendering in FrostbitePhysically Based Sky, Atmosphere and Cloud Rendering in Frostbite
Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite
 
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
 
60fpsアクションを実現する秘訣を伝授 解析編
60fpsアクションを実現する秘訣を伝授 解析編60fpsアクションを実現する秘訣を伝授 解析編
60fpsアクションを実現する秘訣を伝授 解析編
 
ロボット好き集まれ!こいつ、動くぞ。星と翼のパラドクス開発事例
ロボット好き集まれ!こいつ、動くぞ。星と翼のパラドクス開発事例ロボット好き集まれ!こいつ、動くぞ。星と翼のパラドクス開発事例
ロボット好き集まれ!こいつ、動くぞ。星と翼のパラドクス開発事例
 
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
 
UE4 Hair & Groomでのリアルタイムファーレンダリング (UE4 Character Art Dive Online)
UE4 Hair & Groomでのリアルタイムファーレンダリング (UE4 Character Art Dive Online)UE4 Hair & Groomでのリアルタイムファーレンダリング (UE4 Character Art Dive Online)
UE4 Hair & Groomでのリアルタイムファーレンダリング (UE4 Character Art Dive Online)
 
Star Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processingStar Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processing
 
個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTER
個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTER個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTER
個人製作インディーゲーム”ジラフとアンニカ” のUE4 制作事例紹介 | UNREAL FEST EXTREME 2020 WINTER
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationTaking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next Generation
 
UE4における大規模背景制作事例 描画特殊表現編
UE4における大規模背景制作事例 描画特殊表現編UE4における大規模背景制作事例 描画特殊表現編
UE4における大規模背景制作事例 描画特殊表現編
 
Lightmassの仕組み ~Precomputed Light Volume編~ (Epic Games Japan: 篠山範明)
 Lightmassの仕組み ~Precomputed Light Volume編~ (Epic Games Japan: 篠山範明) Lightmassの仕組み ~Precomputed Light Volume編~ (Epic Games Japan: 篠山範明)
Lightmassの仕組み ~Precomputed Light Volume編~ (Epic Games Japan: 篠山範明)
 
UE4 LODs for Optimization -Beginner-
UE4 LODs for Optimization -Beginner-UE4 LODs for Optimization -Beginner-
UE4 LODs for Optimization -Beginner-
 
UE4.26 レンダリング新機能(CEDEC+KYUSHU 2020)
UE4.26 レンダリング新機能(CEDEC+KYUSHU 2020)UE4.26 レンダリング新機能(CEDEC+KYUSHU 2020)
UE4.26 レンダリング新機能(CEDEC+KYUSHU 2020)
 
Bindless Deferred Decals in The Surge 2
Bindless Deferred Decals in The Surge 2Bindless Deferred Decals in The Surge 2
Bindless Deferred Decals in The Surge 2
 

Similar to Dynamic Wounds on Animated Characters in UE4

Minko stage3d workshop_20130525
Minko stage3d workshop_20130525Minko stage3d workshop_20130525
Minko stage3d workshop_20130525Minko3D
 
Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill) Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill) Jean-Philippe Doiron
 
VFX Alchemy (DevGamm conference. Alexander Fedotovsky) eng
VFX Alchemy (DevGamm conference. Alexander Fedotovsky) engVFX Alchemy (DevGamm conference. Alexander Fedotovsky) eng
VFX Alchemy (DevGamm conference. Alexander Fedotovsky) engAlexander Fedotovskikh
 
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016Codemotion
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoonmochimedia
 
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters AdventureHow we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters AdventureFelipe Lira
 
iOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLiOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLDouglass Turner
 
Joshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshCollege
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Johan Andersson
 
CineBox Presentation FMX 2011
CineBox Presentation FMX 2011CineBox Presentation FMX 2011
CineBox Presentation FMX 2011Christopher Evans
 
Advanced #4 GPU & Animations
Advanced #4   GPU & AnimationsAdvanced #4   GPU & Animations
Advanced #4 GPU & AnimationsVitali Pekelis
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyJordanianmc
 
Making VR with Unreal Engine Luis Cataldi
Making VR with Unreal Engine  Luis CataldiMaking VR with Unreal Engine  Luis Cataldi
Making VR with Unreal Engine Luis CataldiUnreal Engine
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyAlex Kirby
 

Similar to Dynamic Wounds on Animated Characters in UE4 (20)

Minko stage3d workshop_20130525
Minko stage3d workshop_20130525Minko stage3d workshop_20130525
Minko stage3d workshop_20130525
 
Gamedev-grade debugging
Gamedev-grade debuggingGamedev-grade debugging
Gamedev-grade debugging
 
Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill) Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill)
 
VFX Alchemy (DevGamm conference. Alexander Fedotovsky) eng
VFX Alchemy (DevGamm conference. Alexander Fedotovsky) engVFX Alchemy (DevGamm conference. Alexander Fedotovsky) eng
VFX Alchemy (DevGamm conference. Alexander Fedotovsky) eng
 
Hacking for salone: drone races
Hacking for salone: drone racesHacking for salone: drone races
Hacking for salone: drone races
 
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoon
 
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters AdventureHow we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
 
iOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLiOS Visual F/X Using GLSL
iOS Visual F/X Using GLSL
 
Cocos2d programming
Cocos2d programmingCocos2d programming
Cocos2d programming
 
Joshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminology
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
 
CineBox Presentation FMX 2011
CineBox Presentation FMX 2011CineBox Presentation FMX 2011
CineBox Presentation FMX 2011
 
Advanced #4 GPU & Animations
Advanced #4   GPU & AnimationsAdvanced #4   GPU & Animations
Advanced #4 GPU & Animations
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Making VR with Unreal Engine Luis Cataldi
Making VR with Unreal Engine  Luis CataldiMaking VR with Unreal Engine  Luis Cataldi
Making VR with Unreal Engine Luis Cataldi
 
Alexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal EngineAlexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal Engine
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Engine Terminology
Engine TerminologyEngine Terminology
Engine Terminology
 
Engine terminology
Engine terminologyEngine terminology
Engine terminology
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Dynamic Wounds on Animated Characters in UE4

  • 1. Dynamic Wounds on Animated Characters in UE4 Michał Kłoś, Layopi Games Game Industry Conference 2017
  • 3. About me Now Shader/VFX Artist Lead at Layopi Games Lead Native Dev at VR Global Unity & Web Dev at TK Games
  • 4. Agenda • Intro to wounds in games • Popular methods • Effect features and problems • Effect meets profiling and gameplay • Final comparison
  • 5. Intro to wounds in games
  • 6. Intro to wounds in games Wounds and dismemberment: • Mortal Kombat • Metal Gear Solid • Dead Space • Fallout • Shadow Warrior 2 • Shadow of Mordor and many more … https://www.youtube.com/watch?v=RIUYi9JuMKQ
  • 12. Intro to wounds in games Why game need wounds: • Visual feedback to damage • Minimize UI, Healthbars • Give satisfaction from combat • Juiciness: persistence
  • 13. Intro to wounds in games Does your effect make sense? Need to follow character and game design! vs vs
  • 14. Intro to wounds in games Alternatives? Fixed presets … why not combine both?
  • 16. Intro to wounds in games Popular methods: • Ryan Brucks Unwraped Capture • Tom Loomans PreSkinned Position ? Dedicated system fitting: • Creative and Art Director’s Vision • Game Requirements
  • 17. Intro to wounds in games Popular methods: • Ryan Brucks Unwraped Capture • Tom Loomans PreSkinned Position ? Dedicated system fitting: • Creative and Art Director’s Vision • Game Requirements Case study: fighting with blades
  • 18. Decal projection makes it slide on animated meshes, it is bad!
  • 19. Material with masked damage even allows for animation of strokes, we want this!
  • 21. Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve https://alex.vlachos.com/graphics/Vlachos-GDC10-Left4Dead2Wounds.pdf
  • 22. Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve https://alex.vlachos.com/graphics/Vlachos-GDC10-Left4Dead2Wounds.pdf Their problems • Memory limits • Performance Constraints • Character variations • LOD • Avoid mesh generation
  • 23. Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve https://youtu.be/5_G79LJ_l2Y
  • 24. Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve https://www.youtube.com/watch?v=CHbnP5SAMzI
  • 25. Vlachos 2010, Rendering Wounds in Left 4 Dead 2, Valve https://alex.vlachos.com/graphics/Vlachos-GDC10-Left4Dead2Wounds.pdf
  • 26. Popular Methods • Ryan Brucks Unwraped Capture • Tom Loomans Preskinned Position
  • 27. Popular Methods Problems • Calculate mask on surface of animated geometry • Keep updatable mask between frames
  • 28. Popular Methods • Ryan Brucks Unwraped Capture • Requires SceneCapture • Each masked pixel need captured position • Copy animation or use animated mesh • Tom Loomans Preskinned Position
  • 29. Popular Methods • Ryan Brucks Unwraped Capture • Requires SceneCapture • Each masked pixel need captured position • Copy animation or use animated mesh • Tom Loomans Preskinned Position • Hit calculation done in Rest Pose • Hit need transformation into Rest Pose ex. Bone Transform from Trace
  • 30. Popular Methods Ryan Brucks Unwraped Capture explained
  • 31. Ryan Brucks Unwraped Capture explained
  • 32. Ryan Brucks Unwraped Capture explained
  • 33. Popular Methods Ryan Brucks Unwraped Capture explained
  • 34. Ryan Brucks Unwraped Capture explained
  • 35. Ryan Brucks Unwraped Capture explained
  • 36. Unique UV, outtake on texture morph animation that happens when UVs are mirrored
  • 37. Tom Loomans PreSkinned Position explained
  • 38. Red: Animated Bone Transform, Green: RestPose Transform, Blue: Inverse Animartion + RestPose Transform
  • 39. Tom Loomans PreSkinned Position explained
  • 41. Effect Features and Problems • Blending with character material • Fitting shape of obstacle • Dotted on fast movement of obstacle • Variable number of obstacles and draw calls • Impact of hit • Hits from random limb collisions
  • 43. Ryan Brucks Unwraped Capture, Require 2 RenderTargets per each Character
  • 44. Effect Features and Problems Fitting shape of obstacle Signed Distance Fields (SDF) What info gives us SDF?
  • 45. Signed Distance Fields (SDF), What info gives us SDF? https://www.shadertoy.com/view/ldK3zD
  • 46. Effect Features and Problems Fitting shape of obstacle http://iquilezles.org/www/articles/distfunctions/distfunctions.htm float sdSphere ( vec3 p, float r ) { return length(p)-r; }
  • 47. Effect Features and Problems Fitting shape of obstacle http://iquilezles.org/www/articles/distfunctions/distfunctions.htm float sdCapsule (vec3 p, vec3 a, vec3 b, float r) { vec3 pa = p-a, ba = b-a; float h = clamp(dot(pa,ba)/dot(ba,ba), 0.0, 1.0); return length(pa-ba*h)-r; }
  • 48. Appear dotted on fast movement of obstacle
  • 49. Effect Features and Problems Appear dotted on fast movement of obstacle Keep info from previous frame Sphere + Sphere = Capsule Capsule + Capsule = Quad + + = =
  • 50. Effect Features and Problems http://iquilezles.org/www/articles/distfunctions/distfunctions.htm float dot2(in vec3 v) { return dot(v,v); } float udQuad (vec3 p, vec3 a, vec3 b, vec3 c, vec3 d) { vec3 ba = b-a; vec3 pa = p-a; vec3 cb = c-b; vec3 pb = p-b; vec3 dc = d-c; vec3 pc = p-c; vec3 ad = a-d; vec3 pd = p-d; vec3 nor = cross(ba, ad); return sqrt((sign(dot(cross(ba,nor),pa)) +sign(dot(cross(cb,nor),pb)) +sign(dot(cross(dc,nor),pc)) +sign(dot(cross(ad,nor),pd)) < 3.0) ? min(min(min(dot2( ba*clamp(dot(ba,pa)/dot2(ba),0.0,1.0)-pa), dot2(cb*clamp(dot(cb,pb)/dot2(cb),0.0,1.0)-pb)), dot2(dc*clamp(dot(dc,pc)/dot2(dc),0.0,1.0)-pc)), dot2(ad*clamp(dot(ad,pd)/dot2(ad),0.0,1.0)-pd)) : dot(nor,pa)*dot(nor,pa)/dot2(nor) ); }
  • 51. Effect Features and Problems http://iquilezles.org/www/articles/distfunctions/distfunctions.htm
  • 52. Effect Features and Problems Splines? Read bone animation trail from SkeletalMeshComponent? Interpolate 2+ frames? Did not tried https://www.shadertoy.com/view/XdB3Ww
  • 53. Effect Features and Problems Variable number of obstacles and draw calls Draw sum of all of them at once and count instructions Editor do not support Material Parameters Arrays but Global Shaders do.
  • 54. Variable number of obstacles and draw calls
  • 55. Effect Features and Problems Impact of the hit Brush like feeling vs Impact - what gives impact Trigger stroke with Collision Trace
  • 56. Trigger stroke with Collision Trace
  • 57. Effect Features and Problems Impact from random limb collisions Animation notify with info about currently active limb for damage
  • 58. Animation notify with info about currently active limb for damage
  • 59. Effect Features and Problems Multiple Characters at once Mesh occlusion - Extents Size
  • 60. Effect meet profiling and gameplay
  • 61. Effect meets profiling and gameplay Profiling and 1ms budget for VFX UE profiling tools SceneCapture vs RenderMaterialToTexture Performance RenderTarget performance vs quality WorldSpace vs LocalSpace
  • 62. Blueprint for sequencer, easy to debug
  • 63. Blueprint for sequencer, easy to debug
  • 64. Effect meets profiling and gameplay Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
  • 65. Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
  • 66. Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
  • 67. Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p)
  • 68. Effect meets profiling and gameplay Stress Test Scene (i7, 16 GB RAM, GTX 970 1080p) Numbers per MaskRenderTarget resolution: 2048 x 2048 px (RGB8, 16 MB), SceneCapture 5.22 ms per Character MaskRenderTarget 0.35 ms per obstacle 1024 x 1024 px (RGB8, 4 MB), SceneCapture 1.77 ms per Character MaskRenderTarget 0.09 ms per obstacle 512 x 512 px (RGB8, 1 MB), SceneCapture 1.02 ms per Character MaskRenderTarget 0.025 ms per obstacle
  • 69. Effect meets profiling and gameplay Solution: Transform Hit to Rest Pose instead of SceneCapture Effect need texture mask done with DrawMaterialToRenderTarget but it draws on quad with no info about Rest Pose ...so bake RestPose to texture at start and sample each time
  • 70. Effect meets profiling and gameplay Interface for gameplay Enqueue calls each frame and restrict limit Service with Logic - Component with State approach, easy to plug to character Feed with WorldSpace vs LocalSpace
  • 71. Interface for gameplay, stuctures and components
  • 72. Interface for gameplay, WorldToLocal Character transformation
  • 73. Interface for gameplay, MaskRenderer execution
  • 74. Effect meets profiling and gameplay Alternatives: • Global Shaders • ShaderDemoPlugin by Temaran • Pixel Shader Example • Compute Shader Example Fork it!
  • 75. Effect meets profiling and gameplay www.unrealengine.com/en-US/blog/how-to-add-global-shaders-to-ue4 // MyTest.usf // Simple pass-through vertex shader void MainVS( in float4 InPosition : ATTRIBUTE0, out float4 Output : SV_POSITION ) { Output = InPosition; } // Simple solid color pixel shader float4 MyColor; float4 MainPS() : SV_Target0 { return MyColor; } Global Shaders, finally!
  • 76. Effect meets profiling and gameplay ShaderDemoPlugin by Temaran
  • 77. ShaderDemoPlugin by Temaran, Shader class declaration
  • 78. ShaderDemoPlugin by Temaran, Uniform Structs declarations
  • 80. ShaderDemoPlugin by Temaran, adding render command to RHI
  • 82. Final Comparison vs RestPose stays in budget SceneCapture does not
  • 83. Demo
  • 84. Demo
  • 85. Demo
  • 86. Takeaways • Make sure your effects meet design of game and characters • Effects give visual feedback to game events • SceneCapture renders whole scene with lights and shadows • SceneCapture may be performed only at start or even offline saved as asset • Rest pose is best approach for calculations • DrawMaterialToRenderTarget is rather cheap