www.tombraiderforums.com  

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tutorials and Resources

Reply
 
Thread Tools
Old 28-08-21, 22:17   #1
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default Blender to Tomb Editor - Custom Objects



Hello and welcome! This is a beginner friendly tutorial on how to create models with Blender that are optimized for level building with Tomb Editor.

Things seem to be moving quickly at the moment as tools get further developed and new features get added - I will try to keep this thread up to date if there are any major changes to what can be considered a good workflow.

If you are a complete beginner at modeling and Blender, then the developer team's own Introduction to Blender 2.8 tutorial series on YouTube is a fantastic place to start.
It briefly introduces you to all of Blender's tools and functions and gives you a general idea of what is possible with Blender.




==============================================
What you need
==============================================


Blender 2.93.3 for Win 8 & 10 Installer /// Portable ZIP

Blender 2.92 for Win 7 Installer /// Portable ZIP


Blender conveniently offers for each release both an installer and a portable version. The portable ZIP versions come in especially handy if you want to use different versions of Blender on the same computer. You can find all versions of Blender for download at Blender's index of releases.




PixStr can load levels compiled with Tomb Editor. It does not render UV mapped models correctly, but you can inspect the texture pages of your level in detail. It's immensely useful for checking what happens to your UV mapped models upon level compilation, so you can try different ways of unwrapping to see which method adds the least amount of texture infos.




This addon allows you to open classic .wad files directly in Blender, which is exactly as convenient as it sounds.
See this video by Bergus, the author of the addon, how to download from GitHub and install.



------------------------------
Other links and resources
------------------------------

Blender Manual

The Blender online manual. Note that you can also download the manual as either PDF file or HTML pages.


Open Blender to Tomb Editor thread

The thread for discussing all things related to the workflow from Blender to WadTool & Tomb Editor. If you have got questions regarding this tutorial, please post them there. If you've got suggestions or additions to this tutorial, don't hesitate to post them also!

Please do not respond to this thread!




==============================================
Contents
==============================================


Last edited by not again!; 29-08-21 at 02:36.
not again! is offline   Reply With Quote
Old 28-08-21, 22:17   #2
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default

- Placeholder -

This post space is reserved for a bullet point summary of this tutorial (will be added once this tutorial is finished)

Last edited by not again!; 29-08-21 at 02:38.
not again! is offline   Reply With Quote
Old 28-08-21, 22:38   #3
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default



Recommended Blender User Preferences and Add-ons



The following suggested changes are just minor tweaks that will not interfere with your ability to replicate workflows shown in other tutorials.






------------------------------
User Preferences
------------------------------




You can access the User Preference Settings from the menu bar on top under Edit > Preferences




Under Navigation enable Orbit Around Selected. This will make Blender always rotate view around the actively selected object.

Disable Auto Perspective - With Auto Perspective enabled, Blender will automatically toggle between orthographic and perspective view, depending on your view angle. I recommend to disable it. The reason is explained in detail in this post: Creating a workspace for TRLE, when discussing the workspace for avoiding wandering vertices.



Blender should by default save your preferences automatically. If it doesn't, you can click the small menu icon in the bottom right corner and enable Auto Save Preferences, or save your changes manually.







------------------------------
Blender Add-ons
------------------------------





The Blender download comes with many optional addons that you can enable. There are a few often recommended must-haves that will expand and improve Blender's default tools greatly.

We'll enable only those that are directly useful for modeling and texturing, but there's a lot of other magnificent addons helping with all kinds of tasks; from texture painting, to animations, to video editing, so it is definitely worth taking a closer look at all the addons yourself and see what else suits your needs. You can usually find tons of info and tutorials about each of them on YouTube.


While still in User Preferences navigate to the Add-ons. In the drop down on top of the window you can choose the category:





We will enable Add-ons of the following categories:


Interface:
  • Copy Attributes - this allows you to copy rotation, location, scale, etc from one object to another.

Mesh:
  • Auto Mirror - cuts your model in half and mirrors it; great way to symmetrize a model quickly.
  • Edit Mesh Tools - expands Blender's mesh editing toolset with essential functions like Edge Offset, Multi Extrude, and many more. Here's a video showcasing what the addon can do. The Scottish (?) accent is probably a challenge for non native speakers, but I think even if you don't understand half of what he's saying you still get a good idea of what the addon is capable of. hopefully
  • F2 - expands Blender's face creation toolset.
  • Loop Tools - a powerhouse of an addon. YouTube vid for a quick overview.

