View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005138 | The Dark Mod | Coding | public | 01.02.2020 05:35 | 01.02.2021 16:41 |
Reporter | stgatilov | Assigned To | stgatilov | ||
Priority | normal | Severity | normal | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Target Version | TDM 2.09 | Fixed in Version | TDM 2.09 | ||
Summary | 0005138: Refactor particle systems code | ||||
Description | Currently particle systems code is split across files: ParticleDecl.cpp --- some common code tr_deform.cpp --- emitting surfaces only Model_prt.cpp --- particle models only ParticleCollisionStatic.cpp --- offline tool for computing collisions (new) Now the problem is: I have to duplicate some code in ParticleCollisionStatic.cpp. To support "mapLayout linear" I will have to duplicate much more unless some refactoring happens. The idea is to factor all the common code into a new file. ParticleDecl.cpp will be only for reading/parsing decl files, all the particle-modelling code will be called from the new file. The code for emitting particles from tr_deform.cpp and Model_prt.cpp will be moved to new file too. That's the main thing: allow to reuse emitting logic of both cases. Things to keep in mind during refactoring: 1) Split particle origin computation into several pieces, in order to fix bounds computation (0005136). 2) Use structs and functions instead of classes and methods. This way it would be possible to compile the same code with GLSL in future. | ||||
Tags | particle | ||||
related to | 0004957 | resolved | stgatilov | Snow and rain particles stopping on brushes |
related to | 0003161 | resolved | SteveL | Dousing a fireplace causes smoke to bounce |
related to | 0004132 | resolved | SteveL | Weather particle distribution should be more random |
related to | 0005136 | resolved | stgatilov | Wrong bounds of particle system |
related to | 0005437 | resolved | stgatilov | Particles: static collision with "linear" mapLayout |
related to | 0002642 | assigned | stgatilov | Add multiple particles to func_emitter |
I added 0002642 to this issue as it relates to the particle system design. That said, I also did this to highlight the fact that the "SEED system" is basically like a large scale particle emitter and would benefit from the same things that a particle system would ( geometry instancing, transform feedback, etc). There is probably a decent amount of code duplication between SEED and the particle system and the render backend with the whole "ModelGenerator.cpp code in the Game section of the project. |
|
Forum post: https://forums.thedarkmod.com/index.php?/topic/20656-particle-systems-refactoring-and-running-on-gpu/ |
|
Well, the refactoring is finished. It started with preliminary commits 9008-9010, followed by main changes in 9011-9018. Now almost everything is moved to ParticleSystem.[h/cpp]. Note that ParticleSystem_[def/decl].h are considered to be parts of these files. These parts has some basic GLSL compatibility, making it possible to run this code on GPU (not sure if it is worth it though). The code in C-style, passing structs with raw around. All the functions are named idParticle_XxxYyyZzz and never access any global state: all inputs and outputs are explicitly marked. As the result of refactoring, the duplicate code is deduplicated =) Also, some parts of the computation are split into subparts for better resuse. Here are some notable changes: 1) Random seed for each particle is now computed by hash function of its index and other quantitites, instead of "stepping random" paradigm (see 0003161). 2) Randomizer for particle deform system is now computed from model name/surface index instead of its coordinates (see 0004132). 3) Bounding boxes are fixed (see 0005136). 4) Added check for image size mismatch. |
|
Apparently, I broke animated particles in svn rev 9011 with a stupid typo. As a result, they all became triangular =) Fixed this problem in svn rev 9100. See also: https://forums.thedarkmod.com/index.php?/topic/20691-beta-testing-209/&do=findComment&comment=456080 |
|
Date Modified | Username | Field | Change |
---|---|---|---|
01.02.2020 05:35 | stgatilov | New Issue | |
01.02.2020 05:35 | stgatilov | Status | new => assigned |
01.02.2020 05:35 | stgatilov | Assigned To | => stgatilov |
01.02.2020 05:35 | stgatilov | Tag Attached: particle | |
01.02.2020 05:36 | stgatilov | Relationship added | related to 0004957 |
01.02.2020 05:36 | stgatilov | Relationship added | related to 0005136 |
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:42 | stgatilov | Product Version | TDM 2.09 => |
21.03.2020 17:42 | stgatilov | Target Version | => TDM 2.09 |
15.11.2020 17:38 | stgatilov | Relationship added | related to 0003161 |
22.11.2020 10:52 | stgatilov | Relationship added | related to 0004132 |
22.11.2020 12:49 | nbohr1more | Relationship added | parent of 0002642 |
22.11.2020 17:06 | nbohr1more | Note Added: 0013011 | |
30.11.2020 10:07 | stgatilov | Relationship added | related to 0005437 |
30.11.2020 10:47 | stgatilov | Note Added: 0013053 | |
30.11.2020 12:18 | stgatilov | Note Added: 0013056 | |
30.11.2020 12:34 | stgatilov | Relationship deleted | parent of 0002642 |
30.11.2020 12:34 | stgatilov | Relationship added | related to 0002642 |
30.11.2020 12:34 | stgatilov | Status | assigned => resolved |
30.11.2020 12:34 | stgatilov | Resolution | open => fixed |
30.11.2020 12:34 | stgatilov | Fixed in Version | => TDM 2.09 |
01.02.2021 16:41 | stgatilov | Note Added: 0013603 | |
01.02.2021 16:41 | stgatilov | Note Edited: 0013603 |