Download

Object Orientation material expression doesn't work on instanced meshes

I’ve noticed that the ObjectPosition expression reports the location of each instance in an instanced static mesh in its material, but the ObjectOrientation does not, and just reports a single orientation for the whole mesh. Is this a bug, or just the nature of how it works? Is there any chance we will gain the ability to define attributes on a per-instance basis? Essentially vertex attributes, but something that could be accessed from within the material graph?

You should be able to get it by passing the value via the custom UVs, I believe. If that doessn’t work you could transform 1,0,0 from local to world and that should also be the same but it also has to be in the customUVs.

Thank you so much, I’ll look into custom uvs and see if they can work! I basically want a way, when I am spawning an instance in an instanced static mesh, to attach a couple other parameters to each one and use those to modify it in the material. The only one I can see is the transform you pass when creating an instance.

A little background: I’m working on a star field using a dataset of about 100k nearby star coordinates. Since they’re all just spheres, it doesn’t really matter how they are rotated, and I was getting excited that I could just hide 3 pieces of float data in the rotation element of each instance transform (absolute magnitude, radius, etc) and then access it later in the shader to scale each instance individually without having to regenerate the whole set and geometry. However in all my tests the object orientation just returns the same value across the board regardless of how the rotator is set on each mesh instance.

Thanks again, soooo close, really hoping this is possible. I really just need one more float per instance to do what I need!