View Issue Details

IDProjectCategoryView StatusLast Update
0004957The Dark ModFeature proposalpublic12.01.2019 20:52
ReporterstgatilovAssigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product VersionTDM 2.07 
Target VersionTDM 2.08Fixed in Version 
Summary0004957: Snow and rain particles stopping on brushes
DescriptionOriginal post by Goldwell:
  http://forums.thedarkmod.com/topic/19793-208-major-changes/#entry432359

Currently rain and snow particles fail through everything on their way. It is possible to make them stop/hit at desired place, but it is tedious.

This issue is to investigate the possibility of better rain/snow system which would automatically stop its particles on hitting brushes (and maybe even models).
TagsNo tags attached.

Activities

stgatilov

stgatilov

12.01.2019 09:42

developer   ~0011325

I have no idea yet how particle system works in the code.
But I'm pretty sure that all particles are modeled completely on CPU. Then it should be straightforward to add collision detection under some new spawnarg.

One issue to keep in mind is performance.
Collision detection is not free, and doing it for every particle every frame may be costly (and may be not --- to be found). That's why there are ideas like 1) using only brushes for collision, and 2) computing hit location once or once per 10 frames.
STiFU

STiFU

12.01.2019 14:52

developer   ~0011327

Theoretically, it should be possible to calculate particle lifetimes offline such that no collisions with brushes occur. I imagine something like a lookup table that maps particle spawn position to particle lifetime, which could be calculated during dmap.
stgatilov

stgatilov

12.01.2019 15:25

developer   ~0011328

Yes, this is third optimization (even more serious one): precompute particle path depending on point in emitter area.
One graphical way to do that is to render all solid objects from above into one bitmap with depth info, then depth at each pixels says how long the particle will go.

Note that the generic solution with always checking collision produces less artefacts. It always works good, even in presence of moving objects. Every optimization applied adds artefacts in some case: rain goes through crates if only brushes are taken into account, or rain going through AI when they are moving, etc.
That's why I suggest starting with slow but correct solution, profile, and then apply optimization in order of increasing severity.
STiFU

STiFU

12.01.2019 16:26

developer   ~0011331

Right, good idea. There is also the option to do an offline-online hybrid, use offline data only for distant particles and accurate online calculations for close ones.
VanishedOne

VanishedOne

12.01.2019 20:52

developer   ~0011339

From what I remember of SteveL's posts on particles, 'smoke' particles in the 'world particle system' have their positions stored so that e.g. smoke trails don't follow their emitters around, but particles spawned by func_emitters don't have individual state (though the emitter does get a bounds check on map load).

http://forums.thedarkmod.com/topic/17034-trailing-particles/
http://forums.thedarkmod.com/topic/16710-particle-request-candle-smoke/page-5#entry360281

I'm not sure where particles emitted from patches come into this (http://wiki.thedarkmod.com/index.php?title=World_Particle_System indicates they're another subsystem again), though visportalling has a known effect: http://forums.thedarkmod.com/topic/11314-keeping-your-house-dry/

Issue History

Date Modified Username Field Change
12.01.2019 09:39 stgatilov New Issue
12.01.2019 09:42 stgatilov Note Added: 0011325
12.01.2019 14:52 STiFU Note Added: 0011327
12.01.2019 15:25 stgatilov Note Added: 0011328
12.01.2019 16:26 STiFU Note Added: 0011331
12.01.2019 20:52 VanishedOne Note Added: 0011339