Project Blender Mesh Tools add-on

Felix24

Active member
Joined
May 13, 2010
Messages
245
Reaction score
95
Points
43
So - bear with me - the only way to set "advanced" material properties for such as reflections is through the D3D9 Debug client material controls (that allow to save material properties), right ? And hand-editing the mesh file, of course...
A good way to set advanced material properties in the D3D9 client (for textured surfaces) is to use advanced texture maps. It allows you to set the material properties on a per-pixel basis using textures instead of globally for an entire material on a mesh if you use the D2D9 debug window. You can always set some parameters globally using the D3D9 debug window, and then add texture maps just for the properties you need to control directly.

Here's what I mean:

1. Diffuse texture. Let's imagine we create a vessel that uses a texture called Atlantis.dds. This texture controls the diffuse color, and is the only type of texture map that the basic Orbiter D3D7 renderer uses.

2. Reflection map. This would be named Atlantis_refl.dds (each different texture map uses the original filename and adds its own suffix). This is an optional texture that controls the intensity and color of the environmental reflections. Darker values mean less reflection, brighter values mean more reflection. Colored textures lead to colored reflections.

3. Roughness map. This would be named Atlantis_rghn.dds. Roughness is a bit of a misnomer- it is actually a smoothness map. Brighter monochrome values lead to a more mirror-like finish in the environmental reflections, while darker values lead to a more frosted mirror or metal finish.

4. Specular map. This would be named Atlantis_spec.dds. This is where things get weird. This is kind of a legacy map that is optional, useful only if you want direct control over the color and brightness of the specular reflections (rgb channel) and the power, or spread, of the reflections (alpha channel). The HST in this addon benefits greatly from the added control of the specular map: https://www.orbithangar.com/showAddon.php?id=74ab1810-f2bc-428d-aa06-a283a595894f

For translucent objects like parachutes or ISS solar panels, there are two more texture maps that you can play with:

5. Translucency map. This file would end in "_transl.dds". This behaves like a diffuse map that is illuminated from the inside. This allows translucent objects to allow light to pass through in a diffuse fashion.

6. Transmittance map. This file would end in "_transm.dds". This controls how much sunlight is allowed to shine through the material, creating a "hot spot" of sun glare directly in line with the sun. The rgb channels control the intensity and color of the sunlight that makes it through. The alpha channel controls the size of the sun's hotspot.

You can see an example of the _transl and _transm maps working in the ISS solar arrays in the D3D9 client. You can also see the textures at work in the DM-2 Crew Dragon parachutes: https://www.orbithangar.com/showAddon.php?id=06e64e6a-53e0-45ba-8aa4-2adf6a7fa792

