linked curves with curve modifiers arent drawn correctly #61184

Closed
opened 2019-02-04 19:35:13 +01:00 by Artem · 17 comments

System Information
Operating system: Win 10
Graphics card: GTX 1080TI

Blender Version
Broken:
4ef09cf937
Worked: 2.79b

Short description of error
Whenever you have data-linked curves and both of them have curve modifiers, only the original curve will deform if you move it in object mode. Check 2,79 for correct behavior (you can have linked curves but they will deform separately). Also, if you have a modifier on a curve, blender starts to draw the original and deformed curve at the same time (which is pretty confusing).

Exact steps for others to reproduce the error
Here's a simple .blend with the issue 1.blend

**System Information** Operating system: Win 10 Graphics card: GTX 1080TI **Blender Version** Broken: 4ef09cf937f2 Worked: 2.79b **Short description of error** Whenever you have data-linked curves and both of them have curve modifiers, only the original curve will deform if you move it in object mode. Check 2,79 for correct behavior (you can have linked curves but they will deform separately). Also, if you have a modifier on a curve, blender starts to draw the original and deformed curve at the same time (which is pretty confusing). **Exact steps for others to reproduce the error** Here's a simple .blend with the issue [1.blend](https://archive.blender.org/developer/F6507689/1.blend)
Author

Added subscriber: @Hickz

Added subscriber: @Hickz
Member

Added subscribers: @mont29, @lichtwerk

Added subscribers: @mont29, @lichtwerk
Bastien Montagne was assigned by Philipp Oeser 2019-02-05 09:34:42 +01:00
Member

Can confirm, @mont29: iirc you've been active with (curve) modifiers? [just reaasign if that is not for you...]

Can confirm, @mont29: iirc you've been active with (curve) modifiers? [just reaasign if that is not for you...]

Added subscriber: @Sergey

Added subscriber: @Sergey

Hrrmmm… this looks like different evaluated instances of curves sharing some data somehow (either at cache level, or something else?). Wouldn’t mind some @Sergey advice here first, in case he has some quick insight on the issue, before I dive again into curve eval process (which will take time…).

Hrrmmm… this looks like different evaluated instances of curves sharing some data somehow (either at cache level, or something else?). Wouldn’t mind some @Sergey advice here first, in case he has some quick insight on the issue, before I dive again into curve eval process (which will take time…).
Author

There's also a problem with curve drawing with modifiers. For example, create a curve and add a mirror modifier to it, it's not drawn in the viewport

There's also a problem with curve drawing with modifiers. For example, create a curve and add a mirror modifier to it, it's not drawn in the viewport
Bastien Montagne removed their assignment 2019-02-19 11:55:26 +01:00
Clément Foucault was assigned by Bastien Montagne 2019-02-19 11:55:26 +01:00

Added subscriber: @fclem

Added subscriber: @fclem

@fclem I think that is drawing code issue in fact, adding a printf at start of DRW_curve_batch_cache_create_requested(), I get things like:

DRW_curve_batch_cache_create_requested: CUBezierCircle (curve_cache: 0x6110004125c8), from OBBezierCircle
DRW_curve_batch_cache_create_requested: CUBezierCircle (curve_cache: 0x6110004125c8), from OBBezierCircle.001

…so looks like drawcache is shared by different objects if they use same curve obdata? At least, that function seems to take data from ob->runtime.curve_cache and use it to fill the VBOs of cu->batch_cache, if I follow it correctly.

@fclem I think that is drawing code issue in fact, adding a printf at start of `DRW_curve_batch_cache_create_requested()`, I get things like: ``` DRW_curve_batch_cache_create_requested: CUBezierCircle (curve_cache: 0x6110004125c8), from OBBezierCircle DRW_curve_batch_cache_create_requested: CUBezierCircle (curve_cache: 0x6110004125c8), from OBBezierCircle.001 ``` …so looks like drawcache is shared by different objects if they use same curve obdata? At least, that function seems to take data from `ob->runtime.curve_cache` and use it to fill the VBOs of `cu->batch_cache`, if I follow it correctly.

@mont29 You are right. And this is wrong.
It seems that the Object Data (Curve *)ob->data (Which is what holds the batch cache) is not duplicated as it should.

This is how Mesh are handled, (Mesh *)ob->data is NEVER shared if there is a modifier stack.

After talking with @Sergey it seems that storing the batch cache inside the object data is not a good idea. A better idea would be to store it inside the Object_Runtime struct and do some optimisation down the road to share the object runtime on similar object (i.e.: objects with the same ob->data and no modifiers).

But doing this requires some changes inside the depsgraph for tagging the object instead of the object data (notably the operation node GEOMETRY_SELECT_UPDATE). I'll propose a patch for this soon.

@mont29 You are right. And this is wrong. It seems that the Object Data (Curve *)ob->data (Which is what holds the batch cache) is not duplicated as it should. This is how Mesh are handled, (Mesh *)ob->data is NEVER shared if there is a modifier stack. After talking with @Sergey it seems that storing the batch cache inside the object data is not a good idea. A better idea would be to store it inside the Object_Runtime struct and do some optimisation down the road to share the object runtime on similar object (i.e.: objects with the same ob->data and no modifiers). But doing this requires some changes inside the depsgraph for tagging the object instead of the object data (notably the operation node GEOMETRY_SELECT_UPDATE). I'll propose a patch for this soon.

@Sergey After trying to go into this direction it seems really to be a can of worm situation. A lot of code it based on Eval Mesh* tagging / batch free/update.

I think the short term solution would be either:

  • Port code in Curve/Surf/Text to use Curve->runtime to produce final mesh and duplicate the Curve obdata so that modifiers are applied interdependently. The first part is even optional.
  • Create an exception for Curves and use (newly created) Object_Runtime->batch_cache, then port Mesh to use it in a second time. This is the most straight forward (and follow @Sergey suggestion) but it's causing me problem as it needs some refactor inside the Despgraph (namely build_object_data_geometry_datablock that takes an obdata ID* as input instead of a OB).

The implication of all this makes me wonder why / what was the original design supposed to be? Having multiple ways of dealing with modified geometry seems kind of bad from my point of view.

@Sergey After trying to go into this direction it seems really to be a can of worm situation. A lot of code it based on Eval Mesh* tagging / batch free/update. I think the short term solution would be either: - Port code in Curve/Surf/Text to use Curve->runtime to produce final mesh and duplicate the Curve obdata so that modifiers are applied interdependently. The first part is even optional. - Create an exception for Curves and use (newly created) Object_Runtime->batch_cache, then port Mesh to use it in a second time. This is the most straight forward (and follow @Sergey suggestion) but it's causing me problem as it needs some refactor inside the Despgraph (namely build_object_data_geometry_datablock that takes an obdata ID* as input instead of a OB). The implication of all this makes me wonder why / what was the original design supposed to be? Having multiple ways of dealing with modified geometry seems kind of bad from my point of view.

Port code in Curve/Surf/Text to use Curve->runtime to produce final mesh and duplicate the Curve obdata so that modifiers are applied interdependently.

Not sure what that means. The conversion to mesh can only happen after tessellation point of modifier stack of curve object. If you create mesh prior that you can no longer to bevel/taper, and can not apply deformation modifiers on the control points.

it needs some refactor inside the Despgraph (namely build_object_data_geometry_datablock that takes an obdata ID* as input instead of a OB).

I am not sure why any changes to the dependency graph are needed.

To me it seems all changes are needed in BKE_displist_make_surf(), or maybe even in curve_calc_modifiers_post() to convert the nurbs list to mesh after the modifier stack has been evaluated. Effectively, do the same thing as the constructive modifiers do: convert nurbs to mesh, if the mesh is not yet created after the modifiers loop is finished.

Then the only exception is that you'd need to access Object.runtime.mesh_final as an opposite to Mesh case when you can do Object.data. This is because we can not change object type during evaluation.

> Port code in Curve/Surf/Text to use Curve->runtime to produce final mesh and duplicate the Curve obdata so that modifiers are applied interdependently. Not sure what that means. The conversion to mesh can only happen after tessellation point of modifier stack of curve object. If you create mesh prior that you can no longer to bevel/taper, and can not apply deformation modifiers on the control points. > it needs some refactor inside the Despgraph (namely build_object_data_geometry_datablock that takes an obdata ID* as input instead of a OB). I am not sure why any changes to the dependency graph are needed. To me it seems all changes are needed in `BKE_displist_make_surf()`, or maybe even in `curve_calc_modifiers_post()` to convert the nurbs list to mesh after the modifier stack has been evaluated. Effectively, do the same thing as the constructive modifiers do: convert nurbs to mesh, if the mesh is not yet created after the modifiers loop is finished. Then the only exception is that you'd need to access `Object.runtime.mesh_final` as an opposite to Mesh case when you can do `Object.data`. This is because we can not change object type during evaluation.

This issue was referenced by a14735d11d

This issue was referenced by a14735d11d2e16f24f63513d58b1d95864bdf27f

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author

This still isn't fully resolved, even though curves are now behaving correctly with mirror/array modifiers, try link copying a curve (using Alt+D) which has a curve modifier on it and you'll see what i mean. The outline is drawn correctly but the mesh data itself is not, i think it's a depsgraph thing.

This still isn't fully resolved, even though curves are now behaving correctly with mirror/array modifiers, try link copying a curve (using Alt+D) which has a curve modifier on it and you'll see what i mean. The outline is drawn correctly but the mesh data itself is not, i think it's a depsgraph thing.

@Hickz The original file does work here and did exhibit exactly what you are describing. Can you make a screenshot and/or post a new file exhibiting the issue?

@Hickz The original file does work here and did exhibit exactly what you are describing. Can you make a screenshot and/or post a new file exhibiting the issue?
Author

@fclem

You can find one file here https://developer.blender.org/T63871 (i created a new task for a new problem, this is related i think)

The file for this particular problem is: sample2.blend
Try moving curve2 object, you'll see what i mean about the outline (it is drawn correctly, but not the mesh data)

this problem appears when you apply the modifier to curve points (this button is switched on) image.png

@fclem You can find one file here https://developer.blender.org/T63871 (i created a new task for a new problem, this is related i think) The file for this particular problem is: [sample2.blend](https://archive.blender.org/developer/F6976978/sample2.blend) Try moving curve2 object, you'll see what i mean about the outline (it is drawn correctly, but not the mesh data) this problem appears when you apply the modifier to curve points (this button is switched on) ![image.png](https://archive.blender.org/developer/F6976986/image.png)
Author

@fclem

Should this be reopened, do you think? This problem is pretty huge i think (at least for my jewelry modeling workflow)

@fclem Should this be reopened, do you think? This problem is pretty huge i think (at least for my jewelry modeling workflow)
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#61184
No description provided.