https://www.tombraiderforums.com/showthread.php?t=208076
This post is an update of teme9’s tutorial for Blender 2.80.
Installing the addon
Go to https://github.com/sapper-trle/sappers-TRLE-addons/releases and download v2.3 sappers-TRLE-addons281.zip file.
In Blender 2.80 click to Edit>Preferences.
In the dialog click Add-ons and then Install.
Select the zip file you downloaded and click Install Add-on from File.
Activate the addon by checking the checkbox. Use the search box or Import-Export filter to locate the addon.
In File>Export you should see the options TextureAdd and StrPix Metasequoia. These will be unavailable (greyed out) if no mesh object is selected or the selected object has no UVs or the viewport is not in object mode. Note if the object contains ngons (polygons with more than 4 vertices) an error will be generated and no object will be exported
Converting the model
Models for a TRLE wad must be low poly, the main restriction being StrPix’s limits of 1500 vertices and 1500 polygons. Also the polygons must only be triangles or quads (triangulate any ngons before unwrapping). Make sure the model you choose meets these requirements.Import your low poly model into Blender with File>Import and click it to select it. To see the model textured in the viewport select the Look Dev viewport shading.
The importer may have used a rotation transform to match the model’s up with Blender’s up. If so, you will see a non zero value in the rotation transform for the object.
To ensure the model has the same orientation in the exported MQO as you see in the viewport you need to apply the rotation transform using the Object>Apply>Rotation menu or pressing Ctrl+A and selecting Rotation.
Select the Modelling workspace and use Mesh>Clean Up to fix any problems with the mesh such as duplicate vertices.
The number of vertices and faces in the visible models in the scene is displayed in the status bar, bottom right, so you can check that the model is within limits for StrPix.
With the model selected press Shift+D to duplicate the model. It is very important that the duplicate model is positioned at exactly the same spot as the original. I ensure this by clicking the right mouse button. (I have left mouse button click set up to select.)
We are going to bake the textures from the original model to the duplicate model and this process requires that the duplicate model fully encloses the original model.
With the duplicate model selected, select the Shading workspace and in the Shader Editor viewport click the button labelled “2” next to the material name. This makes the duplicate model use its own material and not share it with the original model.
Note here I assume the importer you used set up a material that uses nodes.
In the Image Texture node click the “X” next to the image name and then click New and create a new 256 * 256 image.
Finally in the Shader Editor disconnect the Image Texture Node by clicking and dragging the end of the link off the node it’s connected to.
With the duplicate model still selected, switch to the UV Editing workspace.
In the 3D view viewport (Edit mode) select all the faces by pressing A and then select UV>Lightmap Pack from the menu.
In the dialog select All Faces, check Share Tex Space, set Image Size to 256 and Margin to 0.25. You can try different values of Margin here to see which gives the best result. If you created a new image in the step above leave New Image unchecked.
This step transforms the model’s UVs into rectangles and right-angled triangles required by the TRLE wad.
The next step is to bake the textures from the original model to the duplicate model.
Switch to the Layout workspace and make sure Object Mode is set.
In the Outliner viewport first click on the original model name and then hold Shift and click on the duplicate model name. Note that the models must be visible (i.e. “eye” icon open) for them to be selected in the Outliner. The names become different shades of orange when this step is completed.
EDIT: In Blender 2.81, 2.82 you have to do this the other way round or use Ctrl instead of Shift. I don't know why, maybe a bug. Anyway, you need the original object highlighted in orange and the duplicate object highlighted in yellow as in the picture below.
In the Properties viewport below the Outliner select the Render context tab (camera icon) and change the Render Engine to Cycles. Currently the baking option is only available with the Cycles renderer.
Expand the Bake panel.
- Set the Bake type to Diffuse.
- Under Influence turn off Direct and Indirect. Keep Color on.
- Check Selected to Active.
- Expand Selected to Active and set Ray Distance to one.
- IMPORTANT Ray Distance must be greater than zero or the baked texture will not be good.
The duplicate model will not yet appear textured since we disconnected the Image Texture node in the Shader Editor. So make sure the duplicate model is the only selected model and switch to the Shading workspace and reconnect the Image Texture node to the Shader node in the Shader Editor viewport. You connect by clicking on the Color output on the Image Texture node and dragging to the Base Color input node on the Shader Node.
Switch to the UV Editing workspace and in the Image Editor viewport save the bake texture image.
Switch to the Layout workspace. Make sure the duplicate model is selected only and the viewport is in Object Mode.
From File>Export
- Export the model as StrPix Metasequoia. In the file dialog set the scale if required and optionally the name of the image.
- Export the UVs as TextureAdd records file
If you are not satisfied with the baking result you can repeat the steps from the UV unwrap and try different values for margin etc.
Now we can import the model into a .wad file.
- First open your .wad file in TextureAdd
- Import your image in the Texture Pages section. Must be first texture page in .wad.
- Import the records file in the Texture Position section. Click “Yes” to overwrite.
- Save the .wad.
- Open the .wad file in StrPix
- Import the .mqo file.
- Save the .wad.
For more information about this technique see DJFull’s video [link] or read through the thread linked at the top of this post.
Note that DJFull is using Blender 2.79 in his video.
If you exported the .mqo from Blender with an image name the model will be textured in Metasequoia.
No comments:
Post a Comment