Particle system baking messes particle dietime (that in turn messes up particle textures) #107447

Open
opened 2023-04-28 18:23:05 +02:00 by E-13 · 9 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.15

Blender Version
Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: 1be25cfff18b
Worked: (newest version of Blender that worked as expected)

Short description of error
If texture with color ramp is used for animating particle size through lifetime, in ~10 last frames of simulation all particles PERMANENTLY getting smaller until totally disappear lol, and it occurs only if using BAKE.
this is not animation, this is 100% bug, looks like particle size animation is applied to WHOLE particle system respectively/relatively to all scene timeline, and is overriding every single particle age at the end of timeline.

Exact steps for others to reproduce the error
File uploaded.
Particle systems in blender are SOOOO broken, the way how it works is so facepalmable, particularly "bake" and "textures".
looks like in my case they met lol

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.15 **Blender Version** Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: `1be25cfff18b` Worked: (newest version of Blender that worked as expected) **Short description of error** If texture with color ramp is used for animating particle size through lifetime, in ~10 last frames of simulation all particles PERMANENTLY getting smaller until totally disappear lol, and it occurs only if using BAKE. this is not animation, this is 100% bug, looks like particle size animation is applied to WHOLE particle system respectively/relatively to all scene timeline, and is overriding every single particle age at the end of timeline. **Exact steps for others to reproduce the error** File uploaded. Particle systems in blender are SOOOO broken, the way how it works is so facepalmable, particularly "bake" and "textures". looks like in my case they met lol
E-13 added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-04-28 18:23:06 +02:00
Iliya Katushenock added the
Interest
Nodes & Physics
label 2023-04-28 18:28:28 +02:00

What are the steps to make incorrect bake? I have re-baked particles and could not reproduce the issue.

What are the steps to make incorrect bake? I have re-baked particles and could not reproduce the issue.
Richard Antalik added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-04-29 06:02:55 +02:00
Author

What are the steps to make incorrect bake? I have re-baked particles and could not reproduce the issue.

select particle system in scene ("particles.120" e.g.), go to "textures" and switch ON "SIZE" influence

now in the end of scene it looks like this —

> What are the steps to make incorrect bake? I have re-baked particles and could not reproduce the issue. select particle system in scene ("particles.120" e.g.), go to "textures" and switch ON "SIZE" influence now in the end of scene it looks like this —
Author

blender particle system is SO FUCKING BROKEN
this is one particle system, no constrains, baked
left is viewport, right is render window
wtf is this lmao? facepalm

blender particle system is SO FUCKING BROKEN this is one particle system, no constrains, baked left is viewport, right is render window wtf is this lmao? facepalm
219 KiB

@E-13 Please be calm and give an example file to reproduce issues

@E-13 Please be calm and give an example file to reproduce issues

What are the steps to make incorrect bake? I have re-baked particles and could not reproduce the issue.

select particle system in scene ("particles.120" e.g.), go to "textures" and switch ON "SIZE" influence

now in the end of scene it looks like this —

In provided file texture had already size influence enabled. So I can't reproduce that. Are you sure this is what is causing baking to be incorrect?

> > What are the steps to make incorrect bake? I have re-baked particles and could not reproduce the issue. > > select particle system in scene ("particles.120" e.g.), go to "textures" and switch ON "SIZE" influence > > now in the end of scene it looks like this — In provided file texture had already size influence enabled. So I can't reproduce that. Are you sure this is what is causing baking to be incorrect?
Author

In provided file texture had already size influence enabled. So I can't reproduce that. Are you sure this is what is causing baking to be incorrect?

switch size influence OFF
delete particle physics bake
create bake again
delete bake
switch size influence ON
create bake
(repeat all this steps several times maybe, just to create NEW bake)

now it should be broken

i am pretty sure that bake+textures influence produces broken bake, i tryed enough times all of this

> In provided file texture had already size influence enabled. So I can't reproduce that. Are you sure this is what is causing baking to be incorrect? switch size influence OFF delete particle physics bake create bake again delete bake switch size influence ON create bake (repeat all this steps several times maybe, just to create NEW bake) now it should be broken i am pretty sure that bake+textures influence produces broken bake, i tryed enough times all of this

Still can't reproduce unfortunately.

Still can't reproduce unfortunately.
Richard Antalik added
Status
Needs Triage
and removed
Status
Needs Information from User
labels 2023-05-23 06:08:18 +02:00
Member

I can confirm the thing and looked a bit at it abit (but wont continue doing so because after all the particle system is EOL, glad we have geometry nodes with simulation to move forward... -- and yes @E-13 , old particles can be broken at various places)

