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"

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. 

How to read BaseColor from a Material in Blueprint(NOT PARAMETER)

Hello,

Is there a way to get the BaseColor value from a material in blueprint? I DON'T MEAN A PARAMETER for BaseColor, I mean the actual vector3 value for BaseColor. This is because I'm adding StaticMeshActors in my scene to an array and for each of them I need to read their BaseColor values to use as a variable for individual dynamic material instances later on.

Thank You.

Product Version: UE 4.22
Tags:
more ▼

asked May 03 '19 at 09:53 PM in Blueprint Scripting

avatar image

cupcakefury
1 1 1

avatar image plangton May 03 '19 at 10:28 PM

you want to read the data that is used in the material from blueprint? i don't think that is possible beside using RenderTargets. the opposite whoever is possible

avatar image cupcakefury May 03 '19 at 11:37 PM

Alright, thanks regardless.

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

1 answer: sort voted first

BaseColor is not necessarily a single color. If it is defined in the material, there is no easy way getting it since it resides on the gpu. Here is my silly solution if you absolutely must have it AND you don't care about performance AND your BaseColor is indeed a single color AND you want to do it in blueprint only: apply the material to a quad mesh, use a SceneCapture with BaseColor as Capture Source and a 1x1px render target, "Capture Scene", read back the render target to main memory and get the pixel value ("Read Render Target Pixel"). The result will be 8 bit and you might need to undo the color transformation to sRGB. ;-)

more ▼

answered May 03 '19 at 10:59 PM

avatar image

Speido
21

avatar image cupcakefury May 03 '19 at 11:42 PM

Yeah, doesn't seem like an plausible solution performance wise. I haven't coded anything in C++ for a while and don't wanna risk bricking anything. Never mind then, I'll just resort to some...less than ideal measures. 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