www.tombraiderforums.com

www.tombraiderforums.com (https://www.tombraiderforums.com/index.php)
-   Tomb Editor (https://www.tombraiderforums.com/forumdisplay.php?f=31)
-   -   Open Blender To Tomb Editor Workflow Thread (https://www.tombraiderforums.com/showthread.php?t=225129)

not again! 18-09-20 15:03

Open Blender To Tomb Editor Workflow Thread
 



Welcome to the open Blender to Tomb Editor workflow thread! The place to post about road bumps you have encountered, or ideal workflows you have found on your quest to get things from Blender over to Tomb Editor and into your level.


Latest version: Blender 2.92


You can find the portable Zip version and (almost) all older version of Blender here: Blender's index of releases

Each version of Blender conveniently has a portable ZIP version alternatively to the common installer version, which is incredibly useful if you want to use different versions of Blender simultaneously on the same machine.



ESSENTIAL ADDONS



WAD Blender by Bergus

TRF thread for the addon with download
Github page for the addon

This amazing addon lets you import Wads directly into Blender. You can select whether you would like to import
- Lara with all animations
- Moveables (with their respective animations if they have any)
- Statics
- or Everything

So if you are looking to import only a specific model then it's best to create a Wad which contains only the object you need beforehand.


Installation




Opening a Wad in Blender




View animations and edit shine and opacity of models




Import Adobe Mixamo animations to Tomb Editor WadTool




You can use this model for the process shown in the video above:
https://drive.google.com/file/d/1-rt...ew?usp=sharing


--------------------------------------------



TRLE addons by Sapper

GitHub page for the addon
Tutorial on sapper's blog

Caring about backwards compatibility is always a good thing, so if you'd like your models to be compatible with the classic tools and the old Wad format there's sapper's plugin that lets you bake the textures of UV-unwrapped models over to the classic texturing format following a method that was developed by teme9 (the original thread outlining the technique)



--------------------------------------------


Import OBJ with vertex colors by Lwmte

Quote:

Originally Posted by Lwmte (Post 8199904)
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.91\scripts\addons\io_scene_obj\ subfolder
  • Replace import_obj.py file with this one (right-click and "Save object as...")

Tutorial thread - Tomb Editor Room export / import workflow

When exporting a room from Tomb Editor the model keeps the lighting that you applied in Tomb Editor as vertex colors. This modified import script allows you to import room geometry in OBJ file format with vertex colors into Blender.
See the linked above tutorial thread for a more detailed explanation and description how to import/export room geometry.



Optional Addons


MQO Import

This is mostly useful for a backwards compatible workflow if you want to use the old Wad file format!

Blender 2.8 and newer

GitHub page for the addon by 50thomatoes50 and Sapper

The plugin can import MQO models from both editwad and Strpix (and naturally Metasequoia itself) without textures.


Blender 2.79b

mqo_script_268 (I haven't been able to find out who wrote the plugin)

This addon can import models with textures, including Skin_Joint_Checks, exported from editwad provided the textures are in the same folder as the MQO. The textures can be extracted with TextureAdd. Make sure to export them as individual images and not as texture page.

not again! 18-09-20 15:07

A few random findings I can share / update: the info is now obsolete; preserving it for archaeological purposes behind spoiler tags:

there are several older Blender versions that are of interest because they can import .3ds files exported from WadViewer with correctly placed object origins, which is the key factor in ensuring that a model will be correctly assembled when importing it into WadTool (speaking mainly of moveables with more than one mesh). Newer versions of Blender will laugh at your request to import object origins correctly.

Blender 2.73a (imports .3ds files of enemy characters and creatures flawlessly and with textures)
Blender 2.79b (imports statics and moveables that consist of only one mesh with textures)

Blender 2.49b might be useful too, but that needs more investigation (it imports traps that are composed of multiple meshes like stargate, plough, sentry gun, etc. better than other versions, but the models still would need manual corrections.



Scale and setting up Blender to work with large models:

A level editor building block (one square, 4 clicks high) in its original size is 1024 x 1024 x 1024 default units in Blender. At the default settings Blender will not display a model of that size without clipping, but using scale 1:1 means there's one thing less to remember and worry about when importing & exporting.

To set up Blender's view port to display large models you have to adjust the clipping distance:



Hit N on your keyboard to bring up the tool panel where you can edit the clipping values.
There's the option to save your changes to a startup file so you don't have to repeat those steps everytime.

I would not recommend trying to work on exported room geometry at scale 1:1 though, that's certainly going to push Blender's view port capabilities.
But it's perfectly practical for WAD objects.

Lwmte 18-09-20 15:45

It seems that Blender 2.91 will restore 3ds importer, at least that's what they declare in the issue tracker here. In this case, you will be able to directly export models/animations from wadviewer/trviewer to latest Blender and reimport into WadTool using fbx/collada/obj/whatever.

AshySlashy 18-09-20 18:51

Congrats on the grand opening. :D

Since I'm a beginner, I've got little to add here yet, but still.

Speaking of scale

When I was searching through posts here trying to find something about "Blender to TRLE tutorials" I've bumped into this tutorial. It focuses on importing UV mapped models into classic wads, but I think it may be useful for TE either (I haven't tested it yet, unfortunately). It also contained a tip for how to set up the grid in Blender to match TRLE block (idk if it's well-known :D).

So, the settings are:

https://i.imgur.com/7o2QO6t.png

Result:

https://i.imgur.com/UXBnenI.png

https://i.imgur.com/IRyE75K.png

I use .obj format to export models, so the import settings in WadTool should be these:

https://i.imgur.com/Whjpsxw.png

Now I'm using this method to import models and it works like a charm.
There may be an easier way, however. If someone knows one, I'd be happy to learn more. :)
I guess, it's the most convenient way when you create a model from scratch, since you don't have to mess with distance view and huge meshes.

SrDanielPonces 18-09-20 18:53

^ i use these exact values too

not again! 19-09-20 14:38

@ Ashy Slashy - thank you, that's very useful info (it was new to me)

@ Lwmte - this is great news! It would be a dream come true if the new plugin could also import the animation data stored in the .3ds file


I was about to make a tutorial thread for the workflow below, but now I think it's better to wait for the new .3ds Blender plugin, otherwise the tutorial is going to be outdated pretty quickly again. I'll just drop all the relevant info what the workflow currently entails into this thread in the meantime.

Importing NPCs and Creatures into WadTool

As stated in the previous post you'll need Blender 2.73a (portable ZIP) for this.


1. Export the model as .3ds from WadViewer

2. Import into Blender 2.73. If you get an error message and the model shows up like this in Blender:

https://i.imgur.com/201kwqX.png

then go back to WadViewer and export the model again, picking a different animation from the drop-down. Blender can't import the animation stored in the 3ds file either way, but some animations apparently trip the importer up while others don't. In the dog's case animation #003 worked.

3. Save as .blend file

4. load the model into the latest version of Blender for the actual editing and re-modelling

5. as last and most crucial step before exporting select the root mesh (M000) to make it the active mesh, then hit A to select all meshes (the root mesh should now be a brighter shade of orange than the others), press the right mouse button and select Snap > Selection to Active. This will reset the coordinates of all object origins to zero, collapsing the model into a heap of body parts.

6. export as .obj

7. import into WadTool selecting the Replace Model option and using the 3ds Max OBJ preset (at the bottom of the dropdown list)
And don't forget that depending on what scale you were using in Blender you will have to adjust the scale accordingly.

8. test ingame :p




The entire process from WadViewer to testing ingame takes less than three minutes. It's incredible how modifying TRLE models has gone from very time consuming and cumbersome to so quick and straightforward. :D

Lwmte 19-09-20 15:45

I want to contribute here as well and clarify certain points.

Very often people ask "how do I apply shiny and blending modes to models that I import into WadTool, since WadTool itself doesn't allow doing that?"

It is very easy, because WadTool reads material properties from loaded model, so you can assign these properties right inside Blender.

To adjust shiny effect, you need to edit Sheen attribute in material properties:


NOTE: if you are exporting to OBJ format, shiny attribute won't be correctly exported. Some people have found a workaround by manually editing .mtl file, but I don't know much about this, maybe Lore can elaborate. So I recommend exporting to COLLADA (.dae) format or something else, especially because COLLADA will also export vertex colours (you may want to use those if you want to make a static mesh with baked-in shading).

To make texture appear semi-transparent (additive blending), you need to edit Alpha attribute in same material properties. Just reduce the value from 1.0 to anything less than 1.0, and texture will be semi-transparent:


Other blending modes are currently not supported, but of course you may use true alpha channel on your textures, it will be imported correctly in WadTool.

PLEASE NOTE that if you want to apply either shininess or additive blending only to certain faces in your model, you should use separate material for this. I am not that familiar with Blender, maybe not again! or someone else will cover this in the future ;)

AshySlashy 19-09-20 17:07

Quote:

Originally Posted by Lwmte (Post 8240522)
NOTE: if you are exporting to OBJ format, shiny attribute won't be correctly exported. Some people have found a workaround by manually editing .mtl file, but I don't know much about this, maybe Lore can elaborate. So I recommend exporting to COLLADA (.dae) format or something else, especially because COLLADA will also export vertex colours (you may want to use those if you want to make a static mesh with baked-in shading).

Yeah, I'm working with .obj format, and shine effect is always messed up, although I zero all the material parameters in Blender.
To anyone who may encounter unexpected shininess on object in game:

1. Open object-related .mtl file in text editor.
2. Alter the Ns parameter (0 = no shiny effect). Should be something like this:

Code:

# Blender MTL File: 'sobek_door01.blend'
# Material Count: 1

newmtl Material.002
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 1
map_Kd door02.png

Maybe it really is time to turn to .dae.

Quote:

Originally Posted by Lwmte (Post 8240522)
To make texture appear semi-transparent (additive blending), you need to edit Alpha attribute in same material properties. Just reduce the value from 1.0 to anything less than 1.0, and texture will be semi-transparent

@Lwmte, thank you so much. Lately I was wondering if I can texture a part of an object with semi-transparent textures to have the desired effect (and without using Strpix). Time for some experimenting. :)

not again! 19-09-20 19:21

It's actually Roughness which corresponds to the Ns value in the .mtl - you would expect it to be Specualr or Shine, but it's Roughness for some reason :D

I'll borrow the code you provided:
Quote:

Originally Posted by AshySlashy (Post 8240530)

Code:

# Blender MTL File: 'sobek_door01.blend'
# Material Count: 1

newmtl Material.002
Ns 0.000000
Ka 1.000000 1.000000 1.000000

edit: to clarify - Roughness needs to be set to maximum to get rid of any unwanted shine, and set it to zero for extra shinyness. The Tomb Raider sprite for shine will only be applied to meshes that were set in Blender to smooth shading
Kd 0.800000 0.800000 0.800000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 1
map_Kd door02.png


the corrseponding shader sliders in Blender for the .mtl material settings are:

Ns => Roughness
Ka => ?
Kd => Base Color
Ks => Specular
Ke => Emission
Ni => IOR (index of refraction)
d => Alpha

the bold ones are the two we need.

edit: The Tomb Raider sprite for shine will only be visible on meshes that were set to smooth shading in Blender, tho.

Lwmte 19-09-20 19:57

Yeah, it's weird that blender exports roughness as shininess for obj format... Sadly we can't do much about that, it's clearly an issue on either blender or assimp library side (TE uses it to import 3D models).


All times are GMT. The time now is 08:45.

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