K
K
key don2016-05-04 02:40:19
OpenGL
key don, 2016-05-04 02:40:19

How to turn images without alpha channel (black as alpha) into an image with alpha channel?

There is a bmp image with black color as transparency, no alpha channel. For example, clouds visibleearth.nasa.gov/view.php?id=57747
Previously, I added the texture color with a translucent color. It turned out transparency instead of black (conditionally 0 0 0), gray translucency (100,100,100) and white opacity (255 255 255) on the texture.
Opengl 2:
glColor4f(0.0f, 1.0f, 1.0f, 0.75f);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, clouds);
Now I overlay the texture already with alpha (png), because the previous method does not work correctly with lighting, the current one correctly illuminates everything.
Question: how can I achieve the same effect in a graphical editor (i.e. make a transparent png from bmp with black color, whose transparency will be determined by its proximity to black). For example in the same photoshop.
Or the opposite question: what can be done with the lighting so that the previous crutches with bmp are illuminated correctly? I am just mastering lighting, but I would like to get rid of crutches and solve the first question.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Neron, 2016-05-04
@keydon2

1) Convert bmp to grayscale.
2) Create a document with dimensions like bmp.
3) Create a layer.
4) Create a layer mask.
5) Copy the grayscale bmp and paste it into the layer mask.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question