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
22 stars 1 forks source link

Chunk/Ginja - Add `0.f` Model Radius Export #36

Open shaddatic opened 4 days ago

shaddatic commented 4 days ago

Chunk and Ginja have support for disabling model clipping for models with an r value of 0.f or below. This is intended behavior and is built into the source code; for example, Chunk:

if ( !(_nj_control_3d_flag_ & NJD_CONTROL_3D_MODEL_CLIP) || model->r <= 0.f || !njCnkModelClip(model) ) 
{
    // draw model
}

Adding support for this would allow greater control over the clipping behavior of individual models, both part of an object tree and on their own, without needing to enabling the NJD_CONTROL_3D_MODEL_CLIP flag in-code at runtime.

It's possible Basic has the same logic, but I haven't confirmed if this is the case.

MainMemory commented 4 days ago

In what circumstances is this useful? If the radius and center are set properly (which the tools do automatically), the model will be rendered whenever it is onscreen, right? Why would you need to render a model that isn't onscreen? Or is the game's algorithm broken?

shaddatic commented 4 days ago

It's used for skipping the ModelClip function, like for models that will always be on-screen no matter what, making the clip calculations pointless. The performance improvement was greater on DC, I admit, however it's still a built in feature of Ninja that should be considered for support in SAIO