www.tombraiderforums.com  

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

Closed Thread
 
Thread Tools
Old 23-05-20, 13:40   #1
Lwmte
Archaeologist
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 1,129
Default Tomb Editor - Room export / import workflow

Hello everybody!
With Tomb Editor 1.3 release getting really close, I am posting this text tutorial here to describe forthcoming long-awaited feature — proper room exporting and importing.

First off, you need to select a room which you want to export. Then, navigate to Rooms -> Export rooms... menu entry:


Specify a place where you want to export your room mesh. Note that you can export to various formats, but export format of choice is Wavefront OBJ. Tomb Editor is able to export to mqo and some other formats, but final export result can be inconsistent depending on format limitations.

Next up, export settings dialog will appear. For default workflow which involves using Blender instead of Metasequoia, you don't have to edit any settings in this window. It should look like this:


Push OK, and you should see export result in the folder you have specified. If you have exported to OBJ as proposed, you will see .obj file (model itself), .mtl file (material settings) and several texture pages, similar to meta2tr output:


Next step is crucial if you want to import a room with Tomb Editor lighting applied via vertex colors. Sadly, by default Blender does not provide OBJ importer which can read vertex colors data, because this is against official OBJ specification. To overcome this, you need to use modified OBJ import script:
  • Go to folder where Blender is installed
  • In Blender folder, go to 2.82\scripts\addons\io_scene_obj\ subfolder.
  • Replace import_obj.py file with this one (right-click and "Save object as...")

Now you can open Blender, remove default cube, camera and light from scene, and import your OBJ file by going to this menu entry:


Select your OBJ file in the next dialog and you will see that your room mesh is now loaded in Blender! Select it by clicking on it! Unless you click on it, you won't be able to edit room mesh:


Now, you can do all the fancy stuff with your room mesh! You can sculpt on it, split / join / subdivide / distort faces or do vertex painting to modify lighting. Remember that you can't use specular / shiny effects and other features which are incompatible with TR engines. Those simply won't be visible in final level.

IMPORTANT! main rule of thumb while editing room mesh: BY ANY MEANS you should preserve positions of vertices adjoining to other connected rooms! If you don't do so, they won't be matched by Tomb Editor's algorithms to create smooth lighting transitions from room to room. If you are completely sure what you are doing, you may do this though.

Another important thing is that after sculpting, make sure you triangulate all faces, because Blender tends to create quads and even pentagons sometimes while using free sculpting tools.

For our example, let's just do simple vertex painting without modifying actual geometry. Click on the edit mode selector in top-left corner of Blender window and select "Vertex Paint":


Let's do some fancy stuff here! Note that Blender has really neat tools to customize your room's colours! It's not possible to achieve same result in Tomb Editor itself or any classic TRLE workflows:


After you've finished editing, you need to export your file back to TE. Make sure you export to the same folder where textures for your custom mesh are placed! Now is the tricky part. As I said, Blender doesn't officially support vertex colours editing for OBJ file format and yet we lack custom OBJ exporter which can solve this issue. But you can export to COLLADA instead! So, go to this menu entry and export your room:


PLEASE NOTE that if you are not planning to use custom lighting painted in Blender, you can export to any format you want: OBJ, COLLADA, FBX etc. It is possible to automatically relight custom room mesh in Tomb Editor.

Now you can import your room mesh back to TE. You can either navigate to level settings -> imported geometry, click plus button there and specify a path to your geometry, or you can simply drag-n-drop your new exported mesh to Tomb Editor main window. After that, you'll be prompted with import dialog:


As with export, you don't have to change anything here if you're using Blender workflow. Just click OK, and... Tadaaa, your custom room mesh is in your room!


Now you must align your custom mesh perfectly to original room position, so portals will match. Do it:


Now you can turn on textures, draw whole level and see that it perfectly matches original room, but with your custom applied lighting in Blender!


Next step is also needed if you've applied custom lighting in Blender. Without deselecting custom mesh, push O button on keyboard to bring up imported geometry settings window. There, make sure that Lighting model is set to Vertex colors:


If you'll set this option to calculate from lights in room, obviously custom lighting will be ignored, and mesh will be automatically relit using all lights from the original room.

Additionally, you can set Force sharp edges option for room mesh, if you want to create hard flat shading for it. Sadly, currently it's not possible to import original edge properties and normals from Blender into Tomb Editor, and they will be ignored. If you need to have sharp edges in certain part of your room mesh, split it into 2 separate objects and import them separately with different options.

Now, final step! Probably you already guessed that you still have old room in place which overlaps your custom mesh. To hide it, Tomb Editor 1.3 features new Hide room function which will exclude original room geometry from rendering in final level without the need of texturing it with invisible tiles:


By using this option, you can always fall back to original room geometry, edit it and re-export it. However, as with meta2tr, room mesh exporting/importing can be considered as one of the final postproduction steps, so it is recommended to do it when you already have all your collision geometry, triggers and items sorted out.

In addition, there is global 3D view helper option which makes all rooms marked as hidden barely visible and inactive in editor, making it unable to select or texture any faces in these rooms. Also, you can selectively hide imported meshes by setting "Hide in editor" checkbox in imported geometry settings window or by right-clicking on them and toggling same "Hide in editor" option:


Also, keep in mind that tomb4 has a strict limit on room face count, which is around only 2800 or 3000 faces, after which it will crash. Tomb Editor will prompt you when you get close to it.

In addition to described workflow, Tomb Editor 1.3 will be able to export several rooms at once. For this, select needed rooms in 2D map and use same export rooms menu entry. In this case, resulting model will contain all selected rooms as separate objects, placed in original world coordinates. Yet it's not possible to import such setup back, but you can use it for secondary purposes.

That's it!
Tomb Editor 1.3 will be released in next few days. Update will be announced separately in this thread.

Last edited by Lwmte; 23-05-20 at 17:54.
Lwmte is offline  
Closed Thread

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 05:01.


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