Jump to content

Modders: Import/Export FO4 and Skyrim LE & SE meshes directly from Blender


Recommended Posts

On 10/18/2021 at 8:26 AM, Bad Dog said:
  1. Yes, your mesh exports with whatever scaling and rotation you gave it in blender, unless it's skinned in which case the skeleton governs anyway.
  2. Best thing to do is import a nif similar to what you're trying to create. The shader will be converted to a material with shader nodes. You can copy it and go from there. I do mostly skinned nifs, so if you're doing objects you may stumble across setups I haven't had to handle.
  3. Yep weight editing works as you'd expect.
  4. No animations. The niftools exporter is now in active development again and they do handle animations. If I have a reason to I can add them, but I expect it to be a lot of work and I'm not sure what value I'd be adding.

Finally got a chance to try this and I think I did something wrong, I got the right hand ring moved to the right position and it shows up perfectly in CK but not in game, possibly because I'm using the body slot 60 for left hand rings like others have. But in-game its invisible. Any idea what I did wrong? Looking at it in nifskope I see in the strings NPC R Finger10 [RF10] and NPC L Finger10 [LF10].

Link to comment

Check that the dismember partitions and the armor addon both have the slot 60. Add it to an outfit and put it on an actor in CK. If it's showing up there in full body view then it's probably rigged correctly. If it shows up when you look at the preview in the armor addon but not when you equip it through an outfit, it's either rigging or body part assignment.

Link to comment
14 hours ago, Bad Dog said:

Check that the dismember partitions and the armor addon both have the slot 60. Add it to an outfit and put it on an actor in CK. If it's showing up there in full body view then it's probably rigged correctly. If it shows up when you look at the preview in the armor addon but not when you equip it through an outfit, it's either rigging or body part assignment.

Yup that was it. I forgot to change the dismember partition number, must've been tireder than I thought.

Link to comment
  • 2 weeks later...
On 3/9/2022 at 8:10 PM, Bad Dog said:

New version up! I'm slowly slowly implementing collisions. There's a bunch of different types and each has its own issues, but I'm getting there.

 

Skyrim only. Fallout collisions are still magic.

 

This could be immensely helpful to me! What if an mesh HAS a collision but its really just too small or in the wrong area or if a mesh doesn't have any collision? Does this mean we can edit, enlarge, or at least transfer collisions? I  know 1 harvestable mesh where the collision is in a bad place.

Link to comment

Meant to post this friday:

 

V4.1 is up. This handles some additional collision types and doesn't depend on V3.0 features so it works with 2.9x. I have to say though, in testing I found enough differences between the two versions that I won't be doing full tests on 2.9x. If you want the most robust version, upgrade your Blender to V3.0. Upside is there's almost no learning curve, for once.

This may be my last update for a while. I'd appreciate it if people would tell me what they'd like to see in the tool. Still on the wish list are:

  • MOPP collisions--hard, requires an external tool, not sure of the value. I'll do it if there's interest.
  • Animations--Not sure what this means really. If it's supporting animations in the nif, things like swinging signs and opening doors, that could be interesting. Again, tell me what you're trying to do and I'll look at it.

---

 

What I've done with the collision types I handle, is they are just shapes in Blender. Edit the shape, edit the collision. It does require you adhere to the rules of the collision type, e.g. convex vert collisions have to be a convex shape, and there's a node hierarchy you have to conform to, but if you do that you're good.

 

As far as I can tell, both ChunkMerge and the Niftools exporter handle MOPP collisions by running the mesh data through an external magic tool. I can do the same, probably. I'd have to reverse-engineer one of those to figure out the format the external tool wants and to read its output. Or, I'm told, their might be enough info out there to write the MOPP data directly but that's a long shot. The goal though would be that you could make a super-low res version of your mesh and use that as your collision shape with no farting around with external tools, or with looking for an existing collision that's close enough to use as is. 

 

Gotta say, a lot of the vanilla shapes kinda suck, are arbitrarily weird, or use the MOPP collisions to be way more detailed than really seems required. E.g. Skyrim's simple farmhouse chair has a MOPP collision when it could be simply made from a few rectangles and a few cylinders. 

 

