Page MenuHome

Liquid Simulation Display Options (GSoC 2020)
ClosedPublic

Authored by Sriharsha Kotcharlakot (Sriharsha) on Aug 25 2020, 5:07 PM.
Tags
None
Tokens
"Love" token, awarded by Raimund58."Love" token, awarded by sebbas."100" token, awarded by Frozen_Death_Knight."Love" token, awarded by brilliant_ape."Love" token, awarded by astrand130.

Details

Summary

All the changes made in the branch soc-2020-fluid-tools are included in this patch.

Major changes:

Viewport Display

  • Raw voxel display or closest (nearest-neighbor) interpolation for displaying the underlying voxel data of the simulation grids more clearly.
  • An option to display gridlines when the slicing method is single.
Grid Display
  • Visualization for flags, pressure and level-set representation grids with a fixed color coding based on Manta GUI.
Vector Display
  • Marker And Cell grid visualization options for vector grids like velocity or external forces.
  • Made vector display options available for external forces.
Coloring options for gridlines
  • Range highlighting and cell filtering options for displaying the simulation grid data more precisely.
  • Color gridlines with flags.
  • Also, made slicing and interpolation options available for Volume Object.

Diff Detail

Repository
rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) requested changes to this revision.Tue, Sep 1, 6:07 PM

With this, Quick Smoke does not show 3d smoke by default anymore.

In a debug build with ASAN I get P1616 after using the Quick Smoke operator.

release/scripts/startup/bl_ui/properties_physics_fluid.py
1355–1357

domain.coba_field in {"FLAGS", ...}

1419

You are using ' and " inconsistently here it seems. I'm sometimes inconsistent with that myself though...

source/blender/draw/engines/overlay/overlay_extra.c
1386

missing .

1501

Can be const and moved down to where the variable is actually used (to reduce the scope of the variable).

source/blender/makesdna/DNA_volume_types.h
128

Now there is VOLUME_INTERPOLATION_LINEAR and VOLUME_INTERP_LINEAR. Either the names should become more specific or become unified.

source/blender/makesrna/intern/rna_fluid.c
2556

Hm, it might be that we don't want to use the term coba in the Python API, at least I've never seen it. Internally, coba stands for ColorBand, while in the Python API we use ColorRamp. Maybe @Campbell Barton (campbellbarton) has an opinion on that.

source/blender/makesrna/intern/rna_volume.c
405

Should probably be CLOSEST instead of RAW here as well.

This revision now requires changes to proceed.Tue, Sep 1, 6:07 PM
Sriharsha Kotcharlakot (Sriharsha) marked 6 inline comments as done.

Made most of the changes mentioned.

Commits:

Included world_block UBO in the shading groups for volume (in Workbench) when slicing is used, to avoid 'Missing UBO bind' error as in P1616. (10cfa388479c)

source/blender/makesrna/intern/rna_fluid.c
2556

agree, this should be color_ramp_field, unfortunately the other term is already coba_* prefix, which should be changed to color_ramp_ too.

Replaced coba_* with color_ramp_* in the Python API for fluid. (66a8a2584f28)

Sebastián Barschkis (sebbas) requested changes to this revision.Wed, Sep 9, 4:40 PM

Okay, overall very nice! Besides to the code comments and on a second note (I think I said something different during GSoC):

The default slice method should better be "Full" and the interpolation "Linear". Otherwise, users might be confused when all they see of their smoke domain is a slice. For liquids this was not so critical as users will mostly see the particles or the mesh.

release/scripts/startup/bl_operators/object_quick_effects.py
529

This coba_field should be updated too. Probably an oversight during the last renaming commit.

source/blender/draw/engines/overlay/shaders/volume_velocity_vert.glsl
159

In my view, a switch should always have a default label. For cases where it wouldn't make much sense, you can do something like this:

default:
    /* Should never get here. */
    assert(false);
source/blender/draw/engines/workbench/workbench_shader.c
482–491

Missing default label.

source/blender/draw/engines/workbench/workbench_volume.c
74–75

I think this comment is not needed anymore.

105

Missing default label.

236

Missing default label.

source/blender/draw/intern/draw_fluid.c
405

Missing default label. Probably best to NULL the pointers in this case.

source/blender/makesdna/DNA_fluid_types.h
151

missing .

source/blender/makesrna/intern/rna_fluid.c
1045

This function does not seem to be needed and the default one can be used.

2552

rna_Fluid_cobafield_set can be set to NULL after removing the function and in order to use the default setter.

This revision now requires changes to proceed.Wed, Sep 9, 4:40 PM
source/blender/draw/engines/workbench/workbench_shader.c
482–491
NOTE: No default label needed here, skip my previous comment. It's even better to not have one here as any new item in them enum would otherwise not through a warning (kudos to @Jacques Lucke (JacquesLucke) for pointing this out!)

Added some clarifications for the switch statements.

source/blender/draw/engines/workbench/workbench_volume.c
105

In this case, it's better to omit the default label as well. However, it's best to explicitly cast to the enum here.

switch ((FLUID_DisplayInterpolationMethod) fds->interp_method) {

FLUID_DisplayInterpolationMethod needs to be added to the interpolation method enum in DNA_fluid_types.h

236

No default label needed here either, skip previous comment. Instead, add a cast here:

switch ((eWORKBENCH_VolumeInterpType) volume->display.interpolation_method) {
source/blender/draw/intern/draw_fluid.c
405

Skip previous comment, instead add a cast to the enum:

switch ((FLUID_DisplayVectorField) vector_field) {

The name FLUID_DisplayVectorField would of course need to be added to the enum in DNA_fluid_types.h too.

Sriharsha Kotcharlakot (Sriharsha) marked 14 inline comments as done.

Made the mentioned changes.

Commits:

  • Merge branch 'master' into soc-2020-fluid-tools
  • Merge branch 'master' into soc-2020-fluid-tools
  • Cleanup: Changed fluid viewport display defaults and refined comments
Sebastián Barschkis (sebbas) requested changes to this revision.Thu, Sep 10, 4:25 PM
Sebastián Barschkis (sebbas) added inline comments.
source/blender/draw/engines/overlay/shaders/volume_velocity_vert.glsl
184

Uh, my bad, this is GLSL! Using assert() is not possible here and will give a crash. Since all 6 cases are covered in the % 6 switch, it should be fine to not have a default block here after all.

So you can reverse this change.

This revision now requires changes to proceed.Thu, Sep 10, 4:25 PM

Made the mentioned change
Commits:

I think this patch ready to be merged! One thing we still need to figure out is how to deal with grids that are not being cached and only available at runtime of the simulation (e.g. pressure, forces). Otherwise users might wonder why those grids are not being updated correctly.

This kind of polish can wait until after the merge though.

This revision is now accepted and ready to land.Fri, Sep 11, 10:14 AM
  • Volume Object: Hide slice axis and slice depth for 'full' slicing in Viewport Display. (148bdfadb6a0)
  • Merge branch 'master' into soc-2020-fluid-tools
  • Merge branch 'master' into soc-2020-fluid-tools