View Issue Details

IDProjectCategoryView StatusLast Update
0005136The Dark ModGraphicspublic30.11.2020 12:10
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeveritymajorReproducibilitysometimes
Status resolvedResolutionfixed 
Target VersionTDM 2.09Fixed in VersionTDM 2.09 
Summary0005136: Wrong bounds of particle system
DescriptionThe code for computing bounds of particle systems is wrong.
This can lead to culling out the whole system randomly.
Steps To ReproduceStart test_raincollision dev FM and look at the section with curved rain patch.
If you look down, it will disappear
Additional InformationThere are two ways to use particle system in our engine:
1) particle model: set "model" with .prt extension on entity
2) particle-emitting surface: set "particle deform" on a material and put it on some surface
Some of the code is reused.

In the first case, bounds are computed for every particle stage but setting particle system to standard orientation and sampling 1000 random particles. Note that this is done once per every particle stage, so it does not take much time.
In the second case bounds depend on surface geometry. This is the stupid piece of code which is doing this now:
  tri->bounds.AddBounds(particleSystem->bounds);
Where particleSystem->bounds is the bounds of particle stage.

I think even code for particle model is not correct in presence of gravity and worldAxis.
For the code for surfaces is something which bears no relation to reality =)
Tagsparticle

Relationships

related to 0004957 resolvedstgatilov Snow and rain particles stopping on brushes 
related to 0005138 resolvedstgatilov Refactor particle systems code 

Activities

stgatilov

stgatilov

01.02.2020 05:13

administrator   ~0012162

In rev 8547, I committed a small fix.
It is intended to simplify rain testing, since it does not take gravity and worldAxis into account.
Enabled by r_tempFixBoundsOfParticleDeformedSurfs cvar.

The same idea with interval math can be extended to all cases, but for that to happen it is necessary to compute several different bounds for particle stage, not just one.
Most importantly, I mean: bounds with gravity, and bounds without gravity.
I hope to do this during particle code refactoring.
stgatilov

stgatilov

30.11.2020 12:09

administrator   ~0013055

Done in svn rev 9012, as a part of major particle refactoring (0005138).

The previous code was wrong by trying to precompute the bounds of the final particle locations, with all the world-space effects applied (like worldGravity and worldAxis).
As the result, such precomputed bounds were not usable with any other entity orientation, not to say they were not applicable to particle deforms.

Now only "standard bounds" are precomputed by particle sampling (saved in particle stage), which exclude gravity and worldAxis postprocessing (EstimateBoundsStdSys).
They are computed in "particle emission coordinate system", which should be multiplied by origin/axis from idParticleData and by entity axis to transform into world space.

From these standard bounds, some provably correct bounds can be computed for entity in any orientation pretty fast (GetStageBoundsModel).
Even bounds of particle deform systems is now computed correctly, by combining bounds on emit location/orientation (AnalyzeSurfaceEmitter) and standard bounds (GetStageBoundsDeform).

Issue History

Date Modified Username Field Change
01.02.2020 05:11 stgatilov New Issue
01.02.2020 05:11 stgatilov Status new => assigned
01.02.2020 05:11 stgatilov Assigned To => stgatilov
01.02.2020 05:11 stgatilov Tag Attached: particle
01.02.2020 05:11 stgatilov Relationship added related to 0004957
01.02.2020 05:13 stgatilov Note Added: 0012162
01.02.2020 05:36 stgatilov Relationship added related to 0005138
22.02.2020 13:47 stgatilov Target Version TDM 2.08 =>
21.03.2020 17:40 stgatilov Product Version TDM 2.07 => TDM 2.09
21.03.2020 17:41 stgatilov Product Version TDM 2.09 =>
21.03.2020 17:41 stgatilov Target Version => TDM 2.09
30.11.2020 12:09 stgatilov Note Added: 0013055
30.11.2020 12:10 stgatilov Status assigned => resolved
30.11.2020 12:10 stgatilov Resolution open => fixed
30.11.2020 12:10 stgatilov Fixed in Version => TDM 2.09