# Meshes, Shadows, and Shadow Meshes

## Summary

**Published**: Mar 02 2024 by [mana vortex](mailto:undefined)\
**Last documented update**: Mar 02 2024 by [mana vortex](mailto:undefined)

{% hint style="info" icon="question" %}

#### Wait, this is not what I want!

* Find information about shadows in the environment under [Environment: Shadows](/cyberpunk-2077-modding/for-mod-creators-theory/files-and-what-they-do/file-formats/the-whole-world-.streamingsector/environment-shadows.md)
* To learn more about [Level of Detail (LoD)](/cyberpunk-2077-modding/for-mod-creators-theory/files-and-what-they-do/level-of-detail-lod.md), check the corresponding wiki page.
  {% endhint %}

## How to cast shadows

There are two different ways to cast shadows: **real-time** (generated) shadows, and **proxy** shadows.

{% hint style="success" %}
Most in-game items use both.
{% endhint %}

### Generated shadows: Component properties

Your mesh casts an actual shadow.

{% hint style="warning" %}
The real-time shadow will be extremely detailed, but it can impact **performance**, and it can glitch out or cause spectacular raytracing bugs. [#proxy-shadows-shadow-mesh](#proxy-shadows-shadow-mesh "mention")es avoid these issues.
{% endhint %}

You activate real-time shadows by checking the following properties in your [mesh component](/cyberpunk-2077-modding/for-mod-creators-theory/files-and-what-they-do/components/documented-components.md#equipment-hair) (which you can find in your [.app](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/appearance-.app-files#components) or [.ent](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/entity-.ent-files#mesh-component-entity-simple-entity) file):

<figure><img src="/files/qSBhAhzoaQfR1FPt6cZS" alt=""><figcaption></figcaption></figure>

### Proxy shadows: Shadow mesh

The proxy shadow, by contrast, will use an **invisible mesh** to cast a shadow (the `shadow mesh`). It has a lower [Level of Detail](/cyberpunk-2077-modding/for-mod-creators-theory/files-and-what-they-do/level-of-detail-lod.md) than the original and often features a simplified geometry or even a [proxy mesh](/cyberpunk-2077-modding/for-mod-creators-theory/files-and-what-they-do/level-of-detail-lod.md#proxy-meshes).

Due to the less complex geometry, a shadow mesh is much less prone to raytracing glitches, and it will be much eaiser on performance.

Shadow meshes are usually added as `entMeshComponents`.

#### Configuring a shadow mesh

Your average shadow mesh has only one default material with a blank local instance of `engine\materials\metal_base.remt`. If the shadow mesh is loaded in a scene, it will lead to white, marshmallow-y overlays.

To make sure that it's only used for shadow generation, check the `renderMask`:

<figure><img src="/files/xTiKH23wbijrbo1OAUUi" alt=""><figcaption></figcaption></figure>

## Creating shadow meshes

To create a low-poly mesh, you can build a cage, subdivide it a few times and use a **Shrinkwrap** **modifier** to shape it like your mesh. Then, you can reduce the poly count by **decimating**.

{% embed url="<https://www.youtube.com/watch?v=nlrs5dWttPU>" %}

## Troubleshooting

### My shadow mesh is always visible!

Check [#configuring-a-shadow-mesh](#configuring-a-shadow-mesh "mention") and make sure that `RenderInScene` is unchecked.

<figure><img src="/files/3U2pwpU7DVX1NwQcZnYL" alt=""><figcaption><p>The shadow is a marshmallow</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.redmodding.org/cyberpunk-2077-modding/for-mod-creators-theory/files-and-what-they-do/file-formats/3d-objects-.mesh-files/meshes-shadows-and-shadow-meshes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
