AntonioND / nitro-engine

3D engine for the Nintendo DS
150 stars 10 forks source link

Outlining affecting sprites #1

Closed goaaats closed 1 year ago

goaaats commented 4 years ago

Hello,

I am using the NE_OutliningEnable function to draw outlines for my models in dual screen 3D mode - however, I am also drawing sprites on top of these models, which are affected by the outlines.

Is it possible to turn off outlining for sprites?

I have tried this code, but sadly that didn't work out.

    NE_OutliningEnable(true);

    NE_CameraUse(TSCamera);
    NE_PolyFormat(31, 0, NE_LIGHT_0, NE_CULL_NONE, 0);
    NE_ModelDraw(GetModel(MODEL_MainChara));

    NE_OutliningEnable(false);

    NE_2DViewInit();
    NE_SpriteDrawAll();

Thank you!

AntonioND commented 2 years ago

Sorry for the long delay in replying, I had disabled all notifications from this repository by mistake!

I think you can only enable outline in a per-frame basis, but you can be clever with your polygon IDs. If I remember correctly, polygons with the same ID won't show outline when they overlap in the 2D projection. Basically, if you have a couple of models with polygon ID 1 and 2, and everything else is using ID 0, you should only see the outlines of 1 and 2.

Also, check https://www.akkit.org/info/gbatek.htm#ds3ddisplaycontrol

4000060h - DISP3DCNT - 3D Display Control Register (R/W) 5 Edge-marking (0=Disable, 1=Enable) (see EDGE_COLOR)

This can be used to disable the outline from appearing on the edges of the screen when a polygon isn't fully in the screen.