2020-10-01 03:47 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0006418Spring engineGeneralpublic2020-08-30 04:44
ReporterMaDDoX 
Assigned To 
PriorityhighSeverityfeatureReproducibilityalways
StatusnewResolutionopen 
Product Version104.0 +git 
Target VersionFixed in Version 
Summary0006418: Ability to replace CEG's texture and shader in run-time
DescriptionWe need the ability to replace the CEG's texture and shader in run-time, so it's possible to do advanced spritesheet-based particle effects like this: https://opengameart.org/content/explosion

Right now you can only replace the texture before Spring is launched.

Steps To Reproduce1. Spawn a CEG
2. Try to replace its texture and/or shader along time
3. No API support for that
TagsNo tags attached.
Checked infolog.txt for ErrorsIrrelevant
Attached Files

-Relationships
+Relationships

-Notes

~0020517

IceXuick (reporter)

Yes, this could be game-changer for effects and also can result in less needed particles/cegs for same effect.

Though this will only work well if random rotation/positioning would be added as well. Like the CBitmapMuzzleFlame can be, only with the extra movement parameters of the CSimpleParticleSystem. Actually BOTH should get rotation params.

~0020519

MaDDoX (reporter)

@IceXuick Exactly, I've described that other need here to keep it separate: https://springrts.com/mantis/view.php?id=6419

~0020520

Google_Frog (reporter)

This ticket seems to be much more general than your application. It looks like you would be happy with a spritesheet animation ceg tag or type.

~0020522

MaDDoX (reporter)

@Google_Frog That would work, but would also be more work on the engine side I'd say. Having to set the amount of frames in the spritesheet, horizontally and vertically, plus padding if applicable - all of that is easy to do through lua and would make it way more flexible.

~0020523

Google_Frog (reporter)

As far as I know lua cannot see individual ceg particles. What you're suggesting seems like it would require a lot of extra lua callins and callouts to manage ceg particles, and managing an animation from frame-to-frame with lua sounds terrible for performance.

~0020524

MaDDoX (reporter)

@Google_Frog Doubtful, since it's a simple UV offset operation, which can be carried out through a shader. Ivand did something just like that for TAP's mex spot highlighter, and even with a large number of those quads there's no measurable performance loss (by disabling/re-enabling the widget).

~0020526

Google_Frog (reporter)

Specifying a shader to run on a ceg sounds reasonable. However, why does it need to be changeable at runtime? If you want to do anything with changing cegs at runtime then I expect you to need a lot of extra lua callins to manage this, because as far as I know lua has basically no interaction with cegs at the moment (besides being able to spawn them).

~0020528

MaDDoX (reporter)

@Google_Frog You're most probably right that a shader running on a CEG would fill in that gap, since like I mentioned the actual texture replacement we're using now is done through a shader.

What do you think @ivand?

~0020529

lhog (reporter)

Adding animated sprites is more complicated than just adding support for the shader:

CEG textures are tiled in a big atlas upon the engine initialization, so even with recently extended atlas size, it(atlas) is going to fill up very quickly by the animated subtextures, so at the very least atlas should be reworked into a texture array.

Secondly, only a very simple shader can run without setting some external shader defined state (called uniforms), that often change within or across draw frame. Making CEGs support shaders probably requires high performance framework to define and update such uniforms.

Finally and most importantly, we first need to get devs a blessing to include such functionality into the maintenance. Last time I tried much much smaller patch to soften particle edges, it was rejected.
+Notes

-Issue History
Date Modified Username Field Change
2020-08-20 22:19 MaDDoX New Issue
2020-08-20 22:34 IceXuick Note Added: 0020517
2020-08-21 00:24 MaDDoX Note Added: 0020519
2020-08-21 15:11 Google_Frog Note Added: 0020520
2020-08-21 23:03 MaDDoX Note Added: 0020522
2020-08-22 06:52 Google_Frog Note Added: 0020523
2020-08-25 09:24 MaDDoX Note Added: 0020524
2020-08-28 14:35 Google_Frog Note Added: 0020526
2020-08-30 03:12 MaDDoX Note Added: 0020528
2020-08-30 04:44 lhog Note Added: 0020529
+Issue History