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"

Processing a block of pixel from a texture

I have a black and white texture ( full HD ) and I want to break it into custom number of rows and columns. After that I want to calculate the average amount of pixel values per each block. Since the texture is big it uses a lot of time for C++ to do it and I thought maybe there is a way to do it via GPU (ue4 metrials).

My question is that : how do you break a texture to for example 16 columns and blocks using materials ? additionally I don't know how to make an average of a group of pixel. lets say you have 200 pixels and you want to get the average of their alpha channel.

Product Version: Not Selected
more ▼

asked May 04 '15 at 08:45 AM in Using UE4

avatar image

367 17 20 31

avatar image RimmyD May 04 '15 at 06:16 PM

Not a full answer but thought i would chime in on an approach.

So averaging an area is just shifting the texture around by a number of pixels and averaging it together. You just need to only sample each shifted area in the range you need each time. This could be possible in nodes but i think would lead to a lot of nested Material Functions and large node networks and result in a very set number of rows/columns.

You may want to set this up in the Custom Node where you can do loops, etc in pure shader code but this itself has limitations especially for multiplatform.

avatar image plangton May 05 '15 at 09:30 AM

The problem is that even if I shift the texture ( e.g using a panner ) then still will remain the question of how to add them together. however I found out that if I divide a textcoord by 1 and then assign it to a texture it will mix the value of the pixel mixed. e,g : if half the texture is blue and half is red then the result is a texture of purple. but I cannot be sure if it actually sum the values together ? do you know anything about this solution ?

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

0 answers: sort voted first
Be the first one to answer this question
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