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"

Find location of pixel color on texture

Is there adny possibility to find world location of specific pixel color on texture? For example if I made red dot on texture. Can I find location of this dot in material?

Product Version: UE 4.14
Tags:
more ▼

asked Dec 24 '17 at 02:41 PM in Rendering

avatar image

Waw K.
70 13 23 32

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

1 answer: sort voted first

What is location in this case? UV coordinate?

If this texture is tiled 4x4, you want to get all 16 locations?

If this texture have many red dots on it, you want to get all this locations or only first one?

Texture is like an array of pixels, and only way to understand is this array contains something - is to process all it's elements, and compare them with desired colors or so.

Answering to your question - yes it is possible, but not with some standard functions and operations.

more ▼

answered Dec 24 '17 at 04:52 PM

avatar image

redbox
4.2k 80 17 103

avatar image Waw K. Dec 24 '17 at 10:03 PM

Thank you for your answer. It's very clear.

I want to use this red dot as a marker on flipbook animation. Just like socket that I can set on every frame on animation and read location of it. I make 2d platformers so technic like this is very promissing.

So there will be one red dot on texture. And location of this dot would change on every frame of sprite used by material. Would that be a mess to achive this funcionality?

If I understand you correctly I Should create function that will process whole texture pixel by pixel and compare every of it to desired color on every frame and then gives me location of my dot?

Thank you once more.

avatar image redbox Dec 25 '17 at 06:10 AM

Yes, and depending on texture size it can be very slow operation.

I think you need to use another approach, like add some special coords data to every frame or so. In case this is dynamic material, you can add this parameter to material, and get it in any moment.

Sorry, but I'm not very familiar with paper 2d animations.

avatar image Waw K. Dec 25 '17 at 11:31 PM

Special coords data sounds exactly like add socket to animation. Your argument about performance close the topic. Thank you very much once more.

(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