Home Technical Talk

attempting a texture with alpha using 1 texture

sir-knight
polycounter lvl 10
Offline / Send Message
sir-knight polycounter lvl 10
Hey guys, using max8 I'm trying to do the following.

I am attempting to billboard a tree texture onto a plane. I know with 2 separate maps, a diffuse and an opacity I can get the effect I'm looking for. However I have need to export the alpha data on the same texture as the diffuse map, is this possible using a single PNG?

I have exported my texture from photoshop as a 8 bit png with transparent color where I need transparent, and set alpha source to image alpha in the bitmap parameters. This didn't seem to work, my alpha shows as white.

I have also exported as a 24 bit png with transparency and separately with an alpha channel and get the same results.

Is this the method I should be chasing, or can it be done this way?

Replies

  • Rick Stirling
    Offline / Send Message
    Rick Stirling polycounter lvl 18
    Can you see that the alpha works in any other package? Once you know the alpha is good, you can get to max.

    Max is a bit of a bugger in how it's alphas work - to get it to work in the viewport you need to put the image with alpha into both the diffuse and opacity slots.
  • sir-knight
    Offline / Send Message
    sir-knight polycounter lvl 10
    I have no way to check at my desk in another 3d app. I've handed it off the developer to see if the 8bit png with alpha works on device.

    Good to know about max... I thought I was retarded or something looking for settings that aren't there :P
  • Eric Chadwick
    Max doesn't support 8bit transparency, ala GIF's palette 0 color. I guess 8bit PNG uses the same method?

    Also, in the Opacity slot you have to set the radio buttons to the left of the Image Alpha section to mono/alpha (or whatever they're called). Then to see it in the viewport you have to press "Show Map in Viewport" at the material level, not at the bitmap level.
  • ImSlightlyBored
    Offline / Send Message
    ImSlightlyBored polycounter lvl 13
    [ QUOTE ]

    I have also exported as a 24 bit png with transparency and separately with an alpha channel and get the same results.


    [/ QUOTE ]
    I always thought the only true way to get transparencies on png files is 32 bit - RGBA with 8 bits per channel?

    Might be wrong, and sorry I can't help
  • Ghostscape
    Offline / Send Message
    Ghostscape polycounter lvl 13
    use a 32 bit targa file. Max doesn't support alphas in a variety of model formats. It also has issues with the top and right pixels of an alpha texture with some formats (possibly all of them), and will always make them fully transparent, meaning tiling an alpha texture won't look right.
  • sir-knight
    Offline / Send Message
    sir-knight polycounter lvl 10
    I can't use a tga for export to cellphones
  • Rob Galanakis
    My suggestion is to get an old version of SuperPNG to export your PNG's with actual alpha, as opposed to using the very stupid way Photoshop deals with PNG transparency (or you can try Gimp). You can look on the 'net or I can upload the version I have at work to my site since I don't remember where I got it (newer versions don't support alpha channels like the old ones do).
  • Rick Stirling
    Offline / Send Message
    Rick Stirling polycounter lvl 18
    You can test if the alpha works by viewing it in a web browser (don't use IE prior to version 6) - I should have made it clear that I meant any program capable of viewing PNG alpha, not any 3d package.
  • sir-knight
    Offline / Send Message
    sir-knight polycounter lvl 10
    I'm pretty sure there is the 1 alpha color on the palette when the png came out of photoshop, just not sure if it is completely supported in the 3d space. Since max didn't do it I was afraid you can't use png with alpha as a texture map.
  • Eric Chadwick
    It might just be that your game exporter and game support it fine, but Max does not.

    If you're concerned about previewing the art before export, then use a different bitmap format like TGA, replacing it with PNG before export.

    Blur Studios has a handy script called Change Bitmaps that makes it a snap to replace all .TGA files with .PNG (or any other rename you need).
  • Kovac
    Offline / Send Message
    Kovac polycounter lvl 18
    Just in case anyone did want it, I uploaded the old version of superPNG that has support for alpha in photoshop/max... it's worked like a charm for me since I've started using it.

    superpng.rar - 0.07MB

    Make sure ya delete (or backup outside of your photoshop directory) your old .PNG format in Plug-Ins\File Formats or it won't work properly.
  • Sage
    Offline / Send Message
    Sage polycounter lvl 19
    Pngs seem to work fine with alphas.

    This is how I got max to display them in the past

    png creation in photoshop

    The easiest way is to have your trasparent bits in a layer with nothing. If it's a plant make your layer. In that layer paint your plant and have no pixels where the transparent sections are supposed to go. Save as Png that's it. In max your load your image in diffuse, then drag and drop to your opacity as a copy not an instance. go into the opacity options, alpha should be turned on by default this is found in the alpha source section, if not turn it on and then you have to make sure mono channel output is set to alpha intensity.

    If you go the standard black and white route in the alpha channel you do the same. Png doesn't seem to need that to work though so you might get a smaller file without having an alpha channel just keeping the rgb instead of rgba. The default transparent color is white, or some color that appears to be white. In CS2 with the method above you don't seem to have to do any voodoo to get this to work, as in I just did a save as instead of trying to set things with the export for web dialog.

    I'm assuming that everything is a plane and typical opacity cut out deal. If for example your tree trunk was modeled and you were using a texture sheet to map your leaves and tree trunk and easy way to get everything onto a layer would be to copy your texture as you have, paint an alpha. Load your selection from your alpha, inverse it since i think it picks the white sections, and hit delete. The result would be that where you want the transparent area it would be empty. Save as png.

    Keep in mind I have not done this for mobile phones so it may or may not work. You might have to go rgba instead of having empty sections in your texture.

    Alex
  • sir-knight
    Offline / Send Message
    sir-knight polycounter lvl 10
    no that's the way to get transparency in pngs with CS2, I've been doing that with the rest of the 2d assets for the phones up to this point, so the method I'm getting the pngs is not in question. I'll have to wait till our dev guy on the project drops it into our game engine.
  • Sage
    Offline / Send Message
    Sage polycounter lvl 19
    Sir-knight just so you know Max sees the PNG as having an alpha with both methods so that's why I mentioned it. I also had to texture some models for the ogre3d with pngs and tried both methods. The alphas worked fine but the z sorting was messed up but that was a different issue. So yeah it worked outside of photoshop.

    Alex
  • sir-knight
    Offline / Send Message
    sir-knight polycounter lvl 10
    cool alex, if it sees the alpha, then why won't it render with the alpha properly? it's just showing up as whatever color is the alpha color on the palette when I use just a diffuse map. My developer insists he can only load 1 map per texture so I can't use an opacity map.
  • Ghostscape
    Offline / Send Message
    Ghostscape polycounter lvl 13
    [ QUOTE ]
    cool alex, if it sees the alpha, then why won't it render with the alpha properly? it's just showing up as whatever color is the alpha color on the palette when I use just a diffuse map. My developer insists he can only load 1 map per texture so I can't use an opacity map.

    [/ QUOTE ]

    Can you make a quick test png using the same settings you used for your game art one and upload that?

    can you view the alpha of the png in any image-viewing programs?
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    thanks a lot for that superPNG thing, total life saver.

    I found another more easy/official download link for it, over at evil garagegames.
    http://www.garagegames.com/developer/torque/artist/

    on topic, irfanview can show alpha 0 as transparent, sadly only hard testing, no soft blends, nor dedicated view of the alpha channel.
Sign In or Register to comment.