Hi!
I use InstancedNode
with geometries with unshaded material and I am happy with it. Now I want to use this node for geometries, which use Lighting material, and I have a problem, when I use PointLight
.
RenderManager
filters out geometries (using LightFilter
), which don’t touch light (which is good). Classes inherited from BoundingVolume
are used for this. All the geometries, which are instanced, are grouped in the InstancedGeometry
. InstancedNode
keeps correct up-to-date BoundingVolume
, which is based on all instanced geometries, but InstancedGeometry
keeps only BoundingVolume
for a single geometry and using local coordinate system. Need to note, that InstancedGeometry
keeps a list of all the instanced geometries, so it would not be a big deal (or will?) to update InstancedGeometry.worldBound
, when a new geometry is added to the InstancedGeometry
.
LightFilter
works with geometries, but not nodes, so InstancedGeometry.worldBound
will be used, and of course its BoundingVolume
does not cover all the instanced geometries, so all the instanced geometries will be skipped from the light technique, unless PointLight
is close to the World (0, 0, 0), and I see such result in a test. For example, if light’s radius is 10 units, then instanced geometries are lit only when light position is within 10 + geometry’s half extent around World’s (0, 0, 0). If to place the same PointLight
at (15, 0, 0), then instanced geometry with world’s coordinates (12, 0 0) will not be lit, even if it is 3 units away from the point light.
So, I want to ask, how to deal with it? If it is JME bug, what is the best way to fix it? Update InstancedGeometry.worldBound
, if a new geometry is added to InstancedGeometry
by setting some flag like RF_BOUND
and calculate it like regular node does, but using InstancedGeometry.geometries
? Even if InstancedGeometry
is a Geometry
, but it behaves like a Node
for me.
Thank you!