Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


What program to use to add alpha


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 viper110110   Members   -  Reputation: 691

Like
1Likes
Like

Posted 24 September 2013 - 07:58 AM

I want to use the alpha channel to add height data to my textures. I am currently getting textures online and then using paint.net to convert them to DDS. Problem with paint.net is that I can't set the alpha to zero while maintaining the RGB data. It also makes editing a pain if I want to make changes. I can calculate the height on the fly based on the average of the rgb, but I would prefer to use an actual map so that I can adjust the values myself.



Sponsor:

#2 eppo   Crossbones+   -  Reputation: 2546

Like
4Likes
Like

Posted 24 September 2013 - 11:38 AM

Most Image editors let you interpret an image's alpha-channel as a (paintable) greyscale image. I know Gimp, Photoshop and Photo-Paint allow you to do this.

 

Another method is to create a separate greyscale image that serves as an alpha-channel. You can use the DirectX Texture Tool to load the image into the alpha-channel of an RGBA image to combine the two.



#3 viper110110   Members   -  Reputation: 691

Like
2Likes
Like

Posted 24 September 2013 - 12:10 PM

Another method is to create a separate greyscale image that serves as an alpha-channel. You can use the DirectX Texture Tool to load the image into the alpha-channel of an RGBA image to combine the two.

I like this one. I want to be able to manipulate the range of the heights that I am generating.



#4 Kryzon   Prime Members   -  Reputation: 3248

Like
3Likes
Like

Posted 24 September 2013 - 02:00 PM

Get the GIMP, it has several tools to deal with Alpha Channels and Transparency (some of which even Photoshop doesn't have).

http://docs.gimp.org/en/gimp-layer-transparency-menu.html

 

When you open an image most of the time it won't contain an alpha channel (and this is a per-layer property), so you need to right-click your layer thumnail and choose "Add Alpha Channel" so that that layer can be semi-transparent wherever you erase it, if you want to. 

 

It can add alpha to a layer based on a certain color. "Layer -> Transparency -> Color to Alpha" will make every pixel of your layer transparent depending on how much it does not contain the reference color you specified.

If you do this on a grayscale image and set the reference color to black, it will make all pixels transparent according to their value, with black being fully transparent and white opaque.

 

You cannot edit the global alpha channel of the image like you can in Photoshop, and I think this is unfortunate. You can, however, edit the alpha channel of every individual layer.

You right-click on a layer thumbnail, and from the context menu choose "Add Layer Mask", and choose the option to initialize it to white (fully opaque). You can now paint in grayscale in this mask buffer to define the visibility of the layer this mask belongs to. You can also use the color value tools on this mask buffer (like "Levels", "Brightness & Contrast" etc.).

When you're done, you can right-click the layer thumbnail and choose "Apply Layer Mask" to "bake" the mask as transparency information in your layer buffer.


Edited by Kryzon, 24 September 2013 - 02:08 PM.


#5 vlasta   Members   -  Reputation: 150

Like
1Likes
Like

Posted 25 September 2013 - 08:39 AM

Zeroing out the colors when alpha is 0 can sometimes be handy as fully transparent pixels are usually not useful. But in your case, when you are using the alpha channel for something else than transparency, I can see that this optimization it can be a pain.

 

Anyway, do you need to compute the alpha values from the rgb channels of the current image, or are you using a different image as a source? I am asking because I am an author of a freeware image editor and knowing the needs of the users is useful for me and because maybe my software could be useful for your case. You can access pixels using JavaScript and easily compute and set your custom alpha if everyting falls in place.



#6 Kryzon   Prime Members   -  Reputation: 3248

Like
1Likes
Like

Posted 25 September 2013 - 11:36 PM


I am asking because I am an author of a freeware image editor and knowing the needs of the users is useful for me and because maybe my software could be useful for your case.

If I were you, I would try to implement a basic script dialect to express operations to be made per-pixel, even if it's simple mathematical expressions on top of the original RGB channels' values.

This way you can accommodate for almost any need a user may have. The user can program the operations he wants.

 

It's the idea behind FilterFoundry for Photoshop: http://thepluginsite.com/knowhow/ffpg/ffpg.htm#1

It's a bit also what the SVG standard allows you to do by chaining filters: http://www.w3.org/TR/SVG/filters.html


Edited by Kryzon, 25 September 2013 - 11:41 PM.


#7 viper110110   Members   -  Reputation: 691

Like
1Likes
Like

Posted 26 September 2013 - 12:39 AM


do you need to compute the alpha values from the rgb channels of the current image, or are you using a different image as a source?

 

I am somewhat basing it off the current image. I basically want to take the current image and then stretch the range of values to be full 0-255. That way a dark texture won't always fall below a light texture. The current best way for me seems to be to use paint.net to convert to greyscale, adjust the range manually based on the histogram, then save the greyscale image and import both into the directx texture tool.



#8 vlasta   Members   -  Reputation: 150

Like
1Likes
Like

Posted 26 September 2013 - 01:23 AM

In that case, I think my editor can help you. You can get it at http://www.rw-designer.com/image-editor There is also a portable version that you can just unzip and run.

 

Once you open an image, go to menu Effect->Custom operation and paste this code into the box:

// create temporary copy
var dup = Document.Duplicate();

// make copy grayscale
Operation.Execute(
    Operation.Create("Raster Image - Grayscale"),
    dup);

// streatch values to full 0-255 range
var ac = Operation.Create("Raster Image - Automatic Contrast");
ac.Tolerance = 0;
Operation.Execute(ac, dup);

// move red values from the copy to the alpha of the original
var dst = Document.RasterImage;
var src = dup.RasterImage;
var sizeX = dst.sizeX;
var sizeY = dst.sizeY;
for (x=0; x<sizeX; ++x)
    for (y=0; y<sizeY; ++y)
        dst.SetPixelAlpha(x, y, 0, 0, src.GetPixelRed(x, y, 0, 0));

It should do what you have described. The last loop is kind of lame and if it is too slow for you, it can be replaced by some other code that does the operations faster, but it would be less readable. Some info about scripting in the editor can be found at http://www.rw-designer.com/javascript-operation

 

Also, I have an unfinished DDS codec for the editor. If you need one of the DDS uncomressed formats, I can give you access to it.

 

Kryzon, I currently have the options for running filters or manipulating colors in JavaScript. It is true that for fast, custom, per-pixel operations, neither of these methods is ideal. I'll look into the alternatives, but it seems quite difficult to come with a method that would deliver both flexibility and speed.



#9 3Ddreamer   Crossbones+   -  Reputation: 3159

Like
1Likes
Like

Posted 26 September 2013 - 02:07 PM

GIMP is probably the second best overall for Alpha channels, some argue the best, but it is no cost.  Almost everything that you need is in GIMP and chances are it is all that you will ever need for Alpha issues.

 

 

Clinton


Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#10 riuthamus   Moderators   -  Reputation: 5645

Like
2Likes
Like

Posted 09 October 2013 - 08:42 AM

i use photoshop. For alphas that need to be crisp I normally create an empty back layer with the color tone matching the edge ( this is used to make alphas work def rendering ). To get the alphas to display correctly for SRGB you have to use a different save file. I used super PNG. I have several threads about this because we were having issues. Photoshop is my weapon of choice though, assuming you have the cash for it.

 

SuperPNG

http://www.fnordware.com/superpng/


Edited by riuthamus, 09 October 2013 - 08:42 AM.


#11 Orymus3   Crossbones+   -  Reputation: 10195

Like
1Likes
Like

Posted 13 October 2013 - 09:13 AM

Gimp is great. and free... and open-source...






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS