Make floating origin work with instances

Hello there,

I have continued experimenting with the new floating origin feature and found it does not seem to work with instances:

Interestingly enough, it works when assigning the node material to the sphere :thinking:

Do you know what’s going on here @georgie ?

1 Like

I will take a look! Note that the feature is experimental because it is not yet feature complete / I plan to continue pushing changes before officially considering the feature ready – thank you for testing it out / reporting gaps!

Other known issues include: Shadow rendering, billboard mode / infinite distance

1 Like

Thank you for taking a look! I was not sure about labeling it as “bug” since you mentioned it was experimental earlier ^^’ Maybe feature request would be better?

Either works! Just semantics :slight_smile: Please feel free to keep reporting gaps

1 Like

update i have the fix locally, just making some changes to ensure it doesnt have any perf impact when floatingOriginMode is not enabled

1 Like

Just merged my PR! Will be a sec before the playground reflects the change, but you can test with this link + any snippet :slight_smile:

Add support for instances in FloatingOriginMode by georginahalpern · Pull Request #17328 · BabylonJS/Babylon.js

2 Likes

Thanks a lot! Can’t wait to use it with the next release :wink:

Does it have a noticeable performance impact when it is enabled?

1 Like

Seems to be pretty fast on this thin instance stress test :ok_hand:

1 Like

Yes I tested with huge number of instances and thin instances, no noticeable perf impact (its only 3 float subtractions per instance, which is negligible compared to everything else going on per frame) – my tests all remained at 120 fps

1 Like

Actually FPS is not the most informative for testing perf, frame time is better (since it doesn’t get capped based on the device’s limits) – Optimizing Your Scene | Babylon.js Documentation

testing frame time i did find an optimization for floating origin, just checked in a fix (rather than accessing offset 3x / instance / frame, now just accessing it once per frame)

Showing faster frame time than before the instance change :slight_smile: and improves non-instances as well

(this is a sample playground and i can perform a full robust perf analysis before considering floatingorigin complete! )

Before instance change

After instance change

After optimization change (now)

1 Like