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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

MaterialInstanceDynamic(MID) and MaterialParamCollection(MPC) inside ForLoop

Could someone help me figure out why neither MIDs or MPCs pass parameters correctly to a DrawMaterial call when inside a ForLoop?

The array of floats being used to pass values to both the MID and MPC setups contain 3 values: 0.0, 0.5 and 1.0.

Expected result:
When rendered I expected the DrawMaterial call for both setups to display a black, grey and white square.

Actual result:
In the MID example only the last value in the array (1.0) is used for all three squares.

In the MPC example all three loop iterations are black. I don't think the array value is being passed to the material for some reason.


alt text

alt text

alt text

Product Version: Not Selected
more ▼

asked Dec 14 '14 at 01:48 PM in Using UE4

avatar image

506 73 66 97

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

1 answer: sort voted first

Hey ash22 -

Material Parameter Collections is not the way you want to do this particular type of call. MPCs are meant to change a particular variable in multiple materials to the same value. The individual Materials that use the MPC cannot have different values.

Your first method was correct but you should move your MID creation into your loop that way each of your draw material calls can have a different value otherwise the same issue as with an MPC arises and you are assigning the same material each time and change the value each time so the last time it is called it sets all three because each is using the same material.

Here is a corrected BP, note I removed your Construction Script and the VID variable as unneeded:

alt text

Thank You

Eric Ketchum

midbp.jpg (130.8 kB)
more ▼

answered Dec 16 '14 at 08:50 PM

avatar image

Lovecraft_K ♦♦ STAFF
36.7k 702 260 735

avatar image ash22 Dec 17 '14 at 09:54 AM

Oh wow, Thanks Eric!

When I originally attempted to drag the CreateDynamicMaterial node from the palette the tooltip said
"Function is hidden and inaccessible".
I assumed it wasn't compatible with the HUD for some reason. It didn't occur to me to drag a wire directly from the
Set Scalar Param node to access it. Actually, I think I did at one point, but didn't see the function because
[x]Context Sensitive was checked.

In one of Zak's tutorials he does explain how nodes try to 'help' you find a contextual caller but I was so busy scratching my head over the ForLoop issue that it never occurred to me to uncheck [ ]Context Sensitive and look again.

Now I'll remember it in future.


(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