Anyway, if anybody's actually using this stuff I could look into it.

Link to comment
  • Bad Dog changed the title to Modders: Import/Export FO4 and Skyrim LE & SE meshes directly from Blender

New version up that can export bone hierarchies.

 

This took days and days to do. I'm currently storing bone rotations in a magic custom property on the blender bone objects, but it's a bit of a hack and I've been wanting to encode the bone info in the blender bone position, then read it back out on export.

 

In theory not hard, but I crashed and burned trying to handle the bone roll--the component of the bone transform that corresponds to a roll around the axis of the visible bone in Blender. I thought I could just apply the roll to the Blender bone, but it turns out that determining the component of a rotation transform that is around an arbitrary axis is surprisingly difficult and after trying a million different things I finally gave up. 

 

Getting it right was still troublesome because the rotations from the original nif are absolute, but they have to be written either relative to parent or absolute depending on whether the bone hierarchy is being maintained. But just doing that bit was only ordinarily hard, not brain-meltingly frustrating.

 

I still have stuff I want to do with pynifly but I'm fried. Gonna go back to BDIC for a bit.

Link to comment

I'm either a genius or an idiot, not sure which. No sooner had I given up on the bone-transforms thing than I find the exact function I'm looking for, "to_swing_twist". The twist part is the component of the transformation that rolls around the vector you give it. And there's a second, on the Bone class, that returns the roll around an arbitrary axis. So I plugged those in and after an extraordinary amount of horsing around, got it to work. So bone roll is now a thing. And this best part? This will make absolutely no difference to anyone in the fucking universe except it makes me happy.

 

Well, I guess you might have a reason to roll a bone when posing or something and want to export that. 

 

So I'll do some more cleanup and bugfixing and then release a new version with this.

 

Link to comment
  • 4 weeks later...

hey posted an issue on github about some weird behavior and i thought i should also try here as well:

so i've been trying to use the plugin to set up a workspace to make outfits for (CBBE) 3BA using blender, but i noticed the AreolaSize slider refuses to be imported from the tri file regardless of my attempts to do so, including exporting a tri file with said slider alone via outfit studio, as deleting all the other sliders and exporting the remaining one as its own tri just leads to a whole bunch of nothing happening.
i currently keep up to date with new development releases of blender with significant features so maybe its not compatible with 3.2 yet?

Link to comment

I haven't tested with 3.2. It seems to run fine on 3.1. It is a goal to keep up with new versions of Blender, tho they come out every 15 minutes so it's hard.

 

I'm not sure what would cause one morph to not be exported. Maybe it's the first alphabetically? Anyways, I'll have a look. If you posted an issue at github I'll track the bug there.

 

Link to comment
  • 2 months later...

I'm working on exporting animations using Anton's tools and I'm kinda stuck.

 

Anton's tools consist of a blender script which produces a text file, a "kfmaker" that takes the text file and produces a kf file, then hkxcmd that turns the kf into an hkx file.

 

I want to create the text file from pynifly, then run the converters in a subprocess so it's one step from the user's point of view. I have the blender script restructured so it can be part of pynifly.

 

I'm stuck running the converters in a subprocess. It's easy to create the subprocess and make the programs run, but the kfmaker pauses when it's complete and waits for user input. It apparently isn't reading from stdin for that input--it may be waiting for an explicit keypress. But I can't pass it that keypress from python. It writes its output to stdout, but the output is buffered and not available until the keypress is delivered, which I can't do programmatically. I can end the process, but the contents of stdout aren't available after it ends, so I can't determine if it ran successfully. 

 

In Blender, the output is written to the console window and for some reason, the console window accepts a keypress and passes it to kfmaker so kfmaker can be closed by the user if the console window is open. But I haven't yet found a way to open the console window from python. If it's not open, there's no way to make kfmaker exit and the Blender session is hung.

 

There's a way to redirect stdout from the blender console window to a StringIO. But it only works for print statements (that I've found). Neither logger output nor kfmaker's subprocess output gets redirected.

 

So several ways to solve the problem, all blocked for one reason or another.

 

I'm thinking best I can do might be to write a batch file the user has to run outside Blender. Super ugly, but maybe works.

 

