Aller au contenu

Photo

Blender 2.68 MDB Import/Export Plugin


  • Veuillez vous connecter pour répondre
104 réponses à ce sujet

#26
Morbane

Morbane
  • Members
  • 1 883 messages
even a placeable equivalent of some of the nwn CC tiles would be great - at least in my opinion :)

#27
rjshae

rjshae
  • Members
  • 4 505 messages
Okay, sounds good then. I've been able to build a walk mesh from the MDL aabb data (although I'm not sure what all the bit flags on the faces mean, other than the walkable/non-walkable bit) and I think I might be able to extract MDB-style collision box meshes as well. Still tinkering...

Posted Image

Modifié par rjshae, 22 novembre 2013 - 06:52 .


#28
-Semper-

-Semper-
  • Members
  • 2 259 messages
guess those other bits are for the different materials so that the engine knows which stepping sounds to play. in 3dsmax that's handled through a walkmesh material. details are from tazpn's tools:

Walkmeshes (WALK):
Walk meshes seem to control where you can walk and where you cannot. Some vertices have unusual values like -1,000,000 to indicate a link to other walk meshes or perhaps non-navigable terrain. In Max, you probably want to use Quad/Tri Patches to create these.

Material IDS (Source: Jason Keeney of Obisidan)

MTL DEC HEX Name
---- ---- ----- --------
1 0 0x0000 no walk
2 9 0x0009 dirt
3 17 0x0011 grass
4 33 0x0021 stone
5 65 0x0041 wood
6 129 0x0081 carpet
7 257 0x0101 metal
8 513 0x0201 swamp
9 1025 0x0401 mud
10 2049 0x0801 leaves
11 4097 0x1001 water
12 8193 0x2001 puddles

I have remapped the material ids since max does not support values greater than 1000. For backward compatibility, if the name starts with "0x" then the old mechanism is used else I just use the values above


Modifié par -Semper-, 22 novembre 2013 - 04:30 .


#29
kamal_

kamal_
  • Members
  • 5 258 messages

rjshae wrote...

Oops, it looks like they moved the Batch Naming script to here.

You're supposed to be able to install it by selecting User Preferences (under File) then 'Install from File...'. But it is not showing up in the selection list. Maybe there's something wrong with the bl_info in the script?

Yeah, I haven't been able to get it figured out.

#30
rjshae

rjshae
  • Members
  • 4 505 messages

-Semper- wrote...

guess those other bits are for the different materials so that the engine knows which stepping sounds to play. in 3dsmax that's handled through a walkmesh material. details are from tazpn's tools:

Walkmeshes (WALK):
Walk meshes seem to control where you can walk and where you cannot. Some vertices have unusual values like -1,000,000 to indicate a link to other walk meshes or perhaps non-navigable terrain. In Max, you probably want to use Quad/Tri Patches to create these.

Material IDS (Source: Jason Keeney of Obisidan)

MTL DEC HEX Name
---- ---- ----- --------
1 0 0x0000 no walk
2 9 0x0009 dirt
3 17 0x0011 grass
4 33 0x0021 stone
5 65 0x0041 wood
6 129 0x0081 carpet
7 257 0x0101 metal
8 513 0x0201 swamp
9 1025 0x0401 mud
10 2049 0x0801 leaves
11 4097 0x1001 water
12 8193 0x2001 puddles

I have remapped the material ids since max does not support values greater than 1000. For backward compatibility, if the name starts with "0x" then the old mechanism is used else I just use the values above


I'm not sure it's the same for the MDL and MDB files. The MDL models I've looked at thus far have 3 = Grass, 4 = Stone, and 7 = Unwalkable.

kamal_ wrote...

rjshae wrote...

Oops, it looks like they moved the Batch Naming script to here.

You're
supposed to be able to install it by selecting User Preferences (under
File) then 'Install from File...'. But it is not showing up in the
selection list. Maybe there's something wrong with the bl_info in the
script?

Yeah, I haven't been able to get it figured out.


I think I have it loaded now. This seemed to work:
  • In Blender, select 'User Preferences' under the File menu
  • Select 'Install from File...', navigate to the file, then pick it and click on the 'Install from File' button
  • There should be a grayed out entry in the list: '3D View: Item Panel'
  • Click on the small check box to activate then Save User Preferences and close
  • In the 3D view, click on the View menu and toggle Properties
  • There should be a little car icon at the bottom of the Properties panel

