Page MenuHome

Refactor: Evaluate surface objects as mesh components
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Apr 5 2022, 12:18 AM.

Details

Summary

This commit furthers some of the changes that were started in
rBb9febb54a492 and subsequent commits by changing the way surface
objects are presented to render engines and other users of evaluated
objects in the same way. Instead of presenting evaluated surface objects
as an OB_SURF object with an evaluated mesh, OB_SURF objects
can now have an evaluated geometry set, which uses the same system
as other object types to deal with multi-type evaluated data.

This clarification makes it more obvious that lots of code that dealt
with the DispList type isn't used. It wasn't before either, now it's
just *by design*. Over 1100 lines can be removed. The legacy curve
draw cache code is much simpler now too. The idea behind the further
removal of DispList is that it's better to focus optimization efforts
on a single mesh data structure.

Cycles and the OBJ IO tests had to be tweaked to avoid using evaluated
surface objects instead of the newly exposed mesh objects.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Apr 5 2022, 12:18 AM
Hans Goudey (HooglyBoogly) created this revision.
  • A bit more removal of no-op code

Can you show us with an example this situation?
Thanks.

Can you show us with an example this situation?
Thanks.

There is no visual change, this is just changing the places things are stored and removing a bunch of unused code.

Can you show us with an example this situation?
Thanks.

There is no visual change, this is just changing the places things are stored and removing a bunch of unused code.

Great. It is very useful. Exactly when coding with depsgraph (curve, particles...). Thank you ))

Wow, that's quite some cleanup. Must have been very satisfying to remove all that code. Couldn't find an issue with this change yet.

Started the buildbot: https://builder.blender.org/admin/#/builders/18/builds/362

Might be worth to mention some other side effects of this commit:

  • Surface objects can now be used with an Object Info node in geometry nodes.
  • With just a small change to spreadsheet_get_object_eval, the evaluated mesh of a surface object can be shown in the spreadsheet.
source/blender/blenlib/BLI_math_vector.h
654

Doesn't seem necessary to remove this.

source/blender/draw/intern/draw_cache.c
3298
[648/2470] Building C object source/blender/draw/CMakeFiles/bf_draw.dir/intern/draw_cache.c.o
/home/jacques/blender/blender/source/blender/draw/intern/draw_cache.c: In function ‘drw_batch_cache_validate’:
/home/jacques/blender/blender/source/blender/draw/intern/draw_cache.c:3298:16: warning: unused variable ‘mesh_eval’ [-Wunused-variable]
 3298 |   struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob);
      |                ^~~~~~~~~
/home/jacques/blender/blender/source/blender/draw/intern/draw_cache.c: In function ‘drw_batch_cache_generate_requested’:
/home/jacques/blender/blender/source/blender/draw/intern/draw_cache.c:3342:16: warning: unused variable ‘mesh_eval’ [-Wunused-variable]
 3342 |   struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob);
      |                ^~~~~~~~~
/home/jacques/blender/blender/source/blender/draw/intern/draw_cache.c: In function ‘DRW_batch_cache_free_old’:
/home/jacques/blender/blender/source/blender/draw/intern/draw_cache.c:3386:16: warning: unused variable ‘mesh_eval’ [-Wunused-variable]
 3386 |   struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob);
      |                ^~~~~~~~~
source/blender/io/wavefront_obj/exporter/obj_exporter.cc
91

Comment might need to change.

This revision is now accepted and ready to land.Apr 5 2022, 10:43 AM
This revision now requires review to proceed.Apr 5 2022, 10:43 AM
  • Add back normal_float_to_short_v2
  • Cleanup: Remove unused variables
This revision is now accepted and ready to land.Apr 5 2022, 6:25 PM