Talk describes the challenge of combining rich VFX with interaction of animated characters. During the presentation will give an overview on setup of materials, scripting and programming. Profiling and background of technical constraints will also be brought up. This talk covers technical art topics, but artists and programmers will also find interesting details. Best for people familiar with Unreal Engine 4 or for those who want to see how to create current state of the art VFX with UE4.
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
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
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
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.
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
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
74. Effect meets profiling and gameplay
Alternatives:
• Global Shaders
• ShaderDemoPlugin by Temaran
• Pixel Shader Example
• Compute Shader Example
Fork it!
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