Home Technical Talk

Pasting into alpha channel photoshop

interpolator
Offline / Send Message
Shrike interpolator
Hey guys, that presentation of the zombie baseball team inspired me to use my textures more efficiently, and I would like to put my gloss and specular in the alpha channels of my diffuses and normals (if they have no transparency of course)



Edit: Found it out, copy paste in photoshop is just confusing to me, gotta select all then paste

Is there any drawback into just pasting my gloss and spec into my normal and diffuse textures ? This seems to be too good to be true, that would cut my texture-sample usage in half if I use a black/white specular, or do i miss something crucial there ?

Replies

  • Farfarer
    Options
    Offline / Send Message
    The textures end up being larger, as the alpha channel is uncompressed.

    But it's pretty much the same memory cost as a new RGB texture for the spec/gloss (16 bits for adding 2 uncompressed alpha channels to existing textures, 16 bits for compressed 5/6/5 bit R/G/B texture).

    But you're right in that it'll save you texture calls if you keep the spec/gloss in the alpha channels.
  • EarthQuake
    Options
    Offline / Send Message
    Yep, when you factor in texture compression, you get absolutely no memory savings unless you can pack 3 greyscale images into 1 24bit image

    1 32bit image (RGB+A) = same size compressed as 2 24 bit images (RGB, RGB)

    So you lose out on specular color for no gain. Its better to use Full color spec with gloss in the alpha, which is the same memory cost.

    Unless you can pack a 3rd texture, then put spec in R, gloss in G, and something else in B (height/displacement map, ao, alpha for transparency, etc).
  • ghaztehschmexeh
    So why do some game engines do this then?
  • Farfarer
    Options
    Offline / Send Message
    There are hardware limits on the amount of texture operations you can do in a single pass, so it can be helpful to minimise that where possible.

    Depending in the hardware I think it's 8 or 16 textures? Possibly more on modern hardware.

    That and it can be helpful for organisational purposes to keep the number of textures down.
  • Shrike
    Options
    Offline / Send Message
    Shrike interpolator
    Ah i see. Well then its a good way for very complex materials, like landscape blending shaders where you are prone to run out of texture samples. If im not mistaken, then 16 is the maximum the API supports because of the way the GPUs are built, but Im really talking half truths here

    Were draw calls calculated per material or per texture sample ? else you could save on draw calls aswell
  • marks
    Options
    Offline / Send Message
    marks greentooth
    Draw calls are usually per shader/material.
  • Farfarer
    Options
    Offline / Send Message
    Draw calls are per shader pass. So in forward rendering, that tends to be one per pixel-shaded light per material per object. In deferred renering, it's generally one per object, and then one per light in the scene. Batching can help optimise that by combining polygons from multiple objects with identical materials together into one object and that can be processed as one mesh rather than several.

    Texture samples are just standard shader operations, they simply add to the cost of the shader (and there's a bunch of factors that can make them faster/slower). Texture calls are essentially the number of different textures that a shader samples.
    e.g. You could sample one texture 50 times, but you couldn't sample 50 textures one time.
Sign In or Register to comment.