Page MenuHome

Draw: Curve outline drawing in object mode.
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Jun 28 2022, 10:55 AM.

Details

Summary

This patch adds (selected/active) outline around a curve object in object mode.

In the past the draw bounds option was enabled for any curve objects. With this
patch it isn't needed and will be disabled.

In the future the curve outline could also be enabled to improve GPU selection.

Diff Detail

Repository
rB Blender

Event Timeline

Jeroen Bakker (jbakker) requested review of this revision.Jun 28 2022, 10:55 AM
Jeroen Bakker (jbakker) created this revision.
Jeroen Bakker (jbakker) retitled this revision from Draw: Curve outline drawing in object mode. to Draw: Curve outline drawing in object mode. [WIP].Jun 28 2022, 10:56 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Draw: Add GPU selection for new curve objects.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Add support for clipping planes
  • Testing.
  • Try to push radius.
  • Set a minimum radius for curve rendering. (WIP)

The minimum radius is still WIP as it uses a different approach than initially planned.
It is cheaper, but might need some trickery to get radius 0 working.

The active selection should not be visible when in curve sculpt mode.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Jul 1 2022, 8:47 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Jul 1 2022, 8:59 AM
  • Fix pushing thickness when curve doens't have a thickness.
  • Don't show outlines in sculpt curve mode.
  • Merge branch 'master' into temp-T95933-object-mode-curve-selection
  • Removed hack where thick_time was in world space (shading artifacts).
  • Viewport size aware.
Jeroen Bakker (jbakker) retitled this revision from Draw: Curve outline drawing in object mode. [WIP] to Draw: Curve outline drawing in object mode..Jul 1 2022, 1:23 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Always offset the outline with a single pixel.
source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
60

*0.5

70

Is this still in use?

source/blender/draw/engines/overlay/overlay_extra.c
1530–1531 ↗(On Diff #53156)

I think it would be better to use versioning to disable the OB_DRAWBOUNDOX flag from curves objects, and remove it in the three cases with the /* TODO: Remove once there is actual drawing. */ comment.

source/blender/draw/engines/overlay/overlay_extra.c
1530–1531 ↗(On Diff #53156)

Not sure, the has_bounds and draw_bounds work together. has bounds are for object types that never should be drawn with boxes. I see I have made a mistake. OB_CURVES should not be part of this list. as it should be drawn the way how the user has set it up.

I will revert this change.

source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
33

Use drw_view.winmat instead. This was recently refactored / mass renamed.

52–62

This whole part could be better commented. I am not sure what d is (I guess the screen space normal vector to the curve).

I think you can have the same result by just copying what hair_get_pos_tan_binor_time does and just scale and/or clamp the thick_time.
You can know the world space radius to clamp to by using (untested) point_world_to_ndc(center_world_pos).w * minimum_radius_in_pixel * drw_view.viewport_size_inverse.y * drw_view.wininv[1][1] or something like that.

source/blender/draw/intern/shaders/common_hair_lib.glsl
220–232

I would rename the function hair_get_pos_tan_binor_time_no_expand and move this block to hair_get_pos_tan_binor_time. This would remove the need to rename wpos to orig_wpos.

Jeroen Bakker (jbakker) marked an inline comment as done.
  • Disable show_bounds for curve objects.

The part I commented about looks good to me. Don't have much of an opinion about anything else though.

Accepting it. I'm also updating the manual to mention that selection is working in X-Ray (good job with that Jeroen :)

Jeroen Bakker (jbakker) marked 2 inline comments as done.
  • Use drw_view.winmat for projection matrix.
  • Merge branch 'master' into temp-T95933-object-mode-curve-selection
  • Screen space curvce outline.
  • Use drw_view to retrieve view matrix inverse.
  • Remove recalculations.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Jul 8 2022, 10:54 AM
Jeroen Bakker (jbakker) marked an inline comment as done.
Jeroen Bakker (jbakker) added inline comments.
source/blender/draw/engines/overlay/overlay_extra.c
1530–1531 ↗(On Diff #53156)

I now see what you mean. New curve objects automatically enabled the bounds.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Jul 8 2022, 11:18 AM
This revision is now accepted and ready to land.Jul 8 2022, 12:05 PM