Modifié par rjshae, 23 novembre 2013 - 05:33 .


#31
kamal_

kamal_
  • Members
  • 5 258 messages

rjshae wrote...

[*]In Blender, select 'User Preferences' under the File menu
[*]Select 'Install from File...', navigate to the file, then pick it and click on the 'Install from File' button[*]There should be a grayed out entry in the list: '3D View: Item Panel'[*]Click on the small check box to activate then Save User Preferences and close[*]In the 3D view, click on the View menu and toggle Properties[*]There should be a little car icon at the bottom of the Properties panel[/list]

Hmmm.... stuck at step 5. I don't see anything like properties under the view menu.
https://dl.dropboxus...nity/step_4.jpg
https://dl.dropboxus...nity/step_5.jpg

#32
rjshae

rjshae
  • Members
  • 4 505 messages
You'll want to use the View menu down in the lower left, below the 3D frame and left of 'Select' in your pic. The hot key listed is 'n'.

#33
kamal_

kamal_
  • Members
  • 5 258 messages

rjshae wrote...

You'll want to use the View menu down in the lower left, below the 3D frame and left of 'Select' in your pic. The hot key listed is 'n'.

ok got it. The author said that support for texture renaming was coming, but it looks like it was never added. It did rename all the parts of the test tile correctly so it's still useful.

The Blender ui is horribad.

#34
rjshae

rjshae
  • Members
  • 4 505 messages

kamal_ wrote...
The Blender ui is horribad.


Heh, no argument there. :)

It's probably possible to batch modify the texture names using the Python scripting interface directly. Not sure whether you want to go there...

Modifié par rjshae, 23 novembre 2013 - 02:00 .


#35
rjshae

rjshae
  • Members
  • 4 505 messages
I finally got the orientation transform working properly for the imported MDL models so that things are oriented correctly. Hurray!

Here I'm trying it out on a few more imported NWN models:

Posted Image

Not quite sure what went wrong with the desk, but I did confirm that the coordinates are the same as in the MDL file so the import is working as it should. Perhaps there's an issue with the de-compiler I used (NWN Carottes)? Shrug.

Anyway, I think I'll call this feature done for now.

#36
kamal_

kamal_
  • Members
  • 5 258 messages

rjshae wrote...

kamal_ wrote...
The Blender ui is horribad.


Heh, no argument there. :)

It's probably possible to batch modify the texture names using the Python scripting interface directly. Not sure whether you want to go there...

Ideally what I'd want to do is loop through all .mdb files in a folder and do a search/replace or prepend on the texture name. For example the codi sigil tileset had really generic texture names that would very likely result in duplicate texture names if used in a large pack (the floor texture is "floor.dds" for example). I used ReNamer to rename all the textures to codi_xxxxx so there would be unique texture names for the tileset. Doing that requires that all the .mdb's have each texture in them switched to the new codi_xxxx standard. Doing that manually is possible, but time consuming.

I don't care if I have to open them in Blender/Gmax whatever. Doing a whole folder at a time via command line would actually be perfect, preferable to opening each individually in Blender or Gmax and doing them one at a time that way.

For some tilesets, I also need to rename model parts because I've made "original texture" and "retexturable" versions of the tileset. Gmax lets me do this fairly quickly even though it's done manually. Per Hellfire, two models should not have the same part names.

#37
rjshae

rjshae
  • Members
  • 4 505 messages
Well it's perhaps not exactly what you want, but you could use Hex Editor Neo to do a global search and replace of text strings throughout a .mdb file. You just need to avoid changing the positional offsets, so, for example, 32 character strings will need to stay 32 characters long. The Neo replace function does support regular expressions and the software allows simultaneous file openings.

Modifié par rjshae, 23 novembre 2013 - 12:06 .


#38
rjshae

rjshae
  • Members
  • 4 505 messages
I don't suppose that anybody knows if NWN2 has an undocumented walk mesh material type for snow?

For the record, here are the (NWN) MDL aabb material codes I've found thus far:
 1 -- Sand
 2 -- (Vertical stone: unwalkable)
 3 -- Grass
 4 -- Stone
 5 -- Wood
 6 -- Shallow Water
 7 -- Unwalkable
 9 -- Carpet
 10 -- Metal (grating)
 15 -- Lava
 17 -- Deep water
 19 -- Snow

#39
kamal_

kamal_
  • Members
  • 5 258 messages

rjshae wrote...

I don't suppose that anybody knows if NWN2 has an undocumented walk mesh material type for snow?

For the record, here are the (NWN) MDL aabb material codes I've found thus far:
 1 -- Sand
 2 -- (Vertical stone: unwalkable)
 3 -- Grass
 4 -- Stone
 5 -- Wood
 6 -- Shallow Water
 7 -- Unwalkable
 9 -- Carpet
 10 -- Metal (grating)
 15 -- Lava
 17 -- Deep water
 19 -- Snow

This is what gmax reports, taken from a cave tile
https://dl.dropboxus.../walk_codes.jpg

The CODI-Sigil tileset, which was imported from nwn1, has the same set. In going through the tilesets for my project I've never seen anything higher than the (12)WalkPuddles.

#40
rjshae

rjshae
  • Members
  • 4 505 messages
Thanks. I found surfacemat.2da, which lists the same surface materials. I'm curious whether adding to that file would cause the system to recognize new materials (and associated sound sets) in the walkmesh? Maybe the Sound codes in surfacemat.2da map to columns in the footstepsounds.2da file? It'd be nice to be able to use the crunchy snow sounds in a tileset or placeable.

The Material types for snow in terrainmaterials.2da just maps to Stone. I wonder if the Material column in terrainmaterials.2da maps to triplets of columns in footstepsounds.2da? Not sure where the codes in the Sound column of surfacemat.2da gets mapped to step sounds.

Modifié par rjshae, 23 novembre 2013 - 03:46 .


#41
kamal_

kamal_
  • Members
  • 5 258 messages

rjshae wrote...

Thanks. I found surfacemat.2da, which lists the same surface materials. I'm curious whether adding to that file would cause the system to recognize new materials (and associated sound sets) in the walkmesh? Maybe the Sound codes in surfacemat.2da map to columns in the footstepsounds.2da file? It'd be nice to be able to use the crunchy snow sounds in a tileset or placeable. The Material types for snow in terrainmaterials.2da just maps to Stone.

I would guess that they do map. At least in external areas, the game plays sounds by predominant ground texture (I tested this awhile back for some reason). It would be straightforward if you wanted to test to change the material references for snow in terrainmaterials

The confusing thing is there's multiple columns for each terrain type in the footstepsounds.

#42
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<sharing...>

In NwN1, the aurora base for creature models stores event information, including footstep (and detonation =). This way the footstep event is tied to the appropriate "step" frame of the animation. If you want to hear a footstep, the appearance model has to have footstep events in the anims.

The sound is then looked up in footstepsounds.2da referencing the two-letter sound type in surfacemat.2da.

The sounds are (I think) randomly cycled through the three variations in footstepsounds.2da

<...stories>

#43
-Semper-

-Semper-
  • Members
  • 2 259 messages

rjshae wrote...

The Material types for snow in terrainmaterials.2da just maps to Stone. I wonder if the Material column in terrainmaterials.2da maps to triplets of columns in footstepsounds.2da? Not sure where the codes in the Sound column of surfacemat.2da gets mapped to step sounds.


i guess that terrainmaterials.2da and surfacemat.2da both map to footstepsounds.2da. obsidian specifically created terrainmaterials because they upgraded the aurora engine and integrated outdoor areas where no walkmesh is created by hand in a 3rd party app. long story short: terrainmaterials is to map sounds to painted textures in outdoor areas and surfacemat is for placeables and tiles with a walk mesh material.

those triple columns are just there for variation. btw there're still footstep sounds for snow. it's shouldn't be hard to reactivate them.

#44
rjshae

rjshae
  • Members
  • 4 505 messages
I confirmed that it does work for the exterior snow textures, after modifying the surfacemat.2da and terrainmaterials.2da files to use the Snow sounds. They're not very scrunchy sounds, but they do sound a little different.

I also tried a modified placeable with a walk mesh that has its material bit flags set to 0x00004001, but that just silenced the footsteps. It looks like the bit flag check was never added to the code... unfortunately.

