Tutorials/Advanced/Extended Shadows

From SCS Modding Wiki
< Tutorials‎ | Advanced
Revision as of 22:56, 26 February 2018 by Smarty (talk | contribs) (Locators)

Jump to navigation Jump to search

Template:Construction

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.

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.

Ext shadow 001.jpg
Ext shadow 002.jpg

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.

  1. Place the origin locator (shadow_x_ori) so that is 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.
    Ext shadow 3.jpg
  2. 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)
    Ext shadow 4.jpg

Making the Fakeshadow Surface

Creating the Shadow Texture

Definitions Set-Up

Troubleshooting