Floating origin, billboarding and thin instances

Hello!

I am trying to make use of thin instances in a large scene using a floating origin camera:

moving forward/up/down etc sees to work fine.

However rotating the camera has weird visual effect on the individual thin instances … any ideas? They don’t “rotate enough” around the origin, if that make sense! :slight_smile:

thanks!

@Evgeni_Popov is the king of thinInstances amongst other things :wink:

amongst other things indeed! :slight_smile:

mmm night be linked to:

which would mean thin instances and billboard don’t work well together?

From the second link “you’d have to compute the matrices yourself as billboard mode is not supported for thin instances”. Fine… but how to do it, in the context of a floating origin (assuming that is relevant?)? :slight_smile:

This might be the issue, @Evgeni_Popov will be in tomorrow to help

I don’t think the floating origin is relevant, the problem is that you’ll have to calculate each thin matrix yourself. You can take inspiration from the function TransformNode.computeWorldMatrix :

It’s a bit complicated because it has to manage a lot of things, so you’ll have to clean up!

ooof ok thanks <3

ok I got temporary translates and scales working (hardcoded values for testing…).
Rotation though… here’s what it looks like (hard to reproduce on a PG unfortunately…):

image

Red colours are for obvious visibility. :slight_smile:

actually, a simplified version:

Any ideas/suggestions?

You will have to recompute the matrices each frame, or at least each time the camera moves, as the billboard mode depends on the camera position.

Thank you, I was afraid this might be the case.
Where would be the best place to do that?

Would making use the OriginCamera’s onBeforeActiveMeshesEvaluationObservable hook work?

I would do it in camera.onViewMatrixChangedObservable. That way, you would not perform the calculation if the camera did not move/rotate.

1 Like