Hmm, but maybe there's a use for silent steps... like walking in air?

#45
rjshae

rjshae
  • Members
  • 4 505 messages
Well I've got everything implemented that I started out to do and I want to spend more time on another project, so I went ahead and uploaded the latest release 2.6.2 to the Neverwinter Vault site. Here's a list of the changes:

  • Added import/export of HAIR objects, using the material component index of the brown-hued base face to set the Hair Shortening Behavior flag.
  • Included import/export of HELM objects, using the material component index of the violet-hued base face to set the Helm Hair Hiding Behavior flag.
  • As imported SKIN packets are always given an ARMATURE modifier, the export code will now check for that modifier to see if an object should be exported as a SKIN packet. The option to export as a SKIN has thus been rendered unnecessary.
  • Added a white-hued vertical face on the HOOK mesh to represent the default door position, so it is easier to position correctly.
  • Used the material's use_shadows setting to preserve the No_Cast_Shadows texture flag for individual RIGD objects.
  • Added a parameter to the import panel that allows you to enter a new Model title. This name will be globally substituted into the object and material names. It replaces any prefixes that match the file name, ignoring upper or lower case lettering in the process.
  • Added a parameter to the Import/Export panels to set the minimum Z-coordinate for imported WALK meshes. This allows the special imported Z-values set at -1000000 to be raised for ease of editing, then lowered again on export.
  • Modified the names of the import and export controls to make their roles clearer.
  • Fixed a problem where a hair model failed to export if 'Mesh is a Head' wasn't selected on import.
  • Implemented the ability to import Neverwinter Night .MDL files that are in ASCII format. Converting face-based texture mapping to vertex-based can result in some of the textures appearing stretched. For best results, the texture mapping should be reworked prior to export.
  • Added a walk mesh type for an unimplemented material bit flag (0x00004001), which makes steps silent while walking over it. This might have a few specialized uses.
There are also a few undocumented bug fixes. Hope you like it. :happy:

I've added a brief tutorial on importing .MDL files with this version of the plug-in.

Modifié par rjshae, 24 novembre 2013 - 08:15 .


#46
rjshae

rjshae
  • Members
  • 4 505 messages
Experienced modellers will probably snicker at this one. I started playing with UV maps, so I took a model and changed the unwrapped UV map. However, when I tried to display the part in the NWN2 toolset, only one of the mesh triangles would show up. I did all sorts of things to get it to work. Finally I took a look at the underside, and there was the texture in all it's glory. I had all but one of the normals backwards!

Anyway, I figured out how to fix it. :blush:

#47
rjshae

rjshae
  • Members
  • 4 505 messages
Dwarven bridge: old, solid, dependable, tintable.

Posted Image

This model was imported from a pair of NWN MDL files into blender, reworked to give it a slight arch and end caps, retextured, then exported back out to .mdb. I'm not completely happy with the texturing or normal maps, but I think it turned out okay. The cobble stones are tintable.

Something odd happens when I use it though. At the edges, right where I enter the cobble stones, the camera suddenly dips down to a closeup. It goes back to normal after a couple more steps. Very wierd. I've tried tweaking the model and the walk mesh, but nothing helps. It all seems to bake normally.

Modifié par rjshae, 26 novembre 2013 - 06:07 .


#48
PJ156

PJ156
  • Members
  • 2 986 messages
Despite the gitch it's a nice addition to the stable of models.

PJ

#49
Tchos

Tchos
  • Members
  • 5 072 messages

rjshae wrote...
Something odd happens when I use it though. At the edges, right where I enter the cobble stones, the camera suddenly dips down to a closeup. It goes back to normal after a couple more steps. Very wierd. I've tried tweaking the model and the walk mesh, but nothing helps. It all seems to bake normally.

Someone around here knows what causes that to happen.  They told me once, and it seems like it was something easily fixable.  I hope whoever it was speaks up again, because I seem to have forgotten what it was.

I like structures that look like they've been in the world for a while.  Most of the stock placeables are very clean.

#50
Calister68

Calister68
  • Members
  • 341 messages
Interesting bridge ! Where did you find the mossy wall texture ? Was it with the original placeable ?
About your camera problem, are you sure there are no collision mesh somewhere ?

Modifié par Calister68, 26 novembre 2013 - 07:08 .