Helco / zzio

Zanzarah - WIP modding tools and engine remake
MIT License
14 stars 3 forks source link

Investigate bright borders around models #298

Closed Helco closed 9 months ago

Helco commented 9 months ago

image

Currently it seems that the original Zanzarah renders all models using alpha blend (SrcAlpha + InvSrcAlpha). This would cause obvious borders if not somehow mitigated as shown in the screenshot around the leave edges. ~These artifacts do not appear in the original Zanzarah.~

We should investigate why this bug does not happen in Zanzarah and implement an equal solution in zzio. Possibilities are:

Helco commented 9 months ago

These artifacts do appear in Zanzarah but not always, e.g.

We have to investigate further, probably RW does some rendering and we have to figure out what it is. A new posibility for sorting might be:

And it gets worse: Some ferns are FOModel with EarlySolid instead of normal Model which does not just change the sorting, it also seems to change from AlphaBlend to Opaque Cutout. Is this because Models are drawn as part of the RWWorld?

Helco commented 9 months ago

image

The answer is of course as semi-satisfying as one would expect:

With the corrections in 3485e1e I can close this issue at least until some clear buggy behavior in zzio is discovered. The original buggy situation with the tree tops is fixed.

As side-note: After fixing the actual bug there were black borders around the tree tops, not from blending inside the game but because the low-alpha values were written to the framebuffer to be blended with the ImGui Window. Using opaque color with additive alpha fixes this, but if we encounter similar issues this should be remembered.