Blender Add-on: PapyNR

yeah modeling of dmg meshes can be done in three different ways, surely more
for any resulting mesh, the key is to respect the engine's dmg conventions
prob. best to respect them from very beginning ... but that would hinder modeling workflow very much I guess ..

anyway I'll see what blender has to offer for an agreeable workflow when I check out PSG's/engine's dmg convention
(... export and re-import of same would seem unnecessary to me)
 
ok I am afraid to admit how much time I spent hacking away at this but I found a faster and less user error prone method. Despite my best efforts and everything I know about blender it kept making the pas compiler give vert count errors for more complex meshes.

Essentially the PAS file when it comes to damage morphs (when not using animation frames) just needs to know the difference in the VERTEX_LIST every other block in the data structure needs to be 100% the same as the undamaged piece. It appears blender is too smart as it tries to auto-clean a mesh: The Normals: It changes the shading math because the angle changed. The Index Order: Sometimes, if a face is moved or "folded," Blender's exporter re-prioritizes which vertex is listed first. The UV splits: If a vertex is pulled too far, it can "un-stitch" from its neighbor in the internal buffer.

So what is the next option? Simply 'sanitize' the exported PAS file post-process to REPLACE every damaged mesh with the undamaged piece's data except for the VERTEX_LIST

Keep the same:
VERTEX_LIST

Delete and replace with undamaged mesh's data everything else until the data structure block ends: (literal copy/paste method)
FACE_LIST
NORMAL_LIST
MATERIAL_REF
TEXTURE_FACE

of course you can manually go into a pas and copy/replace but that is tedious so I made a script to auto-find any pas files in the folder I run it to find and replace these data blocks for me:
1771482111460.png

what would take a ton of work every time I have to make a change in blender now is a mere second to fix. I just have to make sure my damaged and undamaged meshes in blender have matching vertex order as that is now the only thing the pas will retain.

I don't know if there is a way with the addon to make it post process chosen meshes to sanitize referencing another but this is the next best thing working for me right now (unless someone blender savvy knows how to make blender match data with another mesh 100% while the vert positions are different).

No more exporting or importing OBJ's I just have to ensure the original meshes are consistent for vertex order
 
With the script it thankfully alleviates it a lot more though, I don't have to import/export anything, my post on the previous page can pretty much be disregarded minus the trial and error breakdown lol, the copy/paste method refereeing the undamaged pieces directly pasting its data to the damage pieces (leaving vertex list alone) is a lot easier.

With this current mod I'm able to ram into wall head first and see the front end blow off or do a barrel roll and the top flattens and take damage as expected with no weird geometry issues.
 
Generated L3 Lods for one of the makes today, this went MUCH faster knowing I just have to replace all the damaged L3 parts with their respective L3 data using the script I have, zero compile errors and damage in game all translated as expected.

I went from spending probably 3 days on L1 Lods (stuck on compile error lol) to a hour or less on the next Lod level.

I don't forsee any issues as I generate the rest of the damage for the other makes and Lods levels so my next check in with the plugin will probably be when I move to the cockpit which has other different elements like the gauges and stuff.that animates.
 
re car damage and I'm inspecting PSG and 3DO
COTV3.psg in Nisbet_3do_Tutorial.7z as linked from here
(pls advise on better example if available)​
How do the "bitfield" parameters work? how to arrive at 8 and the 0,8,16,24 to the right? do we know how the bitfields interact with the BBOX?
sandbox docs are informative but not enlightening
***
(A)---relevant excerpt from COTV3.psg

(B)---visualization; yellow is "B_L1_PUD_body_546909" in 3DO

***
---(Sandbox\docs\make3do.doc)---REGION_MORPH---Constructs a REGION MORPH node. The two meshes must have the same number of vertices and faces, and the vertices and faces must be in the same order for it to work correctly. [In 3DS Max and to ensure that vertices and faces remain in same order, create the two meshes by modeling an animated mesh, then use two frames of the animation for this construct.] Each region can be controlled by its own state variable, or regions can be setup to share a variable. Optionally (and optimally), the state variable can be broken into bit fields (up to 32 bits total) where each field controls a region of the mesh. In each region, the bbox defines which vertices are considered part of the region (vertices can be included in more than one region and weights will be calculated automatically).
Code:
sceneIdentifier: REGION_MORPH meshIdentifier DESTINATION meshIdentifier
        REGIONS (bboxIdentifier stateVarName [numBits firstBit],
                 bboxIdentifier stateVarName [numBits firstBit], ... )
 
