Hey, I'm wondering what's the most FPS friendly way to handle a snowing effect for outdoor areas.
I would prefer one that has individual snowflakes rather than a 2D sprite animation of snow (which would probably be the best performance-wise).
Regarding the snowflakes, would they cause significant FPS drops if:
- Their sprites are scaled? (say you wanted some more detailed graphics and applied a 0.1 scale or something so they don't appear huge)
- They have transparent pixels in their graphic?
- They have different colors in their graphic? (the graphic is shaded)
Regarding generation:
- Would they having some spawn-if-in-line-of-sight code help?
- I assume the best way to generate them is via a spawner using SpawnItemEx, right?
Performance Friendly Snow?
Re: Performance Friendly Snow?
I think particles might be the best way.
Keep in mind that particles do, themselves, have a performance impact, but they have a smaller memory footprint than normal actors. They still have to be processed alongside actors during the rendering pass, but they seem to be, on the whole, more forgiving performance-wise.
Lud is a bit of a self-professed fanatic of particles - he is often available on Discord - I would definitely recommend asking him for help in a few days when he gets off vacation, or seeing any recent project that he's contributed to for examples on how to use particles.
Keep in mind that particles do, themselves, have a performance impact, but they have a smaller memory footprint than normal actors. They still have to be processed alongside actors during the rendering pass, but they seem to be, on the whole, more forgiving performance-wise.
Lud is a bit of a self-professed fanatic of particles - he is often available on Discord - I would definitely recommend asking him for help in a few days when he gets off vacation, or seeing any recent project that he's contributed to for examples on how to use particles.
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: Performance Friendly Snow?
I believe the main performance benefit with particles is they don't have a complex thinking loop like most actors do, even less than actors with +NOINTERACTION. Hence they're great for weather-type effects in my opinion. Much better than spawning hundreds of actors. One drawback is the lack of control over the movement once spawned.
More generally, there's two main approaches to weather effects: Player-localized and map-localized.
More generally, there's two main approaches to weather effects: Player-localized and map-localized.
- The first uses a spawner or script to create the effect in an area around the player with certain criteria (like if they're in a sector with a sky ceiling). This is useful because the effect can easily be adjusted in one place, map markers don't need to be moved around, and there's less "wasted" performance because the effect simply doesn't happen in places where the player isn't. The drawback is that the player might be able to "outrun" the effect in some cases, and also that the player might be able to see the boundaries where the effect stops unless you use a large radius, which can impact performance.
- The second uses pre-placed spawners in level areas where the weather effect is wanted. This is useful because the effect can be tweaked better for specific areas of the map instead of being generic, the effect can be visible at a greater distance from the player, and fewer "validity" checks are needed for spawning the effects. The drawback is lack of general flexibility, and extra time spent placing and tweaking the map markers. Often performance is a greater concern too, because either A) the effects spawn uselessly even when the player isn't visible / nearby, or B) expensive distance/line-of-sight calculations are needed to check if the player is in a good place to see the effect.
- leileilol
- Posts: 4449
- Joined: Sun May 30, 2004 10:16 am
- Preferred Pronouns: She/Her
- Location: GNU/Hell
Re: Performance Friendly Snow?
A renderer-side particle system that only knows box boundaries and distance culling is the only sure-fire way for fast individual snow particles. CPU-wise anyway
You shouldn't need to worry about the fillrate of individual snow particles anymore these days. Texture cache however can be a issue for some (having many different hi-res snowflakes on the particles may be a bad idea unless you have mips implemented on them and if you page them together on one sheet)
You could probably also do it the Starsiege Tribes way - an animated model that follows you when you're outside
You shouldn't need to worry about the fillrate of individual snow particles anymore these days. Texture cache however can be a issue for some (having many different hi-res snowflakes on the particles may be a bad idea unless you have mips implemented on them and if you page them together on one sheet)
You could probably also do it the Starsiege Tribes way - an animated model that follows you when you're outside
Re: Performance Friendly Snow?
I'll go ahead and see how it works with particles, thanks for the input.
- Kappes Buur
-
- Posts: 4120
- Joined: Thu Jul 17, 2003 12:19 am
- Graphics Processor: nVidia (Legacy GZDoom)
- Location: British Columbia, Canada
- Contact:
Re: Performance Friendly Snow?
Addendum:
Just one thing about both examples, the "snowflakes" start from the ceiling, and depending on how high
the ceiling is, they may take quite a while to appear and land on the floor.
Check out JonnyFive"s weather system: rain, snow
viewtopic.php?f=37&t=18993&p=369851
[imgur]https://i.imgur.com/bv4uDRG[/imgur]
Regarding the SnowSpawner from REALM667, which is also done with DECORATE, similar to above.
This seems to work quite nicely.
[imgur]https://i.imgur.com/i88RWhj[/imgur]
[imgur]https://i.imgur.com/0nJm8OC[/imgur]
Just one thing about both examples, the "snowflakes" start from the ceiling, and depending on how high
the ceiling is, they may take quite a while to appear and land on the floor.
Check out JonnyFive"s weather system: rain, snow
viewtopic.php?f=37&t=18993&p=369851
[imgur]https://i.imgur.com/bv4uDRG[/imgur]
Regarding the SnowSpawner from REALM667, which is also done with DECORATE, similar to above.
This seems to work quite nicely.
[imgur]https://i.imgur.com/i88RWhj[/imgur]
[imgur]https://i.imgur.com/0nJm8OC[/imgur]