UV Map "From Dupli" does not work on emitter mesh with UV-altering modifiers. #57922

Closed
opened 2018-11-18 23:09:58 +01:00 by Part Ago · 12 comments

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
Broken:

  • 2.79b (official),
  • 2.79.6 (build hash: ec20d311da),
  • 2.79.6 (build hash: 5c10c92b23),
  • 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
from_dupli_bug.blend

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:

  • Load the default .blend file. Switch to Cycles.
  • Duplicate the default cube, this duplicated cube will be the particle mesh. The existing cube will be the emitter.
  • UV-unwrap the emitter cube.
  • 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".
  • Set the particle system's "Dupli Object" to the particle cube (Cube.001). Now, the particles should show up.
  • Create a new material for the particle cube (Cube.001). Use an emission node for its surface output.
  • 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.
  • 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:

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.

**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** Broken: - 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** [from_dupli_bug.blend](https://archive.blender.org/developer/F5625304/from_dupli_bug.blend) 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: - Load the default .blend file. Switch to Cycles. - Duplicate the default cube, this duplicated cube will be the particle mesh. The existing cube will be the emitter. - UV-unwrap the emitter cube. - 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". - Set the particle system's "Dupli Object" to the particle cube (Cube.001). Now, the particles should show up. - Create a new material for the **particle cube** (Cube.001). Use an emission node for its surface output. - 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. - 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: # 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.
Author

Added subscriber: @Partago

Added subscriber: @Partago

#85218 was marked as duplicate of this issue

#85218 was marked as duplicate of this issue

#58515 was marked as duplicate of this issue

#58515 was marked as duplicate of this issue
Member

Added subscribers: @brecht, @lichtwerk

Added subscribers: @brecht, @lichtwerk
Brecht Van Lommel was assigned by Philipp Oeser 2018-11-20 12:22:43 +01:00
Member

Can confirm.

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

Since a30dc7c74e 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) P829: #57922 snippet



diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 360dcd7b26a..d41fe1cd958 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -4122,6 +4122,11 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part,
 			num = DMCACHE_NOTFOUND;
 		}
 
+		bool use_modifier_stack = psys->part->use_modifier_stack;
+		if (use_modifier_stack && (num == DMCACHE_ISCHILD)) {
+			num = pa->num;
+		}
+
 		if (mtface && !ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) {
 			mface = CustomData_get(&psmd->mesh_final->fdata, num, CD_MFACE);
 			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: mind having a look?

Can confirm. Not sure this is a bug, but here are my findings: Since a30dc7c74e all particles `pa->num_dmcache` is set to `DMCACHE_ISCHILD` [here ](https://developer.blender.org/diffusion/B/browse/blender2.8/source/blender/blenkernel/intern/particle_system.c;a29740e2904f12833a1c8d26926979a1cfb293da$406) (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 ](https://developer.blender.org/diffusion/B/browse/blender2.8/source/blender/blenkernel/intern/particle.c;a29740e2904f12833a1c8d26926979a1cfb293da$4125). 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) [P829: #57922 snippet](https://archive.blender.org/developer/P829.txt) ``` diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 360dcd7b26a..d41fe1cd958 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4122,6 +4122,11 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, num = DMCACHE_NOTFOUND; } + bool use_modifier_stack = psys->part->use_modifier_stack; + if (use_modifier_stack && (num == DMCACHE_ISCHILD)) { + num = pa->num; + } + if (mtface && !ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) { mface = CustomData_get(&psmd->mesh_final->fdata, num, CD_MFACE); mtface += num; ``` regarding 2.8 and viewport rendering: UVs are only calculated if we are in `DAG_EVAL_RENDER` mode (see [here ](https://developer.blender.org/diffusion/B/browse/blender2.8/source/blender/blenkernel/intern/object_dupli.c;a29740e2904f12833a1c8d26926979a1cfb293da$800)), but we are in `DAG_EVAL_VIEWPORT` (even if set to cycles viewport rendering) @brecht: mind having a look?
Member

Added subscriber: @JeannotLandry

Added subscriber: @JeannotLandry

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...

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.

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.
Brecht Van Lommel was unassigned by Dalai Felinto 2019-12-23 16:35:52 +01:00

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Sybren A. Stüvel self-assigned this 2020-02-11 11:27:46 +01:00

As the particle system is marked as "end of life", there won't be any updates to it. Newly introduced bugs (for example those introduced in the transition from 2.79 to 2.80) will be fixed, but that's the extent of development time spent on it. As such I'll mark it as a known limitation of the current particle system architecture.

As the particle system is [marked as "end of life"](https://wiki.blender.org/wiki/Modules#Nodes_.26_Physics), there won't be any updates to it. Newly introduced bugs (for example those introduced in the transition from 2.79 to 2.80) will be fixed, but that's the extent of development time spent on it. As such I'll mark it as a known limitation of the current particle system architecture.

Added subscribers: @Spaceboy64, @rjg

Added subscribers: @Spaceboy64, @rjg
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
6 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#57922
No description provided.