I don't even know where kfmaker came from, whether it's Anton's or somebody else's. If I had the source I might be able to do something with it.

 

Link to comment
  • 2 months later...

 

OK guys, I need some advice and such.

I've got import and export of weapons attach points working. (I think they're the same as armor attach points but haven't gone deep on that yet.) BUT, I'm not sure I'm happy with it yet. Here's the deal.

Connect  points connect a parent mesh to a set of child meshes. The parent mesh defines a set of parent connect points, which are named things like "P-Grip", "P-Barrel" (for the shotgun). Different grips and barrels will attach at these points. The connect points have a location and direction in space, defining where the part will be attached.

The child meshes don't have a corresponding connect point. They do define child connect points, but those are names only, no position in space. (and it seems that there's only one child connect point, tho it can define multiple names). So the origin for the child is just the origin of the nif. It will be moved and rotated in space to attach wherever the parent connect point puts it.

I'm representing the parent connect points as empties that can be moved around in space, but aren't the parents of anything, so they work like all the other extra data nodes. Currently, the child connect points are the same except they're always at the origin.

The problem I see is that if you're designing a weapon with a bunch of interchangeable parts which you will export into separate nifs, it's gonna be a pain. You'll have to design the parts on the weapon then move them to the origin, with the correct rotation, to undo whatever transformation the parent connect point is going to apply. Then you export this mesh (+ extra data), which has no apparent relation to the base weapon, and it will show up correctly in game.

I'm thinking it would be better if you could design and export the part in its natural relation to the parent weapon. Something like:

  • You design the parent weapon, e.g. the shotgun receiver. 
  • You add and place a parent connect point, e.g. for the barrel, placing it at the base of the barrel.
  • You design and place a barrel that fits the receiver.
  • You create a new connect point to be the barrel's child connect point. Maybe you create it by duplicating the parent's connect point so that the position and orientation are the same.
  • You make the child connect point the parent of the barrel. 
  • Maybe you make the child connect point an actual child of the parent connect point. That way the child connect point has no transformation--it just matches its parent. You don't have to worry about getting the transformation right. This seems clean but I'm not sure it's necessary.
  • You select child connect point and barrel (and anything else you want) and export. The exporter positions the child connect point at the origin and exports everything else relative to that, which does the transformation the game expects.
  • Same for any other parts. The parent connect point is positioned relative to the parent mesh, the child connect point is matched to it and is made the parent of any meshes that represent the part.
Thoughts? I've never made a weapon so I'm flying blind a bit.
Link to comment
8 hours ago, Bad Dog said:

 

OK guys, I need some advice and such.

I've got import and export of weapons attach points working. (I think they're the same as armor attach points but haven't gone deep on that yet.) BUT, I'm not sure I'm happy with it yet. Here's the deal.

Connect  points connect a parent mesh to a set of child meshes. The parent mesh defines a set of parent connect points, which are named things like "P-Grip", "P-Barrel" (for the shotgun). Different grips and barrels will attach at these points. The connect points have a location and direction in space, defining where the part will be attached.

The child meshes don't have a corresponding connect point. They do define child connect points, but those are names only, no position in space. (and it seems that there's only one child connect point, tho it can define multiple names). So the origin for the child is just the origin of the nif. It will be moved and rotated in space to attach wherever the parent connect point puts it.

I'm representing the parent connect points as empties that can be moved around in space, but aren't the parents of anything, so they work like all the other extra data nodes. Currently, the child connect points are the same except they're always at the origin.

The problem I see is that if you're designing a weapon with a bunch of interchangeable parts which you will export into separate nifs, it's gonna be a pain. You'll have to design the parts on the weapon then move them to the origin, with the correct rotation, to undo whatever transformation the parent connect point is going to apply. Then you export this mesh (+ extra data), which has no apparent relation to the base weapon, and it will show up correctly in game.

