-
Notifications
You must be signed in to change notification settings - Fork 13
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
Sorting is difficult / impossible to control for particles with transparency #43
Comments
Hi, thanks for the detailed explanation
We built on top of this two systems:
Other solutions to mitigate sorting issues:
We'll let you know our findings with slicing in the O3DE plugin |
Hi, After investigating this issue, this is what I found:
As you can see in the following image, without talking about PKFX not correctly sorting with O3DE transparent objects, we can see the smaller sphere in this image that is technically behind, is drawn on top: This is due to this effect using a "sort by custom value" with a key that is invalid: Reverting the effect to use About (2), PR #54 re-enables experimental slicing in the plugin, here are some initial results: There's definitely some flickering, and sorting result will differ depending on the camera angle. Once the PR is merged, it would be interesting to test this in the level, and see if slicing helps. The slicing algorithm can also be customized in the Gem so it's possible to try various approaches. One of the main problem is within the slicing code itself, it currently ignores game engine geometry:
If we were to consider slicing to be working properly with all O3DE transparent geometry, the merge pass would need to take into account both PKFX slices & O3DE transparent objects draw calls somehow (ideally, before the draw packets are built to reduce overhead of rejected/merged slices) Food for thought, let's see the results of #54 once merged (by default, slicing is disabled). |
Wow, that's some great progress! Slicing controls definitely seem like they'll go a long way towards giving the designers some ability to tune performance vs sorting correctness. One other possible idea for slice controls would be exposing some sort of "manual slice bins" on each emitter, where by default they would auto-group together into one or more auto-binned slices, but if there are a few problematic emitters on the outskirts of the level or something, they could be manually placed into their own slice. Definitely looking forward to seeing the results of this change! Are you also going to submit a change to the effect itself to correctly use CameraDistance, or is that something that someone else (me?) needs to do? |
You can find two PRs here: Once these are merged (and #54) we'll take a look at the result of slicing in the level |
Short version:
In the MultiplayerSample project, we've run into multiple particle sorting issues, and there doesn't seem to be a way to work around or fix it. This is a request to at a minimum provide a way to "unbatch" particle emitters for specific emitters to make it possible to fix sorting issues when problems arise.
Long version:
Atom sorts transparent draw calls first by sort key, and then by depth. By default, everything uses a sort key of 0. PopcornFX is also currently hard-coding a sort key of 0 in CPopcornFXFeatureProcessor::Render(). In the case of MultiplayerSample, we need depth sorting since the particles appear in a level that has translucent walls everywhere, so this is OK. It would also be nice if sort key controls were exposed instead of hard-coded, but that wouldn't help for this situation anyways.
The problems show up due to particle batching. The particle effects we're using have multiple layers to them, and each layer has different-sized particles. For simplicity, let's just say there are 2 layers, one with a 1 meter particle and one with a 5 meter particle. We also reuse the effects multiple times around the level, so the same effect can draw hundreds of meters apart. These two factors are affecting the sorting in negative ways:
Editor_AOtsrn9TFR.mp4
The text was updated successfully, but these errors were encountered: