# Creating Static Meshes

Game meshes are stored in the [Drawable (.ydr)](https://github.com/Sollumz/wiki/blob/main/documentation/drawables.ydr) file format. Creating Drawables in Sollumz is very simple. This tutorial will walk you through step-by-step.

### Prerequisite Knowledge

* Basic Blender skills ([This is a great place to start](https://www.youtube.com/playlist?list=PLjEaoINr3zgFX8ZsChQVQsuDSjEqdWMAD))
* Know how to create YMAPs to place objects in CodeWalker ([Here's a basic tutorial](https://www.youtube.com/watch?v=W0YPabgu8oo))
* Know how to either stream assets in a FiveM server or load mods into the base-game

### What you will need

* A UV-mapped 3D mesh of your choice
* Textures for the mesh

You can also follow along with the tutorial by using the assets below:

{% file src="<https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FXAUIZuDneBglJCHA7rHB%2Fdrawable_tutorial_assets.zip?alt=media&token=f5f66b11-af58-433b-8769-fe41e904ab3a>" %}

### Converting to a Drawable

The first thing to do is convert your object(s) to a Drawable. Select all the objects and click `Convert to Drawable` in `Sollumz Tools > Drawable > Create Drawable Objects`.

<figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2F14rX1FEREV1N5NAnc8LC%2Fconvert-to-drawable.gif?alt=media&#x26;token=252b3711-67e1-431b-8f66-d830e8d3e269" alt=""><figcaption><p>Converting to Drawable</p></figcaption></figure>

You'll notice that an empty object gets created called "Drawable" and the objects that were selected are now Drawable models.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FeEuaWH86bFyyIVnqTrM5%2Fimage.png?alt=media&#x26;token=08050108-53ec-47cd-8a0d-a50c21080253" alt=""><figcaption><p>Drawable hierarchy</p></figcaption></figure></div>

If you navigate to `Mesh Properties > Sollumz LODs` you'll also notice that the active mesh is automatically assigned to the "High" LOD level. This panel is where you can assign other meshes as LODs. More info on that [here](https://docs.sollumz.org/documentation/drawables.ydr/level-of-detail-lods-editing). For the sake of this tutorial, we will only be setting the High LOD level.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FTQ2BWcykbiKl9viWPgMZ%2Fimage.png?alt=media&#x26;token=5d25ed4a-76bc-4b34-a708-451eae4397a6" alt=""><figcaption><p>Mesh Properties > Sollumz LODs</p></figcaption></figure></div>

### Adding Materials

Next, we need to add materials to the Drawable Models. With one of the Drawable Models selected, open the `Sollumz Tools > Drawable > Shader Tools` panel. For this tutorial, I will use the "NORMAL" shader which allows us to specify a base color and a normal map. Search for the "NORMAL" shader and click `Create Shader Material`.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FKHxKSh8TQEQP7Tf46P8R%2Fcreate_material.gif?alt=media&#x26;token=62b29cb9-0f0f-4e07-afee-650fb7a65e57" alt=""><figcaption><p>Creating Sollumz material</p></figcaption></figure></div>

With the newly added material selected, head to the shading tab and assign your textures.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2Fia35SO9WE4ZejffWIJUA%2Fassign_textures.gif?alt=media&#x26;token=7497c822-273d-4167-9488-761c49023c33" alt=""><figcaption><p>Assigning textures</p></figcaption></figure></div>

Repeat the process for any other Drawable Models. In my case, I am just going to use the same material for the "crate\_top" Drawable Model.

### Embedding Textures

Lastly, we need to set the textures as embedded. This will embed the textures into the YDR file, so we don't have to create a texture dictionary file (.ytd). With both objects selected, navigate to `Sollumz Tools > Drawable > Shader Tools` and click `Set all Materials Embedded.`

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2F5l89VGqRPDRjw9NDGYhX%2Fimage.png?alt=media&#x26;token=80e3adde-f0c1-49b6-96bb-0500836d44c6" alt=""><figcaption><p>Sollumz Tools > Drawable > Shader Tools > Set All Materials Embedded</p></figcaption></figure></div>

### Exporting

Before exporting I'm going to rename my Drawable to something more descriptive like "crate". Once you're happy with everything, export the Drawable by clicking File > Export > Codewalker XML. I am going to also enable `Export with ytyp`. This will automatically generate a YTYP with the Drawable we created already defined.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FpgkAAOoLzTt1XMjK9ntv%2Fexport.gif?alt=media&#x26;token=6508d748-227f-46f4-8887-b9d2dc384763" alt=""><figcaption><p>File > Export > Codewalker XML</p></figcaption></figure></div>

{% hint style="info" %}
You can also import/export via the Sollumz pie menu by pressing V and choosing "Export CodeWalker XML"
{% endhint %}

Your Drawable is now ready to be loaded into the game!

### Getting Files Ready to Stream

Convert the ydr.xml and ytyp.xml using CodeWalker.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FcnyJLkPWSVTd2hziLZKZ%2Fconvert_xml.gif?alt=media&#x26;token=dbb7353a-26f5-4104-9acb-c93acd46926e" alt=""><figcaption></figcaption></figure></div>

Open the converted files in a CodeWalker project.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FUOOcuqDix0xoDwO3ZBAk%2Fopen_files.gif?alt=media&#x26;token=45117afa-83aa-41d4-bc74-d6d0d0bb9abb" alt=""><figcaption></figcaption></figure></div>

Add a YMAP to the project and add the newly created Drawable as an entity.

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FoS187YffdyZwUHBQx3Lb%2Fadd_ymap.gif?alt=media&#x26;token=2d410076-8a3e-4e2f-9e78-b2a5d1c7949e" alt=""><figcaption></figcaption></figure></div>

Position the entity to your liking, then export the YMAP.

{% hint style="warning" %}
Don't forget to generate \_manifest.ymf for your project!
{% endhint %}

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FnCRuZf1ROxCcIKD9K49j%2Fimage.png?alt=media&#x26;token=8783640d-384c-462f-a895-492545f923e6" alt=""><figcaption></figcaption></figure></div>

Now, load your YDR, YTYP, YMAP, and \_manifest.ymf into either an RPF or the stream folder of your FiveM resource.

### Test In-Game

That's it! Load into the game and check out your creation!

<div align="left"><figure><img src="https://4252508569-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcRAM9lBHCqq3QodZ420I%2Fuploads%2FoYHfl4URZXRo7lTAoN2k%2Ftesting.gif?alt=media&#x26;token=852cad72-5ed0-42d0-b551-597c858078d2" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
Note that your character will not collide with the Drawable as we have not created collisions for it. See [Creating Static Collisions](https://docs.sollumz.org/tutorials/creating-static-collisions) to learn how to create collisions.
{% endhint %}
