Nexus Buddy 2

Nexus Buddy 2 - Granny Editor for Civ 5 2.5.3

Good news is that your leaderskinning works! I just used one diff for all the dds files and I could see that the texture work

the bad news is that doing a civ4 skeleton was really warped. Granted I didn't have an animation assigned (which could have been the problem). But the texture hurdle has been solved so now its just a matter of converting animations to GR2s and seeing if that works!
 
I looked at my multi skeleton export and I'm wondering if bones alone will work with multi meshes. But I'm still working on the leader though

It should be straight-forward now to add support for multi-model/skeleton files. At the moment, Nexus Buddy is based on an assumption that there is one model in the file. All that is needed is to display a list of the models/skeletons in the file in a new tab and create the facility for replacing the meshes assigned to each one. Code-wise this is no more difficult than the Append function I've already created. I'll get to this, but I'm focusing on trying to write a replacement for the grnreader98 export to SMD first.

Good news is that your leaderskinning works! I just used one diff for all the dds files and I could see that the texture work

Cool. I was pretty sure it would.

the bad news is that doing a civ4 skeleton was really warped. Granted I didn't have an animation assigned (which could have been the problem). But the texture hurdle has been solved so now its just a matter of converting animations to GR2s and seeing if that works!

I'm sure that's solvable. We have animation conversion working for units and there's no reason why things should be different for leaders. If you can't figure it out I can take a look.
 
I'm focusing on trying to write a replacement for the grnreader98 export to SMD first.


I definetely don't want to get in the way of that. One thought though. Both the milkshape.txt and smd files are readable in notepad (but I use Visual C++) Maybe we can bypass SMD completely and just have gr2s convert to milkshape.txt files? the text formats seem similar but if if I had to choose I'd rather see smd handle leaders rather than making a gr2>milkshape.txt (via smd conversion script)
 
Another question: is it possible to load/see the texture of a model in the Grannie Viewer? I haven't tried out all the options, but a quick lookaround didn't show me a way.
 
Another question: is it possible to load/see the texture of a model in the Grannie Viewer? I haven't tried out all the options, but a quick lookaround didn't show me a way.

I don't thinkso. I saw with civcity rome gr2s that they would load but it seemed that the paths line up. but it never worked that way with gr2s I created.
 
Question. Would it be possible to use a more modern software such as 3DS Max to create a mesh and bone structure, export that file to an FBX, open in blender, export FBX using your script, open in photoshop cs6, texture and paint the model, save as the proper dds files, then use NB2 to put the whole thing together as a GR2?

Basically, would it be possible to use modern tools to do the heavy lifting of creating textures, meshes and bone structures, then use the legacy tools to convert those things to GR2...
 
I definetely don't want to get in the way of that. One thought though. Both the milkshape.txt and smd files are readable in notepad (but I use Visual C++) Maybe we can bypass SMD completely and just have gr2s convert to milkshape.txt files? the text formats seem similar but if if I had to choose I'd rather see smd handle leaders rather than making a gr2>milkshape.txt (via smd conversion script)

I thought the same thing about direct conversion to Milkshape Ascii. Both the SMD format and Milkshape ASCII txt are fairly simple and clean formats to work with.

My progress so far: I found another gr2 exporter called evegr2toobj.exe here. Unlike grnreader98.exe, the source code is included.

After a bit of tinkering about, I was able to get evegr2toobj.exe to compile in Visual Studio. evegr2toobj only exports the gr2 mesh to Wavefront OBJ format. However, the code gives access to all the mesh information needed to output to SMD/Milkshape Txt - it didn't output the bone binding information - but I have been able to extend to output that too.

So now I have C++ code that can access all the vertex, triangle and bone binding data for each mesh - all the data you see when you view the detail of a mesh in Granny Viewer. I have been able to output the "triangles" section of an SMD file from my code and the output exactly matches the output of grnreader98.exe.

The only remaining work in order to create a full SMD file is to output the skeleton and bone data. It is much simpler to access this data since all of it, including bone positions and rotations, is available via existing methods in the Firaxis Granny dll. So I'm currently around 90% confident that I can bring all this together to do a full SMD export. Seeing as everything involved will be in accessible C++/C# code I should be able to create SMD export code that doesn't suffer from the two big issues with grnreader98.exe - the fact that it doesn't work for most Leader gr2s and the fact that skeletons are often incorrectly rotated relative to the mesh. If I can get this SMD export code working without either of these two issues then it should be relatively easy to move on and creating a direct export to Milkshape ASCII.

That will leave only the inaccessible Leader textures as a major barrier to modding existing 3D assets. I have an idea to try for that too:

Make a perfectly square mesh in Blender, output to FBX and convert to gr2. Assign a Leader shader in Nexus Buddy 2, preferably Opaque_Matte or whatever the simplest one is, and assign one of the Leader base textures. I don't think that the texture will display in Nexus 3D Viewer so you will have to switch a leader fxsxml to point to your square gr2 and view in game. If you can set the scene up so that the square points directly towards the camera with no clutter in the foreground or lighting reflections then you can use Print Screen to capture the texture. Tedious, but it could work - and once you have the square gr2 and fxsxml set up it is simple but repetitive work to screen grab other Leader textures.
 
Another question: is it possible to load/see the texture of a model in the Grannie Viewer? I haven't tried out all the options, but a quick lookaround didn't show me a way.

I think this should be possible, but there is an issue with Nexus Buddy in that at the moment it saved texture filenames only without the full path and Granny Viewer only displays textures if the full path to the texture is correct. I need to try this out - but I could add a checkbox in Granny Viewer that allows the full file path to textures to saved into the gr2 which might allow textures to be seen. I'll test at some point.
 
Question. Would it be possible to use a more modern software such as 3DS Max to create a mesh and bone structure, export that file to an FBX, open in blender, export FBX using your script, open in photoshop cs6, texture and paint the model, save as the proper dds files, then use NB2 to put the whole thing together as a GR2?

You should be able to simply export FBX from 3DS Max/Maya or anything else and open in Nexus Buddy 2 (which will run the FBX->GR2 import behind the scenes). As far as I know the FBX->GR2 conversion handles both binary and ASCII FBX files, but it's not something I've explored since Blender is what I'm most familiar with. My changes to the FBX export are minor and only involved renaming certain objects - they don't alter any 3D data.

As an aside, I discovered that Autodesk has a free FBX Converter that includes a 3D Viewer for FBX files. The converter only converts between different FBX versions, binary and ASCII and few other formats.
 
I thought the same thing about direct conversion to Milkshape Ascii. Both the SMD format and Milkshape ASCII txt are fairly simple and clean formats to work with.

My progress so far: I found another gr2 exporter called evegr2toobj.exe here. Unlike grnreader98.exe, the source code is included.

After a bit of tinkering about, I was able to get evegr2toobj.exe to compile in Visual Studio. evegr2toobj only exports the gr2 mesh to Wavefront OBJ format. However, the code gives access to all the mesh information needed to output to SMD/Milkshape Txt - it didn't output the bone binding information - but I have been able to extend to output that too.


Ah, yes I messed around with that. It used to only give me the eye balls of a leader. I wish I was better at C++ (I only did some coding for the CTP2 source code) or I'd help out.

So now I have C++ code that can access all the vertex, triangle and bone binding data for each mesh - all the data you see when you view the detail of a mesh in Granny Viewer. I have been able to output the "triangles" section of an SMD file from my code and the output exactly matches the output of grnreader98.exe.

The only remaining work in order to create a full SMD file is to output the skeleton and bone data. It is much simpler to access this data since all of it, including bone positions and rotations, is available via existing methods in the Firaxis Granny dll. So I'm currently around 90% confident that I can bring all this together to do a full SMD export. Seeing as everything involved will be in accessible C++/C# code I should be able to create SMD export code that doesn't suffer from the two big issues with grnreader98.exe - the fact that it doesn't work for most Leader gr2s and the fact that skeletons are often incorrectly rotated relative to the mesh. If I can get this SMD export code working without either of these two issues then it should be relatively easy to move on and creating a direct export to Milkshape ASCII.

:bowdown: Damn, that is great stuff. I wonder if there is a way to pull from granny viewer all the skeleton data. Maybe a script that reads its out put that way you can at least compare what the data out put is between the two easier. It might be in its dll? :dunno:



That will leave only the inaccessible Leader textures as a major barrier to modding existing 3D assets. I have an idea to try for that too:

Make a perfectly square mesh in Blender, output to FBX and convert to gr2. Assign a Leader shader in Nexus Buddy 2, preferably Opaque_Matte or whatever the simplest one is, and assign one of the Leader base textures. I don't think that the texture will display in Nexus 3D Viewer so you will have to switch a leader fxsxml to point to your square gr2 and view in game. If you can set the scene up so that the square points directly towards the camera with no clutter in the foreground or lighting reflections then you can use Print Screen to capture the texture. Tedious, but it could work - and once you have the square gr2 and fxsxml set up it is simple but repetitive work to screen grab other Leader textures.

Leave that to me to test.
 
I thought the same thing about direct conversion to Milkshape Ascii. Both the SMD format and Milkshape ASCII txt are fairly simple and clean formats to work with.

My progress so far: I found another gr2 exporter called evegr2toobj.exe here. Unlike grnreader98.exe, the source code is included.

After a bit of tinkering about, I was able to get evegr2toobj.exe to compile in Visual Studio. evegr2toobj only exports the gr2 mesh to Wavefront OBJ format. However, the code gives access to all the mesh information needed to output to SMD/Milkshape Txt - it didn't output the bone binding information - but I have been able to extend to output that too.