All I know is the numbers represent the region the damage will occur according to the bounding boxes you labeled on the mod. If your label associated to the BBOX is incorrect then for example say you hit the right side of the car into a wall but the left side takes damage instead you assigned it incorrect.

For example I make a BBOX for my hood of my car and then I assigned that cube as the hood_damage 8 0 region. If I were to instead assign it to chassis 8,24 if I slam the car head first the hood won't morph. Or if I made a BBOX on the roof and associated it to be hood_damage 8 0 then when I slam head first even if the roof was not touched it caves in.

Also, to my understanding the number possibly plays a role in the 'resolution' of damage done. For example how hard or soft you hit an obstacle if the morph will shape slowly or instantly.
 
Last edited:
re REGION_MORPH---make3do.exe splits the source mesh per boundBoxes specified, writes these regions into named <_damage> containers (the destination) and appends to each the list of vert_indices to reference/match all this stuff
⠀⠀(it does not look the bitfields would affect anything in this geometry split)

judging from inspecting papy cup .3DO:
(A) --- it looks like the bitfields are some sort of subregion, enabling the sim's dmg model to differentiate the affected side of <chassis_damage> and <corners_damage>
Code:
---  dmg subregions (bitfield mapping)  ---  papy cup .3DO
        chassis       corners
 0      ---n/a        frnt left
 8      left          frnt right
