-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Konami (GX) blending - additive sprite blending, improved tile blending #13473
base: master
Are you sure you want to change the base?
Conversation
-use rectangle for dst size -turn do-while loops into for loops -combine zoom and no-zoom loops -don't use negative offset and stride for source indexing
-return blending mode and priority along with the alpha level -minor style changes to overall file
mask out mix mode and priority bits until they are handled properly
k054338.cpp: fix mixlv type konamigx_v.cpp: pass on alpha mode and prio bits for sprite blending
-move variable declaration closer to use -use more appropriate types, shrink GX_MAX_SPRITES -rename some "temp" variables
rename / retype more temp vars
…its() function, scanning tiles for mixing mode bits k053246_k053247_k055673.cpp: update comment regarding mix_pri konamigx_v.cpp, konamigx.h: update gx_draw_basic_tilemaps(), use get_mix_bits() mystwarr_v.cpp: remove mystwarr water hack
…ous get_mix_bits() solution
konamigx_v.cpp: add comments
fixes to gx_draw_basic_tilemaps
Please ping me at [email protected] with an email I can reach you at. |
@cuavas i hope you don't mind the ping. I'd like to attempt adding additive blending for tiles. I guess what I would like to know is where I should be doing this? |
Oh, yeah, you're right! It does get darker, but it doesn't seem to get dark enough? I'll have to look at it |
gx_draw_basic_tilemaps: remove GXMIX_BLEND_NONE hack (wasn't being used) update names simplify category 1 tile alpha check
I think I'm done adding new stuff to this PR now. I've opted to add a hack for additive alpha (invert alpha value) so it looks fine until it's properly handled. While the sexyparo castle windows are transparent now, the transparency seemingly turns off for a frame or two when picking up power ups. I need to check PCB footage to see if that's actually a thing or not, but most videos are high score videos so they don't go this route. |
I've just checked the latest build of this pull request and I noticed that the title screen background color change issue in Mystic Warriors (mystwarr) is now fixed. Meanwhile, it appears certain that some mystwarr-based games still have certain graphical issues like graphical garbage up top during the character roll call in Metamorphic Force (metamrph)'s opening, as well as the Konami copyright text not appearing on the title screen of that game (compared to FinalBurn Neo), aside from an earlier bug I previously mentioned of how the blending was rendered during the Athena and animals shot still being there. There's also a severe graphical regression in Martial Champion (mtlchamp). I'm not sure if the need to fix those is within the scope of this pull request, but are there any considerations regarding that? And as for the stage transition effects in Violent Storm (viostorm), which were slightly broken in 0.275, do those now render correctly so MT9131 can be marked fixed once this pull request is merged? |
Thanks for pointing that out! I completely overlooked that one. This should preferably be fixed before a potential merge. I will turn this PR back into draft status and see if I can fix it.
Yes, I'm at least planning to keep addressing various issues with GX (and related) games.
I think this is still broken. I was planning on tackling this, but managed to get tile blending working instead, heh. I will definitely revisit this issue (shadow priority problem?). |
tested the new build and still doesnt get as dark as it should, but still i cant be too upset considering almost everything else has been fixed |
Luckily, the mtlchamp regression was just due to my additive blending hack. I've updated it so the intro doesn't go black.
|
So, were those screenshots referring to certain stages in Mystic Warriors (mystwarr) and Monster Maulers (mmaulers) being too dark? I was more concerned about the graphics regression in Martial Champion (mtlchamp), which was eventually fixed as of the latest PR build. |
I have a feeling the background glitch might have something to do with the starting level cheat, I'll do a regular playthrough to be sure |
And with monster maulers you can notice those lines in his power up graphic thing |
Yeah, this is a problem with overlapping sprites I think. The same thing happens in the metamrph intro, I'll have to think of a solution another time. |
getting here normally does not cause this issue |
https://youtu.be/hBtjrd3qYdw also got some hd footage of the pcb for you |
Just posted a week ago oddly enough |
Also i noticed for a split second in the intro you can see for a split second the nametags on the screen before it transitions to the next screen so def seems to be a blending issue |
I feel like I'm starting to amass a lot of changes so I'm opening a PR now. That, and the current changes are starting to reach a stable state! ...I hope!
The TL;DR version, games I know to be affected in parentheses:
Additive sprite blending (mmaulers)
Improved tile blending (mystwarr, viostorm, metamrph, sexyparo)
10 months ago, master Galibert sent down His holy scriptures to a certain inquisitive peasant. Since then I've spent some time on and off trying to interpret His writings, and well, I can confidently say that some of it has definitely sunk in!
File by file commentary:
k053246_k053247_k055673.cpp, k053246_k053247_k055673.h:
I went back to update zdrawgfxzoom32GP(), now down to a third of its original size before I started changing it. As a thinly veiled excuse for reworking the whole function, I went ahead and added additive sprite blending (to the now singular alpha call site).
Remarks: the mix priority setting is not yet handled. It seems simple enough (flip dst and src), but I would like to find an example of this before I implement it.
k054156_k054157_k056832.cpp:
The
attr
variable holds what appear to be the elusive tile (external) mix codes. Attach it to theflags
variable so these bits can be accessed in the tile callback functions. Tiles with mix codes gets their own tilemap category.Remarks:
this is kind of a hacky way to getI've now changed the callback to include an attr param.attr
into the callbacks. This should at minimum be documented, or be changed.k054338.cpp:
Update set_alpha_level. This function now returns a level, an additive blend bool and a mixpri bool. Minor style changes to the overall file.
Remarks: set_alpha_level doesn't actually set anything. Maybe rename to get_alpha_level?
moo.cpp, xexex.cpp:
Mask out the new additive & mixpri bits from set_alpha_level calls for now, until it's known if / how they should be used over there.
mystwarr_v.cpp, mystwarr.h:
Remove mystwarr water hack.
Update mystwarr_tile_callback (and add viostorm_tile_callback) to read tile mix codes, store last read mix code in a new m_last_alpha_tile_mix_code variable.
Attach m_last_alpha_tile_mix_code to
mixerflags
, which happens to have two unused bits.Remarks:
I should document that the two last bits ofI updated the mixerflags documentation to mention the usage of the last two bits.mixerflags
is carrying a tile mix code now.konamigx_v.cpp, konamigx.cpp, konamigx.h:
Shrink GX_MAX_SPRITES, which to the best of my ability seems to be oversized. There does seem to be several oversized arrays / defs in these files, so I think this is one of them.
The usual FredYeye updates to konamigx_mixer - move declarations closer to use, more suited types, rename
temp
vars, etc.Change objpool to a vector, simplifying usage (push_back, size).
Replace sorting loop with reverse + stable_sort.
Improve gx_draw_basic_tilemaps - read internal / external alpha mix codes based on vinmix_on. Tiles with mixcodes get drawn in a separate pass for per-tile blending.
Update alpha_tile_callback and add salmndr2_tile_callback, same as the mystwarr_v callbacks.
Remarks:
There are still some things that should be done here - alpha_tile_callback needs to be cleaned up, for example.Mostly done here now.What started out as trying to sort out konamigx_mixer() to look at shadow/priority issues instead ended up with me finally getting a foot into the figurative tile blending door. The mystwarr water hack is gone, and sexyparo gets transparent windows. This might affect many GX and related games. Alpha blending might be broken in some games now, and needs to get their mix codes attached in their respective callbacks. salmndr2 got tagged in my automatic video comparison for differing from earlier versions, that's why I managed to fix it already.
Known problems:
metamrph: stained glass windows are near-transparent at the moment. I think additive tile blending will fix it...
viostorm: character names fade in in reverse. This also uses additive blending, so this might also get fixed once that's in.
fantjour: the top & bottom flames at the captain kebab ship go missing. Uses additive blending.
I'll mark this as a draft and go ahead and try to improve on some of the current things that are left. Thanks for coming to my ted talk.