Custom Assets

In order to use custom Assets in REDkit, you will need two things: a mesh and the corresponding textures.

Export assets

Export the mesh

In order to export your mesh with the official plugin, you have to use 3DS Max (either 2009 32bits or 2013 32/64bits), you can get it easily and free of charge if you are a student.

Note: at this point no other software is supported for exporting meshes to REDkit.
You can also do this with this unofficial tool that can convert the most used mesh formats (Collada, FBX, Obj...) to RedEngine files. So with this tool, you can import your 3D models in the Redkit from all the 3D softwares.
There is a tutorial about this here.

With REDkit installed, there are a few files (in your Witcher 2 catalogue) that should be copied into particular folders:

1. Please copy re_exporter.ms to your 3DS Max folder, e.g.

→ ... 3DS Max VERSION\scripts\Startup\re_exporter.ms

2. Please copy appropriate version of max_re_exporter.dlx to your 3ds Max folder, e.g.

→ ... 3DS Max VERSION\plugins\max_re_exporter.dlx

Now, start 3DS Max and import your mesh (File > Import), then from the right-panel click on the MAXScript button and from the drop-down menu select RedEngine Exporter: the exporter parameters will appear. Click on the Export button and save your .re file.

Export textures

In order to edit DDS textures, you can use either Adobe Photoshop with Nvidia Texture Tools plugin or GIMP which has native DDS support.

Note: you can use NDo1, a free Photoshop plugin to generate and edit Normal maps.

Usually with REDkit, DDS textures are compressed as DXT1 with alpha (or simply DXT1 if they don't have any Alpha channel content).

Note: up to DXT5 with alpha is supported but beware of resources management!

Import assets in Editor

Import .re mesh

Now, go to the Asset Browser and create a folder where you will store your custom assets.

Right-click and select Import > Mesh. Pick out your previously exported .re file.

Import textures

Regarding the textures, you will need (at least) a Diffuse map and a Normal map.

Note: for tiny vegetation objects, a custom Normal map might be unneeded.
Instead, you can use the dummy engine\textures\editor\bricks_n.xbm normal map to save resources or even don't.

- Right-click and select Import > 2D Texture. Select your Diffuse map and click OK: a parameter menu will show up.
- In textureGroup select WorldDiffuseWithAlpha (or CharacterDiffuseWithAlpha for character parts). Click OK.
Note: "WithAlpha" suffix is mandatory for textures with Alpha channel, else it will not be imported and the texture will not apply properly.
- If you have a Specular map (this is not mandatory), import it with the same settings as previously.
- For your normal map, repeat the same process again but in textureGroup use WorldNormal (or CharacterNormal).

Apply textures through shaders

Now that everything is imported, you will need a shader to apply the textures to the mesh.
There are a lot of shaders built-in REDkit in environment_levels\shaders, for exemple detailmat.w2mg for buildings, or grassmat.w2mg/grassmatcomplex.w2mg for vegetation. Just look at existing meshes to see how they work.

Fix shaders using Red channel as Alpha

If you want to use vegetation shaders with "standard" imported textures that use Alpha channel, you will have to do a small edit because the stock shaders use the Red channel (from RGB) as Alpha channel, probably to salvage memory (since the Red channel is left unused). So you have to edit that unless you changed your channels accordingly in 3DS Max.

Else you will get something like that:

So, copy your desired shader to a custom folder of your choice and double-click it. The Shader Editor will pop-up.

Break the arrow that goes from Mask in the Output box to the Red channel option of a Texture sampler. Recreate an arrow that connects Mask to Alpha option (Alpha channel). Now save (File > Save) and quit the editor.

Set your desired shader

Now double-click on the mesh you imported previously. On the right-panel, go to the Materials tab and click on Create Instance.
On the lower array, select your shader in baseMaterial (if you did an edit, remember to select the right one!). The shaders parameters underneath will update.
In Diffuse select the Diffuse map you imported. Same with your other imports under Specular (optional) and Normal.
If you are using a shader that has a Mask entry (vegetation shader), import also your Diffuse map under this field.