See the screenshot below where you can access all of the above mesh tools:




Object:
  • Bool Tools - YouTube vid. You can find the Bool Tools in the same location as the above mesh tools, but you need to be in Object Mode to use them.




UV:
  • Magic UV - expands Blender's UV-mapping tool set.

And that's it for user preferences and addons. Hooray.

Last edited by not again!; 08-09-21 at 19:21.
not again! is offline   Reply With Quote
Old 28-08-21, 22:58   #4
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default



Choosing the right scale



One quirk of the TR engine is that it uses only integer values for vertex coordinates; decimal places get rounded up or down, which means vertices that don't have "clean" coordinates can shift position noticeably.
The result is distorted meshes, and if you've spent quite a bit of time trying to make your model look tidy with good topology, then you probably don't want the TR engine to undo those efforts.
Blender's Snap to Grid function is your friend when it comes to preventing your vertices from getting shoved around by the TR engine, but we'll come back to that in more detail in the chapter on modeling.

Suitable scale options come in two categories:
  • good for preventing wandering vertices
  • the Blender grid matches Level Editor grid


There is no scale option that does both, so depending on what you are working on the scale you choose can make quite a difference.


Disclaimer: I want to stress that wandering vertices are mainly an aesthetical problem! They will not cause anything to malfunction. Usually the damage lies in warping your mesh and causing ugly shadows.
The boring wall of text ahead is relevant if you care about perfecting your work!



Overall there's four suitable scale options:

for clean vertex coordinates:

1:1 - a level editor cube (1 grid square, 4 clicks) is 1024 x 1024 x 1024 meters in Blender; one click is 256 m high.
1:10 - a level editor cube is 102.4 x 102.4 x 102.4 meters, and one click is 25.6 meters.

for matching grid lines:

1:512 - a TRLE cube is 2 x 2 x 2 meters, and one click is 0.5 m. The Blender start cube is the same size as a LE cube in this scale!
1:1024 - a TRLE cube is 1 x 1 x 1 meters, and one click is 0.25 m


Pros and Cons of each scale


1:1

Pros: it will cause you the least hassle when importing & exporting because you can mostly use default settings for everything.
Cons: The original scale is ridiculously huge for Blender. The Blender Starting cube is 2 m, whereas a level editor cube would be 1024 m in Blender. You have to adjust the Clipping Distance for Blender to be able to display models of that size and disable Auto Perspective.
Best used for: Lara's outfit, pick-ups, inventory items, small models in general where distortions would be noticeable.
Additional info: with original scale a vertex coordinate value must not have any decimal places, whole units only; to give an example: 3.8 will get rounded up to 4 upon level compilation.



1:10 The alternative to 1:1.

Pros: the models have a reasonable size in Blender and just like with 1:1 it allows you to avoid wandering vertices.
Cons: none of the involved tools and programs (Blender, WadTool, WadBlender) offer any default presets for scale 1:10, so there's going to be a few additional steps to the workflow dealing with import / export settings.
Best used for: Lara's outfit, pick-ups, inventory items, small models in general where distortions would be noticeable.
Additional info: with 1:10 scale a vertex coordinate value is allowed one decimal place; 2.39 will get rounded up to 2.4 upon level compilation.



1:512

Pros: models have an optimal size and with a little tweak the Blender grid matches the Level Editor grid exactly. If it wasn't for wandering vertices this would be the perfect scale.
Cons: as with scale 1:10 there are no presets for that scale, you have to create your own.
Best used for: architectural wad objects that need to line up with the room geometry. Basically anything that you want to measure in level editor sectors and clicks, like a door that needs to be five clicks high.
If you are a beginner at modeling then this is the best scale to start with and you can use it for everything. You can make your inventory items or other small models wandering-vertex-proof anytime later.



1:1024

Pros and Cons: It's the best scale for editing exported room geometry due to the sheer size of the models, but there is no advantage in using it for anything else.


We will get back to all of the above with practical examples in the modeling chapter of this tutorial, so don't worry if you are unsure how to put that info into practice at this stage.

Last edited by not again!; 29-08-21 at 16:32.
not again! is offline   Reply With Quote
Old 28-08-21, 23:30   #5
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default



Importing Wad objects into Blender



A Wad file is the file that contains all the items and character models that you can place in your level. It also contains the sprites for emitters, and optional it can also contain the font for your level.
You can find all original WADs from TR1 - TR5 for download in the Trle/trng resources thread.