So just for reference here are some findings:

  • a particle has a dietime (the frame on which it will die)
  • determining the coordinate on the particle texture relies on the particles birthtime and dietime and current frame
  • now to the part where my findings get fuzzy (but will still continue)
    -- when we bake, particles that are outside their lifetime are skipped (see ptcache_particle_write)
    -- reading back the bake (see ptcache_particle_read) stored times are not read for some reason (not sure why that is, but
    -- resetting particles (see reset_particle), it happens for many particles (at least in this example), that psys_get_dietime_from_cache will set the dietime to our scenes endframe -- but really, that particles dietime should be later... that will then result in the texture coordinate being much more to the right, reducing the size where it shouldnt.

If anyone wants to check further, here is what I have been looking at:

diff --git a/source/blender/blenkernel/intern/particle.cc b/source/blender/blenkernel/intern/particle.cc
index 4fddd8241a6..510c10712c2 100644
--- a/source/blender/blenkernel/intern/particle.cc
+++ b/source/blender/blenkernel/intern/particle.cc
@@ -4478,6 +4478,7 @@ void psys_get_texture(
         case TEXCO_PARTICLE:
           /* texture coordinates in range [-1, 1] */
           texvec[0] = 2.0f * (cfra - pa->time) / (pa->dietime - pa->time) - 1.0f;
+          printf("cfra %f pa->time %f pa->dietime %f texvec[0] %f\n", cfra, pa->time, pa->dietime, texvec[0]);
           if (sim->psys->totpart > 0) {
             texvec[1] = 2.0f * float(pa - sim->psys->particles) / float(sim->psys->totpart) - 1.0f;
           }
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 7060983c281..e4d134ef20e 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -1114,6 +1114,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
       (sim->psys->pointcache->mem_cache.first))
   {
     float dietime = psys_get_dietime_from_cache(sim->psys->pointcache, p);
+    printf("reset_particle : got psys_get_dietime_from_cache %f (would have been %f instead)\n", dietime, pa->dietime);
     pa->dietime = MIN2(pa->dietime, dietime);
   }
 
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index de3c7256bdb..890adbb36ae 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -286,6 +286,7 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra
       const int pa_sfra = (int)pa->time - step;
       const int pa_efra = ((int)pa->dietime - 1) + step;
       if (!(cfra >= pa_sfra && cfra <= pa_efra)) {
+        printf("ptcache_particle_write skip %f\n", pa->dietime);
         return 0;
       }
     }
@@ -295,6 +296,8 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra
   times[1] = pa->dietime;
   times[2] = pa->lifetime;
 
+  printf("ptcache_particle_write write %f\n", pa->dietime);
+
   PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index);
   PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co);
   PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, pa->state.vel);
@@ -356,6 +359,7 @@ static void ptcache_particle_read(
     pa->time = times[0];
     pa->dietime = times[1];
     pa->lifetime = times[2];
+    printf("ptcache_particle_read: pa->dietime %f\n", pa->dietime); // this never happens
   }
 
   if (boid) {
I can confirm the thing and looked a bit at it abit (but wont continue doing so because after all the particle system is EOL, glad we have geometry nodes with simulation to move forward... -- and yes @E-13 , old particles can be broken at various places) So just for reference here are some findings: - a particle has a dietime (the frame on which it will die) - determining the coordinate on the particle texture relies on the particles birthtime and dietime and current frame - now to the part where my findings get fuzzy (but will still continue) -- when we bake, particles that are outside their lifetime are skipped (see `ptcache_particle_write`) -- reading back the bake (see ptcache_particle_read) stored times are not read for some reason (not sure why that is, but -- resetting particles (see `reset_particle`), it happens for many particles (at least in this example), that `psys_get_dietime_from_cache` will set the dietime to our scenes endframe -- but really, that particles dietime should be later... that will then result in the texture coordinate being much more to the right, reducing the size where it shouldnt. If anyone wants to check further, here is what I have been looking at: ```Diff diff --git a/source/blender/blenkernel/intern/particle.cc b/source/blender/blenkernel/intern/particle.cc index 4fddd8241a6..510c10712c2 100644 --- a/source/blender/blenkernel/intern/particle.cc +++ b/source/blender/blenkernel/intern/particle.cc @@ -4478,6 +4478,7 @@ void psys_get_texture( case TEXCO_PARTICLE: /* texture coordinates in range [-1, 1] */ texvec[0] = 2.0f * (cfra - pa->time) / (pa->dietime - pa->time) - 1.0f; + printf("cfra %f pa->time %f pa->dietime %f texvec[0] %f\n", cfra, pa->time, pa->dietime, texvec[0]); if (sim->psys->totpart > 0) { texvec[1] = 2.0f * float(pa - sim->psys->particles) / float(sim->psys->totpart) - 1.0f; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 7060983c281..e4d134ef20e 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1114,6 +1114,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, (sim->psys->pointcache->mem_cache.first)) { float dietime = psys_get_dietime_from_cache(sim->psys->pointcache, p); + printf("reset_particle : got psys_get_dietime_from_cache %f (would have been %f instead)\n", dietime, pa->dietime); pa->dietime = MIN2(pa->dietime, dietime); } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index de3c7256bdb..890adbb36ae 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -286,6 +286,7 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra const int pa_sfra = (int)pa->time - step; const int pa_efra = ((int)pa->dietime - 1) + step; if (!(cfra >= pa_sfra && cfra <= pa_efra)) { + printf("ptcache_particle_write skip %f\n", pa->dietime); return 0; } } @@ -295,6 +296,8 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra times[1] = pa->dietime; times[2] = pa->lifetime; + printf("ptcache_particle_write write %f\n", pa->dietime); + PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index); PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co); PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, pa->state.vel); @@ -356,6 +359,7 @@ static void ptcache_particle_read( pa->time = times[0]; pa->dietime = times[1]; pa->lifetime = times[2]; + printf("ptcache_particle_read: pa->dietime %f\n", pa->dietime); // this never happens } if (boid) { ```
Member

Marking as Known Issue, since the old particle system will likely not see fixes from core developers (community patches are still welcome of course).

Reminder to check out geometry nodes, what this file wants to achieve should already be possible there with much more flexibility

Marking as Known Issue, since the old particle system will likely not see fixes from core developers (community patches are still welcome of course). Reminder to check out geometry nodes, what this file wants to achieve should already be possible there with much more flexibility
Philipp Oeser changed title from particle system texture+bake issue to Particle system baking messes particle dietime (that in turn messes up particle textures) 2023-05-26 17:17:04 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107447
No description provided.