UE4 – Enable complex collision for models

Software:
Unreal Engine 4.21

By default UE4 uses fast simplified convex collision shapes to calculate collision for static mesh actors.
This means that the player or projectiles wont be able to path through holes, openings or doors in the model.

To set complex (concave) collision for a static mesh model:

In Static Mesh editing window, in the details pane, under Collision:
Set Collision Complexity to: Use Complex Collision As Simple

Static_Mesh_Complex_Collision.jpg

This example shows the default behavior for a model that has an opening, neither the projectiles nor the player can pass:

Simple_Collision.gif

In this example collision for the model was set to Use Complex Collision As Simple:

Complex_Collision.gif

 

Advertisements

Blender – Bake rigid body physics to Keyframes

Software:
Blender 2.79

  • I always forget this, try to do it through the regular animation baking option and get frustrated that it doesn’t work…

When you want to bake an object’s rigid body physics simulation to regular Keyframes:

  1. Select the wanted objects.
  2. In the 3D View Tools pane, In The Physics Tab, Press the Bake To Keyframes button.

Untitled-1

Fresnel Reflections

What we refer to in CG by the term “Fresnel Effect” or “Fresnel Reflections”, is the way Specular Reflection intensity changes according to light \ surface incident angle, and it is a basic optical property surfaces.

Specular reflection intensity changes according to light incident angle, and behaves almost like a perfect mirror at grazing view angle.
The reason we call this natural reflection behavior “Fresnel Effect” or “Fresnel Reflection” is that the equations describing the how reflection intensity changes according to incident angle were invented by the French Physicist Augustin-Jean Fresnel, and in early CG days, not all systems knew how to calculate natural reflections or reflections at all for that matter. So in CG we ended up treating this as something special, when in fact it’s not special in nature, it was just special in the early days of ray-tracing.

When rendering Fresnel Reflections, the reflection intensity isn’t determined by a linear blending percent like mixing a layer.
It’s determined by a factor called “Refractive Index” or “Index Of Refraction” i.e. IOR.
The IOR value is derived from the physical material’s density, which is the key factor determining both reflection intensity and refraction amount.

Examples of some physical IOR values*:
Air (vacuum): 1.0
Water: 1.33
Glass: 1.52
Diamond: 2.417
* Physical values differ between different measurements and samples of materials so you might see differences between different data sources.

FResnel_Off

This ball is rendered without “Fresnel Reflections”.
Its Specular reflection is blended consistently at 50% over the diffuse color (reflection), not affected by the light/view incident angle.
The result looks wrong for a natural material. It may look like a dielectric material (non metal) that’s coated with a silvery coating, but it can’t look correctly like glossy plastic or glass.

FResnel_On

This ball is rendered with “Fresnel Reflections”.
The reflections look natural for a dielectric material (non metal), because they are dim at perpendicular incident angle and intense at grazing view angle, hence seen mostly at the sides of the ball accentuating its contour.

Theoretically Specular Reflection for all types of materials should be calculated using what we refer to in CG by the term “Complex Fresnel”, that is reflection equations that take into account both the Refractive Index (IOR) and Extinction Coefficient for 3 primary colors (spectrum wave lengths).
*Complex fresnel component values for different materials can be found on https://refractiveindex.info/.
In practice, for Dielectric materials (non metals), most common production rendering systems use what we refer to in CG by the term “Simple Fresnel” or “Simple IOR”, that is calculating the reflection for all 3 primary colors using a single Refractive Index value, which is the Refractive index of the Green primary color.
This method has proven itself to be very efficient for rendering non-metallic surfaces (dielectric materials).
Rendering metallic reflection using complex IOR produces the most realistic color and reflection* for metals.
*In metallic surfaces the color is the reflection color itself and not a separate Diffuse component.
Some rendering systems like Arnold 5 for example have implemented a general form* of Complex IOR into their physical surface shader, Complex IOR reflection can also be rendered via OSL shaders that can be found on the web (or written..).
*I’m using the term ‘general form’ because these implementations don’t include input for Complex IOR values but just a general metallic reflection curve, that interpolates manual color selection.
Popular useful cheats for mimicking metallic reflection without complex IOR are to set a very high (non physical) simple IOR value, like 15 to 30 which forces the Fresnel reflection to become more metal-like, or turn Fresnel reflection completely off, turning the specular reflection into a perfect mirror reflection, or create a custom reflection/angle curve/ramp that produces the effect of the metallic reflection color and intensity changing by incident angle, see example here.

In many popular production renderers, the physical surface shader uses a single IOR parameter. Some rendering systems allow using 2 different IOR parameters, one for calculating reflections and the other for calculating Refraction.
* physically correct dielectric materials should be defined with the same IOR value for both reflections and refraction. using different IOR values for reflection and refraction allows useful cheats like creating transparent a material that is modeled without any thickness or defining a transparent glass that has silver reflective coating like sunglasses sometimes have.

Notes:

  1. IOR lists on the web, that display only simple IOR values like this list, are not valid for metals, and produce wrong results.
    *Using simple IOR values for dielectric materials however is very efficient.
  2. There are parts in the CG industry where in daily slang language, the term “Fresnel” is used to refer to any shading effect that is view-angle dependent,
    Usually referring to the shading properties appearing at the “sides” or contours of the model.
  3. There are some CG systems that use the term Fresnel to refer to a simple linear or non-linear incident angle blending effect, that should actually be called “Facing ratio” or “Perpendicular-Parallel” blending (falloff).
    This is wrong because IOR based Fresnel reflection intensity produces a specific physical Reflection intensity/view angle function curve, and not just a linear or simple power function.
    See example in UE4’s Fresnel node.

Related:

  1. V-Ray Next’s new metallic material option.
  2. Creating a rich metallic shader in UE4.
  3. Complex Fresnel Texture for Cycles.

Blender Cloth animation to Shape Keys

Software:
Blender 2.79

Steps for creating Shape Keys from cloth simulation: 

  1. Create an object with Cloth simulation.
  2. Give the Cloth Cache a name.
  3. Set Cloth cache to Disk Cache.
  4. Bake the Cloth animation.
  5. Move the time slider to wanted cloth state.
  6. Press the ‘Apply as Shape Key’ button on the Cloth modifier.
    * The cloth modifier will be deleted from the object.
    Untitled-1.jpg
  7. Apply new cloth settings to the object.
  8. Set Pinning to be the same Vertex Group if necessary.
  9. Give Cloth Cache the same name as before.
  10. Set Cloth cache to Disk Cache.
  11. Play the animation timeline so that the cache frames on disk will be loaded again.
  12. Repeat from step 5 for each cloth pose you want to turn to a shape key.