-----------------------------
WadTool
-----------------------------



WadTool comes packaged with Tomb Editor. It can open the original classic .wad files and converts them to the new .wad2 file format when saving.
If you want to import a wad object from a .wad2 into Blender, you can export the model directly from WadTool:


Exporting Moveables

In the list on the left select the slot containing the model you want to export and click Edit Skeleton. In the Skeleton Editor, which just popped up, select Export mesh.





Exporting Statics

Navigate to the slot containing the static you want to export and click Edit Static Model. In the Static Editor select Export.





Export Scale

WadTool offers two scale options when exporting models:

Normal scale, which is 1:1024 in this case
and
Keep original TR scale

As mentioned previously, if you want to export a model that is small and has fine detail where distortions would wreak havoc, choose keep original scale.
You can adjust the export scale manually too, of course. The number you enter in the scale field represents the number of times you want the model smaller than original scale. Entering 10 means the model will be ten times smaller (scale 1:10), and so on. You can't export models to be bigger than original size.
So if you prefer to use scale 1:10 instead of original size, enter 10 in the scale field.

For anything that needs to be measured in Level Editor grid squares (sectors) and clicks, enter 512 in the scale field.

Tick Invert Faces, so you don't have to flip the normals in Blender.
You can leave everything else at its default.



Importing the model into Blender

In Blender go to File > Import > Wavefront (.obj)



Import the models using the default settings.
If you did not tick Invert Faces while exporting from WadTool, you have to flip normals now:
the model will appear highlighted after import, but it's not actively selected yet. Select it, hit TAB to go into Edit Mode and then press ALT and N together to bring up the Normals context menu. Select Flip.








-----------------------------
WadBlender Add-on
-----------------------------





If you want to import an object from a classic .wad, the most convenient option is the WadBlender Addon. This is for classic .wad files only and not compatible with the new .wad2 format!
After downloading and installing the addon you will find the option to import a wad under File > Import> TRLE WAD file. There's also a new tab added to the Sidebar (hit N to toggle the panel open, if it's closed), but we'll ignore that for now.





The import menu of the addon offers a few choices - let's have a closer look at the most relevant settings:



