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"

Material Function stop working when turning Constant 4 vector into vector parameter?

So, I made a material function to select which RGB and A channel to sample from using a Constant 4 vector as a mean to choose channel. This works great but as soon as I turn the constant 4 vector into a vector parameter so i can instance the material I get the following errors: [SM5 Function MF_RGBorA: Cannot cast from float3 to float4. And [SM5 Function MF_RGBorA: (node If) If input A must be of type float.

It works great when I'm not using a vector parameter. According to http://udn.epicgames.com/Three/MaterialsCompendium.html#VectorParameter there shoulnd't be any difference between a constant 4 and a vector parameter.

Why is this?

Product Version: Not Selected
Tags:
more ▼

asked Nov 09 '14 at 07:40 PM in Rendering

avatar image

Sitrec
313 21 23 22

avatar image Lovecraft_K ♦♦ STAFF Nov 12 '14 at 10:42 PM

Hey Sitrec -

Are you, and if so how are you, using a LERP or IF node in your material function? Both of these errors may be a result of not being able to compare vectors and floats in a 1 to 1 fashion?

Let me know -

Eric Ketchum

avatar image Sitrec Nov 13 '14 at 07:32 AM

Hi Eric, Yes, I'm using tons of IF nodes in the material function. Thanks!

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

1 answer: sort voted first

I also had some issues with VectorParameters, where it should work, but won't. Here are a couple things to try:

Use the Main output pin and plug it into an Append node, and add the alpha output to the 2nd slot of the append, then try using the output of that to the node you are trying to connect.

You could also choose to use a collection parameter (and a MaterialParameterCollection) which is useful when you have many parameters to set inside a material. The default output from a Collection Vector parameter is always 4-channel, but then you will need to us a RGB ComponentMask for any 3 channel inputs.

Here is some more info on all of this:

https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/ExpressionReference/Parameters/index.html#vectorparameter

Hope that helps Sitrec! :)

more ▼

answered Nov 09 '14 at 11:08 PM

avatar image

DotCam
3.1k 74 34 148

avatar image Sitrec Nov 13 '14 at 07:34 AM

Hi, After reworking it I got it to work using your suggestion so I'm all good now. Thanks!

avatar image uw19 Nov 13 '15 at 01:30 AM

Adding the append node helped my situation as well. Thanks!

(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