I'm thinking it would be better if you could design and export the part in its natural relation to the parent weapon. Something like:

  • You design the parent weapon, e.g. the shotgun receiver. 
  • You add and place a parent connect point, e.g. for the barrel, placing it at the base of the barrel.
  • You design and place a barrel that fits the receiver.
  • You create a new connect point to be the barrel's child connect point. Maybe you create it by duplicating the parent's connect point so that the position and orientation are the same.
  • You make the child connect point the parent of the barrel. 
  • Maybe you make the child connect point an actual child of the parent connect point. That way the child connect point has no transformation--it just matches its parent. You don't have to worry about getting the transformation right. This seems clean but I'm not sure it's necessary.
  • You select child connect point and barrel (and anything else you want) and export. The exporter positions the child connect point at the origin and exports everything else relative to that, which does the transformation the game expects.
  • Same for any other parts. The parent connect point is positioned relative to the parent mesh, the child connect point is matched to it and is made the parent of any meshes that represent the part.
Thoughts? I've never made a weapon so I'm flying blind a bit.

Thanks for your work on the tool!

 

To your question:

I never created a weapon (i use only Skyrim) but i doing some modding with armors. From the point of view of a user, the more simple the solution is to use a tool effectively, the better it is. In that regard, your proposal to make it simpler is the way to go.

 

I hope this helps.

Link to comment
  • 1 year later...

Thanks for sharing your tool with the community, like another person in this thread I never was able to use the nif exporter from the niftools team, getting errors when trying to export a mesh.

 

I'm having a problem with your tool though, the import seems to work flawlessly (importing the mesh and the scene root correctly in Blender) but when I export back the file to see the mesh in game, this one is stirring all over (even without doing any edit). A screenshot to show what's going on.

 

Spoiler

image.jpeg.2edaf66c401de161b2539df95bcb0f17.jpeg


I tried to investigate on my own but I'm by no means an expert at this. I noticed that the mesh was 100ko less after exporting it, or that translations of NiNodes and BSTriShape were slighty changed (tried to give them the same values as before the exportation with NifSkope, but same bug is happening).

Hoping you could help me with my trouble or give me some insight into why this is happening. Thanks a bunch !

PS : I'm using the V12.0 version of your tool, since there is a a warning for some bugs in the latest V12.1.

Edited by Laethas
Link to comment
  • 2 weeks later...

Skyrim SE? Looks like a major bug I just fixed in the latest.

 

(Turns out SE TriShapes store the bone weights twice, once by vertex and once by bone. I was writing one but not the other, and my tests were all looking at the one that I was writing.)

Link to comment
  • 3 months later...

Hi @Bad Dog, great work with the tool.

 

I recently did some importing with the newest version 14.2 and found a bug in the node groups of the normal map application. When you do the separation into the tree channels, the green channel needs to be inverted. In the current version instead of the green channel, the blue channel is inverted and input into the green before combining the channels.

 

The second thing is just a question. For this tool you probably did a lot of investigating and know more then me. The diffuse textures are imported (all versions) with the color space set sRGB. Skyrim uses diffuse textures in linear color space (at least i read that somewhere). the result in blender is a much darker colors. I usually set the color space in blender to linear rec.709 (best result). What is your take on that? Is sRGB color space an over site or a bug?

 

Thanks again for your work!

 

cheers

Link to comment
  • 2 months later...
On 2/2/2024 at 10:01 AM, monty359 said:

 

 

The second thing is just a question. For this tool you probably did a lot of investigating and know more then me. The diffuse textures are imported (all versions) with the color space set sRGB. Skyrim uses diffuse textures in linear color space (at least i read that somewhere). the result in blender is a much darker colors. I usually set the color space in blender to linear rec.709 (best result). What is your take on that? Is sRGB color space an over site or a bug?

 

The handling of the normal channels is fixed in the current version.

 

I don't actually know much about the different ways of handling a diffuse. I had not heard that Skyrim's diffuse is in linear space. Do you have a reference for that?

Link to comment
11 hours ago, Bad Dog said:

The handling of the normal channels is fixed in the current version.

 

I don't actually know much about the different ways of handling a diffuse. I had not heard that Skyrim's diffuse is in linear space. Do you have a reference for that?

Thanks!

 

i did not find anything on arcane university wiki. I did find several discussions on the internet, that offered a solution to my problem (very dark defuse textures in game).

here is a link with one discussion with an explanation:

 

cheers

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use