Page MenuHome

UV Map "From Dupli" does not work on emitter mesh with UV-altering modifiers.
Open, Confirmed, MediumPublic


System Information
Operating system: Linux Mint 18.3 Cinnamon 64-bit
Cinnamon version: 3.6.7
Linux Kernel: 4.13.0-39-generic
Processor: Intel Core i5-4430 CPU @ 3.00GHz (4 cores)
Memory: 23.2GiB
Graphics card: NVIDIA GTX 1070 + NVIDIA GTX 760

Blender Version

  • 2.79b (official),
  • 2.79.6 (build hash: ec20d311da4),
  • 2.79.6 (build hash: 5c10c92b23c),
  • 2.80 Alpha 2 (build hash: f520f01),
  • possibly more

Short description of error
In Blender Cycles, when using particle objects, each particle can be given a specific color using a texture "From Dupli". However, this functionality breaks when enabling the option "Use Modifier Stack" in the particle system settings and there are modifiers in the stack above the particle system that alter geometry. An example of such modifiers are the mirror modifier, the subdivision surface modifier or the array modifier (possibly others as well).

Normally, each particle obtains the proper UV-coordinates using the UV Map node with "From Dupli" enabled. However, with the above options enabled, the UV Map node with "From Dupli" enabled returns a 0-vector, as if there is no UV Map at all. This happens in the viewport as well as the final render.

Unfortunately, having "Use Modifier Stack" enabled while also using the UV Map From Dupli is essential for many particle system effects without a simple workaround.

Note for 2.8: here, the same bug occurs in the final render. However, for the viewport, it seems that even the particle system with "Use Modifier Stack" disabled doesn't receive the proper UV Map From Dupli. In the final render, the particle system with "Use Modifier Stack" disabled renders properly.

Note for 2.7: when returning from the final render back to the viewport render, the particle system with "Use Modifier Stack" disabled suddenly also stops displaying properly. However, unlike in 2.8, this can easily be resolved by switching to e.g. the flat renderer and then back to the Cycles viewport renderer to reinitialize it.

Exact steps for others to reproduce the error

See attached .blend file for the finished result. After opening the file, switch to the viewport Cycles renderer to see that the left cube (with "Use Modifier Stack" disabled) renders the UV as colors, whereas the right particle system (with "Use Modifier Stack" enabled) renders as black cubes. Both have the UV-vector as color input. As you can also see, the "Use Modifier Stack" option is required to have the particles distributed properly...

Steps to reproduce:

  1. Load the default .blend file. Switch to Cycles.
  2. Duplicate the default cube, this duplicated cube will be the particle mesh. The existing cube will be the emitter.
  3. UV-unwrap the emitter cube.
  4. Create a particle system on the emitter cube. Set the emitter type to "hair" (for convenience only) and under the particle system's "Render" settings, change the render type to "Object".
  5. Set the particle system's "Dupli Object" to the particle cube (Cube.001). Now, the particles should show up.
  6. Create a new material for the particle cube (Cube.001). Use an emission node for its surface output.
  7. Add a "UV Map" node, enable "From Dupli". Use the UV-output as color-input for the emission node. Using the Cycles viewport renderer, you should see the particles display in a nice green-to-red gradient over the emitter cube. So far, this is correct behavior.
  8. Now, add a modifier to the emitter cube that alters its geometry (e.g. the array modifier for clarity). Make sure it is positioned before (above) the particle system. Now, the particle system should still show up the proper colors. However, the particles aren't properly distributed over the emitter. To fix this:
  9. Enable "Use Modifier Stack" in the particle settings. Now, the particles should be properly distributed, but they no longer show up the proper colors. Instead, they render as black cubes, indicating that the UV Map From Dupli no longer exists.

Another note: rendering on CPU or GPU does not seem to matter.



Event Timeline

Philipp Oeser (lichtwerk) triaged this task as Confirmed, Medium priority.

Can confirm.

Not sure this is a bug, but here are my findings:

Since rBa30dc7c74eb2f02b928bea9f74209b301c9ceee6 all particles pa->num_dmcache is set to DMCACHE_ISCHILD here (which can be a bit misleading since they are not actually child particles, but seems like that was the best way to go...)

This leads to UVs not being calculated here.

From quick check it seems like a particles pa->num could actually be used here (which renders file from report fine -- havent checked further consequences though)

3diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
4index 360dcd7b26a..d41fe1cd958 100644
5--- a/source/blender/blenkernel/intern/particle.c
6+++ b/source/blender/blenkernel/intern/particle.c
7@@ -4122,6 +4122,11 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part,
9 }
11+ bool use_modifier_stack = psys->part->use_modifier_stack;
12+ if (use_modifier_stack && (num == DMCACHE_ISCHILD)) {
13+ num = pa->num;
14+ }
17 mface = CustomData_get(&psmd->mesh_final->fdata, num, CD_MFACE);
18 mtface += num;

regarding 2.8 and viewport rendering: UVs are only calculated if we are in DAG_EVAL_RENDER mode (see here), but we are in DAG_EVAL_VIEWPORT (even if set to cycles viewport rendering)

@Brecht Van Lommel (brecht): mind having a look?

Ha, that is right, I tried that, added a sub-surf modifier before the particles as well as a wave modifier and if the "Use Modifier Stack" check box is on, it messes up the colors, but not when its not on like mentioned the particles don't look right (rotation wise) but the colors are right with it off. Also tested in 2.8 and same, it still doesn't work with or without the "Use Modifier Stack" check on...

So its definitely the same issue, I apologize, I didn't think it was related, but now I see it was related...

Any news on this one? I am sort of hoping this will work soon, everything else seem to work fine for me at the moment.