X-Hax / SonicAdventureBlenderIO

An addon for Blender 4.0+, which adds exporting options for all sonic adventure 3D formats (and a bit more)!
GNU General Public License v3.0
17 stars 1 forks source link

Chunk - Add Modifier Volume Import/Export #15

Open shaddatic opened 1 week ago

shaddatic commented 1 week ago

Sonic Adventure 2 on the Dreamcast, and now the PC version with the 'SA2 Render Fix' mod, uses Chunk Modifier Volume models to draw its shadows; specifically the CO_P3 Chunk Volume variant.

There is currently no direct way to edit or create these model types. With Render Fix now supporting easy file replacement for them, this is a great time to add Modifier Volume functionality into the Blender addon. Especially as Dreamcast Event editing in the addon gets better, as modifier shadows play a huge role in them.

It should be noted that Modifier Volumes are a destinct model type from other Chunk models, and are treated as different by Ninja. Using the regular njCnkDraw_ on these models will simply do nothing. Instead, they can only be drawn by a completely seperate njCnkModDraw_, which in turn does nothing with regular Chunk models. While technically possible to include Modifier Volumes in object trees with other regular models, in-game the modifiers just won't draw, or vice-versa. There are also no plans to add such mixing and matching of model types into Render Fix.

Below is an example mod that file replaces Sonic's head modifier volume model and King Boom Boo's modifier volume object tree from Render Fix. Further examples, if needed, can be copied from Render Fix's /gd_PC/RFMDL/ path.

modifier-volume-example.zip

Triangle winding/normal direction is very important with Modifier Volumes to draw correctly, especially when overlapping with other modifier volumes that use the opposite winding. An example of bad winding and overlap can be seen here:

image

The larger shadow is inverted, causing Sonic's shadow to be "undone". I recommend you use the Ultra Performance Modifier Shadow option in Render Fix while testing so errors like this are clearly visible. All models in the example mod are correctly winded.

Justin113D commented 1 week ago

This is gonna require a separate exporting pipeline and will thus not be done anytime soon