When texturing an addon, I try to do things in this order:
1. Mesh file material definitions. This helps make sure that the mesh doesn't look bad in D3D7.
2. Advanced texture maps. If I can get the mesh in the D3D9 client to look right at this point, then I stop.
3. D3D9 debug window. Sometimes I can only get the desired effect on a material if I tweak some parameters in the debug window. But then it makes installation of the addon a bit more complicated because the D3D9 material definitions file needs to be installed alongside the addon.
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
..
Now another question : in the "Orbiter Materials" panel you have a "Specular Power" field which is set to 10 on default (I'd say it looks like rough aluminium, which is perfect for a lot of spacecraft). I've been trying to enter different values to simulate very reflective surfaces like solar panels or MLI (aka "goldfoil") but I'm having trouble. It seems there is no upper limit to the value so what kind of range are we talking about ? What kind of value should I enter if I want a mirror-polish look like glass or chrome ? I'll run more trial and error but could be useful for other users to make some kind of "scale" in the documentation.
..

Those values are documented in the Orbiter SDK. Unfortunately there is not much for 'specular' power with regards to range, or scale.

The third line specifies the specular colour. This is the colour of light reflected by a polished surface into a narrow beam. The power entry specifies the width of the cone into which specular light is reflected. Higher values mean a narrower cone, i.e. sharper reflections. Typical values are around 10. If omitted, the default value for power is 0.

--3DModel.pdf


So pretty much as you said, trial and error.
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,286
Reaction score
3,255
Points
203
Location
Toulouse
- Added sort mode options that will allow you to export the mesh groups based on object name.

This is really a cool and powerful feature !
 

Sword7

Member
Joined
Mar 23, 2008
Messages
140
Reaction score
16
Points
18
Location
Gaithersburg, MD
I have a question for you. I have Blender 3.0. Will this tools work with Blender 3.0?

Are you planning to port tools to FreeCAD (another free parametric-based CAD editor)?
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,286
Reaction score
3,255
Points
203
Location
Toulouse
Hello @Blake, I have a problem exporting .blend to .msh, have an idea of what's going ? Seems it is related to texture / UV_coordinates, but I can't trace to the error :

Python:
Python: Traceback (most recent call last):
  File "C:\Users\Nicolas_2\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\orbiter-blender-master\__init__.py", line 141, in execute
    orbiter_tools.export_orbiter(config, scene)
  File "C:\Users\Nicolas_2\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\orbiter-blender-master\orbiter_tools.py", line 542, in export_orbiter
    groups = [MeshGroup(config=config, mesh_object=m, scene=scene) for m in meshes]
  File "C:\Users\Nicolas_2\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\orbiter-blender-master\orbiter_tools.py", line 542, in <listcomp>
    groups = [MeshGroup(config=config, mesh_object=m, scene=scene) for m in meshes]
  File "C:\Users\Nicolas_2\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\orbiter-blender-master\orbiter_tools.py", line 313, in __init__
    self.uv_tex_name_path = temp_mesh.materials[0].node_tree.nodes['Image Texture'].image.filepath
AttributeError: 'NoneType' object has no attribute 'filepath'

location: <unknown location>:-1

Thanks.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,917
Reaction score
2,921
Points
188
Website
github.com
Seems like you have a texture name issue. Try narrowing down the offending group by selecting only a few groups for export, and them you can check if the texture path for it is ok.
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
I'm guessing the material is not using nodes, so there is no 'Image Texture' node. Is this an older file you are now trying to use with Blender 3.x?

If you can post/send a file I can take a look. It should not error like that without nodes, but I'm always finding new little nooks and crannies in Blender. :)
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,286
Reaction score
3,255
Points
203
Location
Toulouse
Seems like you have a texture name issue. Try narrowing down the offending group by selecting only a few groups for export, and them you can check if the texture path for it is ok.

Well I did that, found the faulty material. Not exactly sure what went wrong though.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,917
Reaction score
2,921
Points
188
Website
github.com
Well I did that, found the faulty material. Not exactly sure what went wrong though.
Try deleting the texture entry and adding it again.
Worst case scenario you can delete the material and texture entries (write down the values, or save it whole model first), export the offending group and then add the material and texture manually in the .msh file.
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,286
Reaction score
3,255
Points
203
Location
Toulouse
Try deleting the texture entry and adding it again.
Worst case scenario you can delete the material and texture entries (write down the values, or save it whole model first), export the offending group and then add the material and texture manually in the .msh file.

Did that, deleting the material solved the issue, there wasn't too much UV work, that's OK (y)
 
  • Like
Reactions: GLS

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,917
Reaction score
2,921
Points
188
Website
github.com
Did that, deleting the material solved the issue, there wasn't too much UV work, that's OK (y)
I don't think deleting the material or texture affects the uv mapping.
 

MaxBuzz

Well-known member
Joined
Sep 19, 2016
Messages
1,407
Reaction score
2,133
Points
128
Location
Kursk
in blender 3.0 this segment error (for example, if you made the material glow, but the material does not glow in the orbiter)
MATERIAL light
0.900 0.900 0.900 0.850
0.800 0.800 0.800 1.000
0.700 0.700 0.700 1.000 100.000
0.990 0.990 0.990 0.990
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,055
Reaction score
642
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Well, after a lot of experimenting, I found the solution to my problem that I couldn't export textures and UV maps correctly.
This works for Linux.
It turns out that the solution that worked for me is to remove all preferences from Blender to reset it to its default values. Do not set the language but leave it in English. And work with the meshes and textures in folders without symbolic links.

Apparently Blender Mesh Tools has problems handling non-English languages and/or symlinked folders. At least that's my experience.

Tested on Manjaro Linux (rolling release) and Blender 3.3.1 - Blender Mesh Tools works perfect. :cheers:
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
Well, after a lot of experimenting, I found the solution to my problem that I couldn't export textures and UV maps correctly.
This works for Linux.
It turns out that the solution that worked for me is to remove all preferences from Blender to reset it to its default values. Do not set the language but leave it in English. And work with the meshes and textures in folders without symbolic links.

Apparently Blender Mesh Tools has problems handling non-English languages and/or symlinked folders. At least that's my experience.

Tested on Manjaro Linux (rolling release) and Blender 3.3.1 - Blender Mesh Tools works perfect. :cheers:

I never test with non-english settings, but I'll give that a shot and see if I can duplicate and do something about it.
 

Jordan

Active member
Joined
May 13, 2010
Messages
136
Reaction score
80
Points
43
Location
Germany
Hi @Blake, I have a question for you:
Is there a way to manually assign mesh group numbers?
I want to replace a mesh with one I plan to make from scratch and I want the mesh numbers to match for the sake of the animations.
When you import the mesh in blender, rename each group eg. 01_group, 02_group, etc. and select when you export the mesh "Sort Order" -> "Group Name ASC" This preserves the group order in the new exported mesh.
 

Jordan

Active member
Joined
May 13, 2010
Messages
136
Reaction score
80
Points
43
Location
Germany
@Blake
Is it possible that the groups are sorted in the following order?

eg. I have 2 collections and want the groups of the 1st collection to be at the beginning and then the groups of the 2nd collection.

Currently the groups are sorted by their names
Mesh01
Mesh01.001
Mesh02
Mesh02.001

But I want them like this
Mesh01
Mesh02
Mesh01.001
Mesh02.001

SortOrder.jpg
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,286
Reaction score
3,255
Points
203
Location
Toulouse
@Jordan : You can get around this by renaming the meshes in the way that suits you.

I personally use a numerical prefix like :

00_EngineNozzle
01_EngineChamber
02_EngineTruss
... and so on :)
 

Jordan

Active member
Joined
May 13, 2010
Messages
136
Reaction score
80
Points
43
Location
Germany
@Jordan : You can get around this by renaming the meshes in the way that suits you.

I personally use a numerical prefix like :

00_EngineNozzle
01_EngineChamber
02_EngineTruss
... and so on :)
That's exactly what I suggested in my previous post. But what I asked for may be useful to me.
 
Top