Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Is it possible to use instanced material on instanced static mesh?

I have a book shelf full of books. Each book is instanced static mesh. Using vector parameter I can change book color, can I make it so each instance will have random color?

Product Version: UE 4.8
more ▼

asked Aug 13 '15 at 01:27 PM in Blueprint Scripting

avatar image

67 9 15 19

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You cannot change material parameters on a per-instance basis because all of the instances are rendered in a single draw call with no material setting in between (which is part of what makes them faster to render).

But there is a PerInstanceRandom material node that will give you a consistent random number assigned to each instance. You could use that number to generate a color or as a texture coordinate to look up a value from a 1xn texture that you create with a different color in each pixel. That will give each book a consistent but different color.

  • Jack

more ▼

answered Aug 14 '15 at 12:28 PM

avatar image

1.3k 37 11 48

avatar image intoxicat3 Oct 26 '17 at 08:05 AM

Any chance we could pass some data to instanced static mesh so we can use PerInstanceData for example? Random isn't much a win if you want to change color for specific instances.

avatar image JackP STAFF Oct 30 '17 at 02:24 AM

Are you looking to change the color of a specific single instance, for example when the user interacts with it? If so the recommended workflow is to remove or hide the instance and replace it with a real actor while it's being interacted with.

There is no other room in the per-instance data to store a per-instance color value or other data if you want to use instancing but have some specific parameter overridden per instance.

avatar image nonchip Nov 28 '18 at 07:31 AM

except that's literally how PerInstanceRandom works, so what's stopping us from making an "override per instance random value(int idx, bool customOrRandom, float customValue)" node?

I'm gonna look into that and probably just extend a new HISMC child class (looks like it's just some few changes that can easily be made by overriding/wrapping the right functions) and will report back with what i find.

avatar image axess21 Nov 28 '18 at 03:32 PM

This is fun) I don't even remember why and where did I need this functionality!

avatar image nonchip Nov 30 '18 at 11:39 AM

common thing would be: using instanced cubes for minecraft-esque voxel rendering and then having a parameter for the texture etc

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question