16      right         rear left
24      roof          rear right
⠀⠀conclusion is to consistently match the second bitfield number to the used boundBoxes (and the latter's exact extents ... which we are free to set)
***
(B) --- papy re-used the rearend setup <rend_damage 8 0> for 3 different boundBoxes
⠀⠀yellow=entire rear⠀⠀⠀⠀cyan=rear center⠀⠀⠀⠀⠀magenta=rear wing
⠀⠀
 
Ultimate stress testing the plugin as my current mod in development now has lods for undamaged version and full lods for all 4 makes with damage. the output of meshes has grown exponentially in the single scene:

Screenshot_20260221_171501.png

its so far faster than exporting from the old 3ds max 8 a large PAS scene, only a small pause until it completes.
 
no yikes, perfectly normal for a feature complete mod. Its all the separate damage pieces and lod levels that really makes the count go up. Not all those meshes would loaded at once but a mod has tons and and tons of parts. Its good the exporter is not having any issue with large quantities needing to be exported into a single pas file.
 
Opening post updated for v.0.0.3
https://www.mediafire.com/file/pq2ya8djfzczlq1/260302_papynr2003.zip/file
***
-- PAS export⠀⠀⠀⠀/ adds scratch PSG for meshes within PAS; see Summary of PAS output
-- PAS export⠀⠀⠀⠀/ supports Sharp Edges: mesh is split at authored sharp edges
-- ui, PAS export⠀⠀/ adds Collections and custom assignment to selection of objects
-- 3DO and PAS⠀⠀/ improves handling of normals
-- 3DO import⠀⠀⠀ / supports <RegionMorphVertexListDescriptor> (damage mesh)
 
Opening post updated for v.0.0.3
https://www.mediafire.com/file/pq2ya8djfzczlq1/260302_papynr2003.zip/file
***
-- PAS export⠀⠀⠀⠀/ adds scratch PSG for meshes within PAS; see Summary of PAS output
-- PAS export⠀⠀⠀⠀/ supports Sharp Edges: mesh is split at authored sharp edges
-- ui, PAS export⠀⠀/ adds Collections and custom assignment to selection of objects
-- 3DO and PAS⠀⠀/ improves handling of normals
-- 3DO import⠀⠀⠀ / supports <RegionMorphVertexListDescriptor> (damage mesh)
1772948698138.png
Do you know what I should be looking for when loading into the file? Sorry for the confusion
 
You need to go to Preferences > addons and install the zip there to enable it.

The top toolbar you will see a new option to the right of the select/add/object menus:
1772960464554.png
 
friend of mine helped me get a model of a project im working on in
first order of business will be optimizing and prepping xfinity models for a mod (maybe)
 

Attachments

  • image.png
    image.png
    2.7 MB · Views: 30
Hey TShirt, just a heads up, while you're working on the script for older versions of Blender, I'm revisiting my version to get it going with newer versions. And I'm hoping to have driver animations figured out this time, I was close before. Getting quite a bit of help from Claude this time. I'm already exporting PAS files that run through make3do without an error in Blender 5.1. And they look to have proper smoothing groups from what I could see in 3DSimEd. I havent tossed it in game yet, but that's coming soon. I really want to figure out the driver, that got on my nerves, lol.
 
Hey TShirt, just a heads up, while you're working on the script for older versions of Blender, I'm revisiting my version to get it going with newer versions. And I'm hoping to have driver animations figured out this time, I was close before. Getting quite a bit of help from Claude this time. I'm already exporting PAS files that run through make3do without an error in Blender 5.1. And they look to have proper smoothing groups from what I could see in 3DSimEd. I havent tossed it in game yet, but that's coming soon. I really want to figure out the driver, that got on my nerves, lol.

I've been manually injecting animation into my PAS files after the blender addon exports. I'm currently doing it it manually to get the values and keyframes and then have a script that injects the animation blocks to the associated meshes I need them to be at. I've completed 2 full mods so far from Tshirt's plugin and have successfully added animation working with the mods.

Were you just figuring out how to code the translations of blender values into a PAS or did you need to know what the animation values needed to be? If its the later I can share my findings
 
I've been manually injecting animation into my PAS files after the blender addon exports. I'm currently doing it it manually to get the values and keyframes and then have a script that injects the animation blocks to the associated meshes I need them to be at. I've completed 2 full mods so far from Tshirt's plugin and have successfully added animation working with the mods.

Were you just figuring out how to code the translations of blender values into a PAS or did you need to know what the animation values needed to be? If its the later I can share my findings
I went a bit overboard with how I wanted to do driver animations. I got it setup where the arms are parented to an armature and had a couple of extra bones parented to the steering wheel so I can set it up as IK. Turn only the wheel and the arms follow. I then had Claude make me a button I can just click to take the transform values of each animated mesh and bake them to keyframes. Last time I was having issues, it was because I couldn't get the transform data from the mesh so the animations didnt properly work or the mesh would be inverted or some other wierd stuff. I havent went the whole way with the conversion yet, I know it exports now, not sure if it converts. I'm just trying to setup a decent size test project using the old Rockstar files so I can test the cars, make sure smoothing groups and edges are working, and make sure the driver is working. If all that works then it should be ready for just about anything else.
 
Burnout3D---That's great to hear and I can only encourage you to go ahead. Good luck!
Now, if driver animations are a thing for your upper body part then I wonder where you would locate the damage morph stuff (and how to control meshes) ... well I know where that sits ...

In general, I feel I can cover newer versions but can't test myself---the compatability devil is in the detail.

Animations are on my list and I will cover them at some point. Recently, as hinted by himself, Mystical identified the PAS inputs, and last week I had some very early, successful tests with external steer.wheel anim, all as per Mystical's ID'ing of components. /1/
So the animation issue, on my end, is more about workflow and blender interface ...​
On this note, the following add-on for Grand Prix 4 title seems to have nice + relevant implementation of a similar anim convention:
GP4 Mesh Tools for Blender - Animations (V2.30, Feb. 2025, by Öggo)​
⠀⠀⠀

/1/ For rotation, the inputs are: quaternion X,Y,Z with the W component in the negative (blender's W value is simply written as -W in PAS; flipped sign).
 
Burnout3D---That's great to hear and I can only encourage you to go ahead. Good luck!
Now, if driver animations are a thing for your upper body part then I wonder where you would locate the damage morph stuff (and how to control meshes) ... well I know where that sits ...

In general, I feel I can cover newer versions but can't test myself---the compatability devil is in the detail.

Animations are on my list and I will cover them at some point. Recently, as hinted by himself, Mystical identified the PAS inputs, and last week I had some very early, successful tests with external steer.wheel anim, all as per Mystical's ID'ing of components. /1/
So the animation issue, on my end, is more about workflow and blender interface ...​
On this note, the following add-on for Grand Prix 4 title seems to have nice + relevant implementation of a similar anim convention:
GP4 Mesh Tools for Blender - Animations (V2.30, Feb. 2025, by Öggo)​
⠀⠀⠀

/1/ For rotation, the inputs are: quaternion X,Y,Z with the W component in the negative (blender's W value is simply written as -W in PAS; flipped sign).
If I'm remembering correctly, animations had to be keyframed every frame in 3ds Max. That was a headache to do in Blender because there was no easy way of baking the animation to keyframes like there is in 3ds Max. I had Claude figure that out and got a tool that can read my animations and bake them to keyframes. I know they look to export fine as well, but I haven't tested it yet to see if make3do will convert the PAS. That's coming soon. Here's some sample clips of how I got my driver rigged before I convert it to key frames. I can still make adjustments while it's rigged. It's different.
 
If I'm remembering correctly, animations had to be keyframed every frame in 3ds Max

I only keyframed in 3ds max for a driver frame 1, 10, and 20 for any animation for a driver I did. Frame 1 = turning left, frame 10 center, frame 20 = turning right In blender I do the same keyframe length and I just export the position and rotation data from frames 1, 5, 10, 15, and 20 so it matches the 800 tick rate from 3ds max and those blocks I paste into my PAS.

When looking back at my old PAS file from my 2020 ICR mod it only added in the PAS those same frames and not all 20 frames, for example on a driver's left arm:

Code:
NAME "driver_left_arm"
    PARENT "driver_body"
    TRANSFORM {
        XFORM_ROW0 0.96357    0.03335    -0.26537
        XFORM_ROW1 -0.02639    0.99921    0.02974
        XFORM_ROW2 0.26615    -0.02166    0.96369
        XFORM_ROW3 -0.14416    0.20872    0.04199
        XFORM_POS -0.14416    0.20872    0.04199
    }
    XFORM_ANIMATION {
        ROT_TRACK {
            ROT_SAMPLE 0    -0.01297    -0.13412    -0.01507    0.99077
            ROT_SAMPLE 800    -0.00860    -0.08733    -0.00352    0.99614
            ROT_SAMPLE 1600    -0.00124    -0.01227    0.02170    0.99969
            ROT_SAMPLE 2400    -0.00062    0.01437    0.05113    0.99859
            ROT_SAMPLE 3200    -0.00226    0.02744    0.07197    0.99703
        }
 
Opening post updated for v.0.0.4
https://www.mediafire.com/file/uie8q9s5ysseh58/260504_papynr2003.zip/file
***
>> ACTION REQUIRED to ensure compatability of EXISTING PROJECTS with new versions:​
>> Navigate to [3D viewport menu] PapyNR, click Version compat. 0.0.3/0.0.4​
-- ui, panel⠀⠀⠀⠀⠀⠀/ adds wizard to create RgnMorph dest. objects (using Lattices)
-- PAS export⠀⠀⠀⠀/ corrects the data in SHAPE:TRANSFORM section (row-major matrix)
-- PAS export⠀⠀⠀⠀/ adds option to apply object scale to exported vertex coords
-- PAS export⠀⠀⠀⠀/ adds option to smooth all faces (can help with RgnMorph meshes)
-- PAS export⠀⠀⠀⠀/ adds option to nominate a material as donor for paintjobs' config
-- ui, menu⠀⠀⠀⠀⠀ / adds item to generate PSG:TRANSFORM commands for selected objects
-- ui, menu⠀⠀⠀⠀⠀ / adds item to generate PAS:XFORM_ANIMATION section from sel. objs
-- ui, menu⠀⠀⠀⠀⠀ / adds user presets for overview dialogs' Y pos., width, max. rows
-- ui, general⠀⠀⠀⠀/ reduces visibility of addon-internal datablocks (ui selectables)
-- PAS exp. log⠀⠀ / corrects material names in the scratch PSG lines
 
Hello, I've installed the latest version of the plugin, and am deciding to experiment a little bit more, this time editing the default cup bodies. But the exporter plugin is throwing out an error I've never seen before.

No Argument.png

Can any of you help me figure out why this is happening?

EDIT: DERP, I just realized I'm using the most recent version of blender, which isn't compatible with the plugin :ROFLMAO:

Using the right version would probably solve all my problems for a start. Ignore this post, I'm just having a brain fart!
 
Last edited:
Back
Top