beyond-all-reason / spring

A powerful free cross-platform RTS game engine
https://beyond-all-reason.github.io/spring/
Other
207 stars 98 forks source link

feature ground decal shouldn't stack/fade when the battle starts #1193

Closed springraaar closed 7 months ago

springraaar commented 8 months ago

Translucent feature ground decals look opaque when the battle starts (not when players they're still unready/choosing positions) then fade-to-normal alpha they're supposed to have.

The fading timings match the fade-to-nothing that happens when they're destroyed, which is controlled by https://springrts.com/wiki/Gamedev:UnitDefs#buildingGroundDecalDecaySpeed

Example map that has rocks with decals and can be used to reproduce the issue https://springfiles.springrts.com/?type=2&filter=28b6b1bc417ae5eb9e3ba3f99cda5a1b

lhog commented 8 months ago

The decals system is incredibly old and bad written. I've made an attempt to redo it https://github.com/beyond-all-reason/spring/pull/1034 but I'm not sure I want to proceed with this approach as it's inevitably of GL3/GL4 class of requirements. So most likely another take will be required.

As far as this particular bug it seems to be caused by the rocks falling to the ground from a small elevation (~1 elmo above the ground) it's at initially and a related logical error. I'm inclined to soft-reject fixing that with the current implementation as it's an investment into a dead code. Since it's pretty cosmetic I'll keep the issue floating around for a while until I can figure out the decals replacement.

lhog commented 7 months ago

I've revamped the implementation of https://github.com/beyond-all-reason/spring/pull/1034

It's GL3 class with optional and almost always useless option for higher quality (MSAA per sample shader processing), which enforces GL4 shaders. Almost every GPU should support instanced rendering by now. I will only care to backport this to GL2 in case big enough number of players (>5-10%) won't be able to see decals.

This PR is mergeable as far as the code. The only thing required is artist's input to create explosion scar textures. TLDR: I'm going to merge that PR ASAP. The days of current decals are counted. Therefore I'm closing this issue as it will become irrelevant soon.