Fix GX_NRM_NBT and GX_NRM_NBT3 vertex attribute handling#181
Conversation
|
Thanks a lot! I will test it. |
|
Even without implementing bump, you should still be able to add support for GX_TG_BINRM / GX_TG_TANGENT as texgen sources. I don't think this implements NBT3 indexing correctly either (you need to read three indices from the DL buffer). |
I'll take a look at adding texgen support and revisit the NBT3 indexing, thanks |
d1b89bb to
7282de0
Compare
|
@magcius @dbalatoni13 Sorry for the delay, addressed the NBT3 review feedback and added binormal/tangent texgen support. Would you have a chance to test? |
7282de0 to
e4688be
Compare
|
Looks correct to me graphically |
|
Hi @encounter does this PR look good to you? |
|
It does, thanks for the implementation! |
Fixes the crash path for #93. Aurora was crashing on GX_NRM_NBT / GX_NRM_NBT3 vertex attributes in a few places: comp_cnt_count only handled GX_NRM_XYZ, the VAT-A decoder ignored the bit-31 escape and collapsed NBT3 into NBT, and the shader generator tried to emit a nonexistent fetch_f32_9. All three are fixed here.
The follow-up commit addresses @magcius's review: NBT3 indexed mode now reads three separate indices per vertex from the DL buffer (one each for N, B, T) instead of treating it as a single-index NBT, and GX_TG_BINRM / GX_TG_TANGENT are supported as texgen sources, the binormal and tangent slices of GX_VA_NRM are loaded on-demand when a sampled texgen consumes them. The latest commit implements emboss bump mapping (GX_TG_BUMP0–7), offsetting the source texcoord by the light direction projected onto the binormal and tangent.
All 180 existing tests still pass, though I don't have an NBT test ROM to visually verify the output.