Skip to content

Allow specifying more custom instance data for MultiMesh #8666

Description

@enbugger

Describe the project you are working on

A project that extensively uses MultiMesh with custom spatial shader which alters the look of each instance.

Describe the problem or limitation you are having in your project

I'm running out of data I'm able to supply for one instance of a multimesh

for box in box_array:
	boxes.multimesh.set_instance_transform(box.instance_idx, box.compute_transform())
	boxes.multimesh.set_instance_color(box.instance_idx, box.compute_color())
	var uv_offset = library.box_definitions[box.id].get_uv()
	boxes.multimesh.set_instance_custom_data(
		box.instance_idx, 
		Color(uv_offset.position.x, uv_offset.position.y, uv_offset.size.x, uv_offset.size.y))
        # Need more data for box like below
	boxes.multimesh.set_instance_custom_data2(
		box.instance_idx, 
		Color(....))

Describe the feature / enhancement and how it helps to overcome the problem or limitation

  1. Add ability to supply more data by having more reserved variables like in example above
    or
  2. Suggest the way to bypass this without engine's source code modification

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

boxes.multimesh.set_instance_custom_data2(
		box.instance_idx, 
		Color(....))

If this enhancement will not be used often, can it be worked around with a few lines of script?

Only packing per instance data more densely but this is not few lines

Is there a reason why this should be core and not an add-on in the asset library?

AFAIK GDExtenstions cannot introduce new shader built-in variables? In this case it would be INSTANCE_CUSTOM_2 that should be introduced

Overall, 8 floats per instance is pretty low amount of data and limits creativity with instancing a lot

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions