Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3759566
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:20:11+00:00 2026-05-19T10:20:11+00:00

The following is an implementation of an overlay blend algorithm in GLSL, drawn from

  • 0

The following is an implementation of an overlay blend algorithm in GLSL, drawn from the OpenGL Shading® Language, Third Edition:

19.6.12 Overlay

OVERLAY first computes the luminance
of the base value.

If the luminance value is less than
0.5, the blend and base values are multiplied together.

If the luminance value is greater than
0.5, a screen operation is performed.

The effect is that the base value is
mixed with the blend value, rather
than being replaced. This allows
patterns and colors to overlay the
base image, but shadows and highlights
in the base image are preserved.

A discontinuity occurs where luminance
= 0.5. To provide a smooth transition, we actually do a linear blend of the
two equations for luminance in the
range [0.45,0.55].

float luminance = dot(base, lumCoeff);

if (luminance < 0.45)

    result = 2.0 * blend * base;

else if (luminance > 0.55)

    result = white - 2.0 * (white - blend) * (white - base);

else {

    vec4 result1 = 2.0 * blend * base;
    vec4 result2 = white - 2.0 * (white - blend) * (white - base);
    result = mix(result1, result2, (luminance - 0.45) * 10.0);

}

How would I implement something similar in OpenGL ES 1.1 (targeting the iPhone 3G), without using shaders? Can I use a blend function or texture combine to implement this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:20:11+00:00Added an answer on May 19, 2026 at 10:20 am

    For the purposes of leaving an answer on the record and supposing there are no further optimisations you can make, you could:

    1) Load luminance value into the alpha channel

    Set up a framebuffer object, the same size as the original texture. Use glColorMask to enable or disable writing to different channels. First of all, enable red, green and blue channels and disable the alpha channel. Draw the texture normally. This will duplicate the texture’s colour information.

    Then enable the alpha channel and disable the red, green and blue channels. Use the dot3 extension (which has been supported on the iPhone since the beginning) to fill the target alpha channel with luminance values.

    2) Split the texture into three textures, based on luminance

    A simple scheme would be just to split at luminance = 0.5 and ignore the linear blend. If you were to do that, you could again use framebuffer objects to split a texture on the GPU. This time use the alpha function (glAlphaFunc and be sure to enable it) to pass all those areas with an alpha greater than 0.50 when drawing to one texture, to pass all those features with an alpha less than 0.50 when drawing to another.

    Although you can do only one alpha test per pixel, meaning that you can’t separate out the range 0.45 to 0.55 in a single step, you could do that in two steps.

    3) Use normal blend modes to composite the two or three textures onto your framebuffer

    You can subvert the lighting system to offset and scale the alpha channels during rendering if necessary.


    Obviously you’d optimise by performing those steps that are identical every draw just once, at startup. Which probably means permanently storing what is currently one texture as two or three.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code for factory design pattern implementation. class Pen{ public: virtual
Following on from my recent question on Large, Complex Objects as a Web Service
Following on from this question what would be the best way to write a
Following techniques from 'Modern C++ Design', I am implementing a persistence library with various
Following on from the question asked by Mykroft Best way to handle input from
I have the following implementation of HttpSessionlistener public class SessionListener implements HttpSessionAttributeListener, HttpSessionListener {
Is the following implementation, using lazy initialization, of Singleton (Meyers' Singleton) thread safe? static
I have the following implementation: As you can see I have a repeater (listing
I have an NSWindowController subclass called _PreferencesWindowController with the following implementation - @synthesize window;
I am trying to update my UITableView and the following implementation is not working.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.