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"

Best way to get average color/brightness values for the current frame?

I'm trying to get a color value which is representative of the color and/or brightness value of the current frame.

I tried pulling the colors of sample pixels from the OS and averaging them using FPlatformMisc::GetScreenPixelColor, but it was extremely slow. Sampling just 100 pixels caused significant hitch of around half a second.

I tried a 2DSceneCapture actor rendering to a very low-res texture, but the results weren't consistent and a this is a VR application I almost certainly can't afford rendering the scene again.

I was thinking that the data for brightness might be available from the AutoExposure post process, but I dug into that and nothing seemed especially applicable - the AutoExposure values tend to hit thresholds and then change dramatically, which makes them unsuitable for this.

I tried the same thing via FViewport::ReadPixelsPtr, but apparently the Viewport is only valid while it's being drawn to, which means I'd need a custom UGameViewportClient to spit out the data as it draws. This is... doable, but I wanted to know if anyone knew of any better options before I take that drastic a step.

Is there a better way of going about doing this? In the "future features" part of the recent 4.11 preview, a "pixel picker" to query the renderer about pixels on demand was mentioned, but it sounded like it was a long ways off.

Thanks.

Product Version: UE 4.10
Tags:
more ▼

asked Mar 26 '16 at 08:33 PM in C++ Programming

avatar image

Teiwaz
639 26 29 57

avatar image aspartamed Jun 28 '17 at 01:14 PM

Did you ever come up with a good 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