So now I have C++ code that can access all the vertex, triangle and bone binding data for each mesh - all the data you see when you view the detail of a mesh in Granny Viewer. I have been able to output the "triangles" section of an SMD file from my code and the output exactly matches the output of grnreader98.exe.

The only remaining work in order to create a full SMD file is to output the skeleton and bone data. It is much simpler to access this data since all of it, including bone positions and rotations, is available via existing methods in the Firaxis Granny dll. So I'm currently around 90% confident that I can bring all this together to do a full SMD export. Seeing as everything involved will be in accessible C++/C# code I should be able to create SMD export code that doesn't suffer from the two big issues with grnreader98.exe - the fact that it doesn't work for most Leader gr2s and the fact that skeletons are often incorrectly rotated relative to the mesh. If I can get this SMD export code working without either of these two issues then it should be relatively easy to move on and creating a direct export to Milkshape ASCII.

That will leave only the inaccessible Leader textures as a major barrier to modding existing 3D assets. I have an idea to try for that too:

Make a perfectly square mesh in Blender, output to FBX and convert to gr2. Assign a Leader shader in Nexus Buddy 2, preferably Opaque_Matte or whatever the simplest one is, and assign one of the Leader base textures. I don't think that the texture will display in Nexus 3D Viewer so you will have to switch a leader fxsxml to point to your square gr2 and view in game. If you can set the scene up so that the square points directly towards the camera with no clutter in the foreground or lighting reflections then you can use Print Screen to capture the texture. Tedious, but it could work - and once you have the square gr2 and fxsxml set up it is simple but repetitive work to screen grab other Leader textures.

You are the man! Awesome work, you're adding a whole new level of depth to CiV modding! Really looking forward to seeing all these new features put to use.

I haven't had any luck getting custom features to show up, the existing simpleshaders don't appear to be populated within the feature gr2s, which makes me think those textures may be hard coded in the graphics DLL. I've still got a lot more permutations of textures/assignments to try though, so it may work yet.
 
did you try building shaders too? I thought they would do it.

Building shaders work, but the texture 'floats' above the terrain rather than lying flat on it. That might be something to do with the model in the marsh gr2 rather than the building shader itself though.
 
Building shaders work, but the texture 'floats' above the terrain rather than lying flat on it. That might be something to do with the model in the marsh gr2 rather than the building shader itself though.

Doing my best to keep up with this thread. Out of my depth but trying. Can you explain what shaders are in this context and your workflow for building one? Additionally, I've been looking into making features as well but I cant seem to find the art defines table that points to the feature gr2 files, much like the missing art defines for terrain. What's the art define file for features? Or are you talking about editing features already in the game by changing install folder files.

Think the best work around for adding features ATM is to just add them as resources that change yields but don't provide a resource, then fixing up the tooltip to reflect them as a feature.

Who knows maybe the expansion will give us art defines for that stuff.
 
Building shaders work, but the texture 'floats' above the terrain rather than lying flat on it. That might be something to do with the model in the marsh gr2 rather than the building shader itself though.


that sounds like a model issue and the way its rigged. the helicopter does something with bones to make it float. for my uav unit I have to mess with the mesh to make it elevated. try move the mesh lower below the ground a put one vertice there to anchor it.
 
I haven't had any luck getting custom features to show up, the existing simpleshaders don't appear to be populated within the feature gr2s

I can see them. See this screenshot. You should only have to set the BaseSampler and the LightCubeMapSampler as shown, the other textures were reported as being in the parameter set but I don't think they are used. Which feature file are you looking at?
 
Ah, yes I messed around with that. It used to only give me the eye balls of a leader.

The simple reason for that is the code was hard-coded to output the first mesh. For GR2s with multiple meshes like the leaders that's not going to work. I've changed this to a parameter so that I can extract the data for each mesh one by one.

I wonder if there is a way to pull from granny viewer all the skeleton data. Maybe a script that reads its out put that way you can at least compare what the data out put is between the two easier. It might be in its dll? :dunno:

As I say, all the data is accessible via a combination of C++ and C# code, but Granny Viewer is very useful in checking that you've extracting everything correctly. I've used right-click View in Detail for the mesh and skeleton a lot recently!

I have all the necessary data for the export so only remaining issue is converting it all into something Blender can read. The only difficult part of this seems to be converting the bone rotations from the Quaternions used in GR2 into Euler coordinates.

The bones are twisted slightly differently from the grnreader98 SMD but they're still twisted. I'm going to change tack and try outputing direct to Milkshape txt. Then at least all the code involved in getting from GR2 into Blender will be in my hands - even if I can't get my head around the mathematics!
 
I now have code to export direct to Milkshape TXT from Nexus Buddy. It works even for the 29 mesh and 828 bone Napoleon leader model. Still need to crack the bone/position rotation, but everything else seems to be working.

 

Attachments

  • napoleon.jpg
    napoleon.jpg
    126.6 KB · Views: 1,762
Top Bottom