In the topmost dropdown you can choose whether to import:
  • Everything
  • The rigged Lara object with (or without) all animations
  • An unrigged Lara model for outfit creation (Lara's Outfit)
  • All moveables or
  • All statics
Rigged means that the model has an armature for animation purposes.


Discard Placeholders means that nullmeshes (the tiny pyramid-like models that represent the various emitters) will be omitted and not imported.


Under Materials you can decide whether you would like to have the textures as texture pages like in Strpix, import the entire atlas as one single image, or give every object its own texture page with only the texture tiles that are used by it.
You can leave this at default settings, if you are unsure which to pick!


Import Animations - this will import moveables with all animations if they have any.


In the scale field enter 1 for original scale, or 10 for 1:10 scale. By default it is set to 512 which, as you can guess, imports models in 1:512 scale.


The Batch Export offers the option to export wad objects to either FBX or OBJ. It will export the models quietly in the background to the selected file format while loading the WAD into Blender.

Exporting to FBX is very useful if you would like to use any of the movables with animations, like Lara herself, in a different game engine, like Unity or the Unreal Engine.
The addon was actually written for exactly that purpose: To quote the opening post from the addon development thread:

Quote:
Originally Posted by Bergus View Post
this is a Blender addon that I'm using to export Lara animations in FBX format so that I can import them into Unity. It may be useful also for other stuff, so I'm sharing the code.
Basically the other features, that are only useful to level builders, were added because Bergus is awesome like that.

Batch exporting to OBJ could be useful if you would like to use a lot of models from a wad as imported geometry for instance. It would save you the work of having to export them one by one.

The Flip Normals option does what it says and flips the normals for you.


Importing an entire Wad can take a few moments!

Last edited by not again!; 08-09-21 at 19:48.
not again! is offline   Reply With Quote
Old 29-08-21, 00:16   #6
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default



Creating a workspace for TRLE



Workspaces are predefined window layouts, that are customized for specific workflows. Blender has different workspaces for modeling, for sculpting, scripting, texture painting, video editing, etc.

Conveniently users can also create their own personalized workspaces to suit their needs. We are going to create two workspaces for TRLE: one that's optimized for preventing wandering vertices, and one for working in 1:512 scale where Blender's grid lines match the level editor grid. And no worries, the adjustments to the grid settings will only affect our custom workspaces.

Workspaces are a really neat feature, because you can highly customize them and will still be able to go back to Blender's default settings by simply switching workspace tabs.

Important: We are going to save the following changes to the Blender Startup File and any changes you make, like changing view-angle and zoom level, toggling panels open or close, will be saved to the startup, too. For this reason I suggest that for the duration of setting up the workspaces you don't make any changes other than the mentioned ones (unless you know what you are doing, of course).

I suggest you keep the starting cube - it can serve as convenient starting point and scale reference, especially if you are working in 1:512 scale. The start cube has the exact size of a level editor block in that scale.





----------------------------------------------
Workspace for matching grid lines
----------------------------------------------



Let's start with a workspace for working in 1:512 scale. In this workspace the Blender grid matches the level editor grid.

Make sure you are in the Layout workspace and click the little + icon at the end of the workspace tabs array and select Duplicate Current.



Blender will switch automatically to the new workspace, which is now named Layout.001. Double-click the tab to rename it. I've named mine TRLE_512.

Select the starting cube and press TAB to switch into Edit Mode.
If the sidebar on the right is not already open, hit N on your keyboard to toggle it open. Select the Item tab and switch the coordinate value display from Local to Global.



After that hit TAB again to switch back into Object mode.

You can delete the camera and light - they are only needed if you want to make a render. Hold the SHIFT key for additive selecting, then click on the camera and the light, press X to delete.
Be aware that if you delete something it will be gone from all workspaces.

Alternatively you can exclude lights and camera from view, if you want to get them out of the way, but still keep the default setup:



I always keep them, but that's entirely up to preference. If you opt to delete them, you can add a camera and lights back into your scene anytime while in Object Mode.


Under Viewport Overlays we enable Statistics to keep track of the number of vertices and faces.

Optional: you can also enable All Origins, which will display the origin of models that are not actively selected. This is very useful if you are working on character models which usually are comprised of several different parts, but more on that later, when we get to modeling.




Under Viewport Shading we enable Backface Culling, which prevents the backside of faces from being rendered.
This helps to avoid confusion: you'll notice instantly if the normals of a face are pointing the wrong way, because it will be invisible from the backside.

Tip: if you want a face to be double sided in game, you have to duplicate that face manually and flip the normals of the duplicate.

Switch default Color mode to Textures to view your model with textures.

Optional: you can disable the default glossiness of models in the viewport by unticking Specular Lighting. It's not indicative of whether your model will have shine in game, it's just for how the model is displayed in the Blender viewport, so if you prefer a matte look while working, then you can change the setting here.





You wont be really needing the timleline at the bottom while modeling, so you can close it, if you want to get it out of the way. Navigate the mouse cursor exactly onto the dividing line between 3d viewport and the timeline window until you see the shape of the cursor change into a double pointed arrow. Right click and select Join Area. Then hover with the mouse cursor over the timeline window and confirm the merge with left click.
Youtube: how to join areas. I've included a timestamp to the bit about joining windows, but the whole video is worth a watch! It's only a bit over 3 minutes long.


This is a good time to save the changes we have made so far to the startup: under File > Defaults you can find both the option to save your changes to the startup file and the option to reset Blender to factory settings, if you have accidentally made any changes that you don't want to keep.




The above changes are useful for all potential workspaces for TRLE, so before we make the final change to the 512 workspace, which is adjusting the grid, we duplicate this workspace as starting point for the next workspace. The next workspace will be one that is optimized to prevent wandering vertices.
As before we click the little plus icon, choose Duplicate Current and rename the new workspace. I've named mine simply TRLE.

Switch back to the 512 workspace for the final adjustment!
Hit 1 on your numpad to go into front view and make sure you are in orthographic view mode. You can toggle view modes with 5 on your numpad. You will know you are in orthographic front view when you can see grid lines in the background.


Under Viewport Overlays we set the scale for the grid to 0.5

Your workspace should now look like this:



The major grid lines now neatly have the height of level editor clicks. If you enable snap to grid (the little horseshoe magnet icon at the top) you can construct architecture models that line up with room geometry very quickly.

Snapping to the major grid lines and the subdivision line that is exactly in the middle between them, will give you clean coordinates after the model got scaled up from 1:512 to original size.


For editing room geometry, which comes in 1:1024 scale, you can either temporarily switch the grid scale from 0.5 to 0.25, or make another duplicate of this 512 workspace and set its grid scale to 0.25.
Whichever is more convenient to you.

In any case this is a good time to save the changes to the startup again, before we proceed to setting up the next workspace.





-------------------------------------------------------------
Workspace for avoiding wandering vertices
-------------------------------------------------------------




Switch to the duplicate of the 512 workspace that we created a few moments ago. If you missed this step then you can still just duplicate the 512 workspace now and change the grid scale of the duplicate back to 1.

This workspace can be optimized either for working in original scale or 1:10 scale. Let's start with the latter.


1:10 Scale


To optimize the workspace for this scale set the grid scale to 0.1.



The export scripts for OBJ, COLLADA (.dae) and FBX all allow you to define presets, so you can customize a preset for TRLE that will export your models at the right size. (We will go into detail on this in the modeling chapter)



Original Scale:



Original scale has the advantage over 1:10 when it comes to convenience when importing & exporting models, and normally I'd say that settles the question, but original scale comes with one hook attached, which I imagine could bother some people, so let's go over the issue in detail: as mentioned previously, original scale is gargantuan in Blender, which means you have to increase the clipping distance, but the bigger the clipping distance the more prone to graphical glitches (z-fighting). You can tweak the clipping distance to avoid those graphical glitches, but there are no settings that will work perfectly for both orthographic and perspective view, it's either or. Hence why we disabled the automatic toggling between perspective and orthographic view at the beginning.

Here's a comparison shot of Lara in both perspective view and orthographic view to help you decide:



Perspective view, as the name suggests, renders models with foreshortening - the further away from the camera something is, the smaller it will be.
See this YouTube video on the difference between orthographic and perspective view. I've added a timestamp to the relevant part, but the video in its entirety is under 4 minutes long and it's definitely worth watching all of it.)

