Page MenuHome

Fix T85049: Geometry Nodes: How to handle instances with shear?
ClosedPublic

Authored by Sebastian Parborg (zeddb) on Jan 26 2021, 2:57 PM.

Details

Summary

Use transform matrices instead of loc, rot, scale variables to store instance transforms.

There is still some issues with the transform node for example where you can introduce shearing.
I'm wondering if I should try to fix that in this patch as well?

Diff Detail

Repository
rB Blender

Event Timeline

Sebastian Parborg (zeddb) requested review of this revision.Jan 26 2021, 2:57 PM
Sebastian Parborg (zeddb) created this revision.
Jacques Lucke (JacquesLucke) requested changes to this revision.Jan 26 2021, 4:45 PM

Note that this fix should be in 2.92, the current patch is against master.

source/blender/blenkernel/intern/object_dupli.c
831

Have you ever tested this with more than one instance? instance_offset_matrix should be instance_offset_matrices and instead of dereferencing it like this, you need to access it using the index i.

source/blender/blenlib/BLI_float4x4.hh
41

Using auto here is simply not acceptable. Unfortunately, it is relatively difficult to deal with these C style arrays, because they can't be returned.
I'll probably have to get rid of the other implicit conversion operators as well, because they cause problems as described here: rB6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82.

For the time being please use this:

using c_style_float4x4 = float[4][4];
c_style_float4x4 &ptr()
{
  return values;
}

const c_style_float4x4 &ptr() const
{
  return values;
}

This requires you to call .ptr() on the matrices, which isn't super nice, but better than the alternatives that I'm aware of.

source/blender/nodes/geometry/nodes/node_geo_object_info.cc
59 ↗(On Diff #33154)

There is no need for this type change as part of this patch. Same in a couple of other places.

This revision now requires changes to proceed.Jan 26 2021, 4:45 PM
Sebastian Parborg (zeddb) marked 3 inline comments as done.
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_object_info.cc
97 ↗(On Diff #33172)

This should not reuse the existing transform matrix, but use a new one instead. Just declare float unit_transform[4][4]; or something similar in the else block.

This only affects the master branch though.

This revision is now accepted and ready to land.Jan 26 2021, 6:00 PM