Difference between revisions of "Tutorials/Advanced/Extended Shadows"
(→Fakeshadow Surface) |
DriveSafely (talk | contribs) m |
||
(7 intermediate revisions by one other user not shown) | |||
Line 7: | Line 7: | ||
[[File:Ext_shadow_001.jpg|thumb]] | [[File:Ext_shadow_001.jpg|thumb]] | ||
+ | [[File:Ext_shadow_002.jpg|thumb]] | ||
=== Locators === | === Locators === | ||
− | The origin locator (shadow_x_ori, shd_x_ori1, shd_x_ori2, etc) defines the upper boundary, center, and | + | The origin locator (shadow_x_ori, shd_x_ori1, shd_x_ori2, etc) defines the upper boundary, center, direction, and orientation of the shadow volume. This locator should generally always be oriented so that it points down (i.e. rotated so that the locator '''+y''' points in global '''-Z''') and rotated so that its '''+z''' points in global '''-Y'''. The corner locator (shadow_x_crn, shd_x_crn1, shd_x_crn2, etc) defines the width, length, and lower boundary of the shadow volume. |
=== ''Fakeshadow'' Surface === | === ''Fakeshadow'' Surface === | ||
A surface using the ''fakeshadow'' effect is used to limit where shading is applied within the shadow volume. By default, the extended shadow texture is projected vertically within the entire shadow volume, shading all of the geometry within. When a ''fakeshadow'' surface is present, only the volume 'outside' of the surface relative to the shadow volume origin will be shaded. So, typically, the normals of any fakeshadow surface will point toward the ground. It is also important that the ''fakeshadow'' surface covers the entire length and width of the shadow volume, or there may be undesirable shading in the uncovered areas. | A surface using the ''fakeshadow'' effect is used to limit where shading is applied within the shadow volume. By default, the extended shadow texture is projected vertically within the entire shadow volume, shading all of the geometry within. When a ''fakeshadow'' surface is present, only the volume 'outside' of the surface relative to the shadow volume origin will be shaded. So, typically, the normals of any fakeshadow surface will point toward the ground. It is also important that the ''fakeshadow'' surface covers the entire length and width of the shadow volume, or there may be undesirable shading in the uncovered areas. | ||
− | + | <br clear=all /> | |
== Model Set-Up == | == Model Set-Up == | ||
=== Placing the Locators === | === Placing the Locators === | ||
+ | Typically, the same texture will be used for both the extended shadow and the UI shadow model of a truck or trailer. In this case, the extended shadow locators must be placed in reference to the UI shadow model so that the texture will project onto the shadow volume the same way it's mapped to the UI shadow. | ||
+ | |||
+ | #Place the origin locator (shadow_x_ori) using {{Key_press|Shift|A}} so that it sits in the bounding box center of your UI shadow model when viewed from above. Its position in Z is the top of the shadow volume/the highest point that would be darkened by the extended shadow.<br />[[File:Ext_shadow_3.jpg|center]] | ||
+ | #Rotate the origin locator to the standard orientation: {{Key_press|R}}, {{Key_press|X}}, -90; {{Key_press|R}}, {{Key_press|Z}}, 180. Its orientation in the Transform panel should look like this:<br />[[File:Ext_shadow_3b.jpg|center]] | ||
+ | #Place the corner locator (shadow_x_crn) at the front left (+Y, -X) extreme of your UI shadow model when viewed from above. Usually, it is placed it below ground level so that the shadow doesn't disappear awkwardly when the player goes over a dip. A reasonable value is around -65cm. (If it is very low, the shadow volume will extend below bridges, etc)<br />[[File:Ext_shadow_4.jpg|center]] | ||
=== Making the ''Fakeshadow'' Surface === | === Making the ''Fakeshadow'' Surface === | ||
+ | Select the extended shadow origin locator (shadow_x_ori or shd_x_ori) and snap the 3D cursor to it ({{Key_press| Shift|S}} → ''Cursor to Selected''). Add a plane to the scene ({{Key_press|Shift|A}} → Mesh → Plane). This plane will become your fakeshadow surface! | ||
+ | |||
+ | <!-- Image showing freshly-inserted plane at origin locator with 3D cursor visible --> | ||
+ | |||
+ | Enable snapping ({{Key_press|Shift|Tab}}), select vertex mode, and use the ''Closest'' target mode. Make sure the corner locator (shadow_x_crn or shd_x_crn) is visible. | ||
+ | |||
+ | <!-- Small image showing snapping settings --> | ||
+ | |||
+ | Select the plane you created, enter Edit mode, and select all. Scale the plane in ''X'' and then in ''Y'', snapping to the corner locator each time. Flip the normals of the plane so that they face down, using {{Key_press|Ctrl|F}} → Flip Normals. | ||
+ | |||
+ | <!-- Image showing scaled, flipped plane --> | ||
+ | |||
+ | Assign your fakeshadow surface an SCS Material using the ''fakeshadow'' effect. [https://docs.blender.org/manual/en/dev/editors/3dview/object/properties/relations/parents.html Parent] the plane to your vehicle's SCS root locator. | ||
+ | |||
+ | <!-- Image showing fakeshadow material on fakeshadow surface --> | ||
+ | |||
+ | At this point, your vehicle has a functional fakeshadow surface! However, it may not fit very well yet. The surface can be subdivided and manipulated as needed. Be careful to ensure that the outside edges still cover the entire shadow volume. | ||
+ | {{Tip|The [https://docs.blender.org/manual/en/dev/modeling/meshes/editing/subdividing/loop.html Loop Cut] tool is useful for quickly subdividing the fakeshadow surface.}} | ||
+ | |||
+ | <!-- Quick GIF or video showing fakeshadow surface being subdivided and manipulated into final form. --> | ||
=== Creating the Shadow Texture === | === Creating the Shadow Texture === |
Latest revision as of 07:54, 12 February 2024
This tutorial will provide a brief overview of the extended shadow effect used for player trucks and trailers, and guide you through correctly setting up your model for it.
Contents
Overview
The extended shadow effect is used to draw a shadow volume underneath the player's truck and trailer. A grayscale texture is used to define the strength of the shadow volume along its length and width. Within the model, two locators are used to define the shadow volume and a surface is used to define the limit of the effect in the vertical direction. The effect can be fine tuned in the corresponding chassis definition.
Locators
The origin locator (shadow_x_ori, shd_x_ori1, shd_x_ori2, etc) defines the upper boundary, center, direction, and orientation of the shadow volume. This locator should generally always be oriented so that it points down (i.e. rotated so that the locator +y points in global -Z) and rotated so that its +z points in global -Y. The corner locator (shadow_x_crn, shd_x_crn1, shd_x_crn2, etc) defines the width, length, and lower boundary of the shadow volume.
Fakeshadow Surface
A surface using the fakeshadow effect is used to limit where shading is applied within the shadow volume. By default, the extended shadow texture is projected vertically within the entire shadow volume, shading all of the geometry within. When a fakeshadow surface is present, only the volume 'outside' of the surface relative to the shadow volume origin will be shaded. So, typically, the normals of any fakeshadow surface will point toward the ground. It is also important that the fakeshadow surface covers the entire length and width of the shadow volume, or there may be undesirable shading in the uncovered areas.
Model Set-Up
Placing the Locators
Typically, the same texture will be used for both the extended shadow and the UI shadow model of a truck or trailer. In this case, the extended shadow locators must be placed in reference to the UI shadow model so that the texture will project onto the shadow volume the same way it's mapped to the UI shadow.
- Place the origin locator (shadow_x_ori) using ⇧ Shift+A so that it sits in the bounding box center of your UI shadow model when viewed from above. Its position in Z is the top of the shadow volume/the highest point that would be darkened by the extended shadow.
- Rotate the origin locator to the standard orientation: R, X, -90; R, Z, 180. Its orientation in the Transform panel should look like this:
- Place the corner locator (shadow_x_crn) at the front left (+Y, -X) extreme of your UI shadow model when viewed from above. Usually, it is placed it below ground level so that the shadow doesn't disappear awkwardly when the player goes over a dip. A reasonable value is around -65cm. (If it is very low, the shadow volume will extend below bridges, etc)
Making the Fakeshadow Surface
Select the extended shadow origin locator (shadow_x_ori or shd_x_ori) and snap the 3D cursor to it (⇧ Shift+S → Cursor to Selected). Add a plane to the scene (⇧ Shift+A → Mesh → Plane). This plane will become your fakeshadow surface!
Enable snapping (⇧ Shift+Tab ↹), select vertex mode, and use the Closest target mode. Make sure the corner locator (shadow_x_crn or shd_x_crn) is visible.
Select the plane you created, enter Edit mode, and select all. Scale the plane in X and then in Y, snapping to the corner locator each time. Flip the normals of the plane so that they face down, using Ctrl+F → Flip Normals.
Assign your fakeshadow surface an SCS Material using the fakeshadow effect. Parent the plane to your vehicle's SCS root locator.
At this point, your vehicle has a functional fakeshadow surface! However, it may not fit very well yet. The surface can be subdivided and manipulated as needed. Be careful to ensure that the outside edges still cover the entire shadow volume.
TIP: The Loop Cut tool is useful for quickly subdividing the fakeshadow surface.