You can adjust the Viewport Clipping Distance in the sidebar under the View tab:




If you prefer perspective view you can use following settings:

Clip Start: 1 m
End: 5000 m


If you prefer orthographic view (I can't be the only weirdo who doesn't like the foreshortening when working on character models, right?) you can use these settings:

Focal Length: 1 mm
Clip Start: 0.01 m
End: 6000 m

Note that setting the focal length to 1 mm will make perspective view pretty much unusable, so you're stuck with orthographic view forever until you switch to a different workspace, or change the values back to their default.



^^ that's Lara in perspective view at focal length 3 mm, in case you are wondering

Last edited by not again!; 29-08-21 at 22:45.
not again! is offline   Reply With Quote
Old 29-08-21, 22:35   #7
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default

The next part will be about best modeling practices to make custom objects that are fit to be used for level building. It will probably take another week or two until it's finished.

In the meantime I'd like to recommend this fantastic beginner tutorial: Learn Low Poly Modeling in Blender 2.9 / 2.8.



It covers a lot of the most important tools and techniques, and there's timestamps for each tool in the video description.

An important note in case you actually want to model along with the tutorial: the technique of colorizing the low poly models shown at the beginning is not suited for the TR engine!

You can substitute it with following technique: while in Edit Mode select all faces you want to have the same color, hit U on your keyboard to bring up the UV context menu and select Reset. Scale the resulting UV map until it fits into one such square. You can use this palette, if you don't want to bother with creating your own.



It's a combination of a few of the lovely palettes from lospec, which is mentioned in the video.
not again! is offline   Reply With Quote
Old 02-09-21, 20:50   #8
LeelooBastet
Explorer
 
LeelooBastet's Avatar
 
Join Date: Apr 2003
Location: France
Posts: 545
Default

*** to be delated by Titak after reading***

I HIGHLY recommend that you upload images files on tombraiderforums... Too many images disapear from tutorials.
You should ask Titak to give you authorisation to do so
LeelooBastet is offline   Reply With Quote
Old 03-09-21, 11:05   #9
not again!
Archaeologist
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 1,042
Default

^^ I will make an offline version of this thread for download as zipfile and put it in the opening post once the tutorial is finished. It's easier than to replace all the image links.
Thank you for the reminder; I had not thought about that before, but you are completely right.
not again! is offline   Reply With Quote
Old 05-09-21, 19:06   #10
Titak
Moderator
 
Titak's Avatar
 
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 33,086
Default

Let me know when the tutorial is completed. I can then indeed upload images to our server.
__________________
If it walks like a duck and if it quacks like a duck, it is a duck.
Titak is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 03:16.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.