x

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"

Materials on instanced meshes not working

Hi there

I'm working on a blueprint which heavily relies on instances of static meshes. What I'm currently struggling with is that material overrides that I set in the InstancedStaticMeshComponent do not seem to have any effect (only the material originally assignes is shown). I have assigned a specific material (some materials are also instances) for each instanced mesh.

Am I missing something here?

Cheers, Michael

Product Version: Not Selected
Tags:
more ▼

asked May 25 '14 at 05:50 PM in Bug Reports

avatar image

Michael Boeni
1 4 7 7

avatar image Lovecraft_K ♦♦ STAFF May 25 '14 at 06:54 PM

Hey IMX -

So you are dynamically creating Static Mesh components in a blueprint, are you then setting their materials? If you can post a screenshot of your Blueprint and I can see how we can help you get this sorted out.

Thank You

Eric Ketchum

avatar image Michael Boeni May 25 '14 at 07:33 PM

Hi Eric

No, the instances are created and placed manually in the component editor. I then set different materials per instance but the materials seem to be ignored. I have attached a screenshot to illustrate.

alt text

Cheers, Michael

instanced_mesh.jpg (268.6 kB)
avatar image Lovecraft_K ♦♦ STAFF May 25 '14 at 08:41 PM

Hi Michael -

So My next question is in the construction graph are you setting a dynamic Material Instance for each of the mesh instances you have created?

-Eric Ketchum

avatar image Michael Boeni May 26 '14 at 01:16 PM

Hi Eric

Nope, this is what I did (in the components view of the blueprint):

  1. Create an InstancedStaticMeshComponent

  2. Assign a mesh to it

  3. Create 3 instances of the mesh (in the details panel of the InstancedStaticMeshComponent)

  4. Under Rendering-> Materials I added 3 elements and assigned the materials I wanted to it (also in the details panel of the InstancedStaticMeshComponent)

That's all.

My assumption is that the materials I assigned as mentioned above are mapped to the according instances of the mesh.

I did not add any nodes in any of the graphs.

Cheers, Michael

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

1 answer: sort voted first

Hey Michael -

Sorry for the initial confusion but I understand the problem now. The rendering drop down for the Instanced Static Meshes is not so you can set the material for each instance. The Materials 0, 1, 2, etc. are referring to separate material slots for the same mesh. Here is an example for you, I have a cube in which the top and 2 front faces are separate material slots and you can see in rendering I have the 3 materials set up.

Rendering_Materials

Thank You -

Eric Ketchum

renderingmat.jpg (171.5 kB)
more ▼

answered May 26 '14 at 02:24 PM

avatar image

Lovecraft_K ♦♦ STAFF
36.6k 703 260 737

avatar image Michael Boeni May 26 '14 at 02:28 PM

Hey Eric

Ah okay, that's clear now! I should have known that - I'm working with multiple materials slots all the time...

I assume I just assign the materials to the instances in the construction script then.

Thanks! Michael

avatar image Hyperloop Oct 03 '14 at 05:27 PM

Hi eric, just to clarify: is it even possible to apply different material instances to instanced static mesh components as he is trying to do here? In my exploration, this doesn't seem to work (the material gets set on all the instances). Just wondering what the expected behavior is.

avatar image Lovecraft_K ♦♦ STAFF Oct 03 '14 at 05:46 PM

Hey Hyperloop -

No, Instanced Static Meshes are always going to have the properties of the parent mesh and its materials.

Thank You

Eric Ketchum

avatar image Osok Feb 13 '15 at 02:10 AM

Hello Eric.

The Instanced Static Mesh has the same Material as the parent mesh, but can it have a scalar parameter changed per instance?

Thank you in advance.

avatar image Lovecraft_K ♦♦ STAFF Feb 13 '15 at 04:24 PM

Hey Osok -

Unfortunately, no. The reason being that by setting a different scalar value per instance the rendering thread would have to treat the instances (draw call wise) as the same as if they were not instances thus defeating the performance gains by using instances over actual meshes.

The engine does have a perInstanceRandom node in the Material editor which allows a random float value to be passed based on instances. This node is somewhat limited in scope (every time you use the node in a single material each use will return the same value) and while it does incur some performance cost in use because of its limited scope it is still allows the engine to utilize the instance rendering pathways.

Thank You

Eric Ketchum

(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