classes/class_multimesh #495
Replies: 3 comments 2 replies
-
|
Clearing the buffer (i.e., data loss) when changing instance_count is not the most obvious behavior, and it caused a bug in my project that was hard to track down. This is a very important peculiarity of MultiMesh that I would have been glad to know about earlier, if it had been mentioned at the top of this page and in the class comments in the C++ code. |
Beta Was this translation helpful? Give feedback.
-
|
For those trying to use set_buffer_interpolated or set_buffer I would refer to the RenderingServer documentation which goes more into details on how to set the packed float array https://docs.godotengine.org/en/stable/classes/class_renderingserver.html#class-renderingserver-method-multimesh-set-buffer Also, the reason I ended up using set_buffer_interpolated is you may not want the color or custom data to also interpolate. Which is my case since I pass vertex animation texture data through the custom data. To do that, whenever you set the current buffer data you also set the previous so that they are always the same (meaning, the interpolation result gives the same value). This example is in Godot-Rust, but should be very similar in GDScript: let instance_id_data = instance_id as usize * 20;
self.buffer[instance_id_data+16] = custom_data.r; // both are PackedFloat32Array
self.prev_buffer[instance_id_data+16] = custom_data.r; |
Beta Was this translation helpful? Give feedback.
-
|
I had the same issue as railwaybird I believe. (in c++) Ran into the problem trying to remove instances. Might be nice to have a 'remove_instance(instanc: int)' method |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
classes/class_multimesh
Inherits: Resource< RefCounted< Object Provides high-performance drawing of a mesh multiple times using GPU instancing. Description: MultiMesh provides low-level mesh instancing. Drawing thousands ...
https://docs.godotengine.org/en/stable/classes/class_multimesh.html
Beta Was this translation helpful? Give feedback.
All reactions