Home Technical Talk

[3dsmax] Picking an specific RGB color for transparency?

polycounter lvl 16
Offline / Send Message
Minos polycounter lvl 16
Hello guys

I'm working on a low end game (DS) and we use indexed bitmaps for textures, where the first color slot is used by the engine as 100% transparent.

Is there any way to configure the opacity slot in max to use an specific RGB color as transparency?

I'm really tired of creating 1-bit alpha maps only for viewing my textures properly in the viewport, it's a bit annoying.... if anyone knows any other workarounds please let me know.

thanks in advance =)

Replies

  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    why not setting the background color in max to your desired RGB 24bit color ?
    that way you can use the composite renering as masked image in your engine.

    As for aliased edges towards the background (in case you don't know yet) check this one:
    dontantialias.jpg
  • Minos
    Offline / Send Message
    Minos polycounter lvl 16
    renderhjs wrote: »
    why not setting the background color in max to your desired RGB 24bit color ?
    that way you can use the composite renering as masked image in your engine.

    As for aliased edges towards the background (in case you don't know yet) check this one:
    dontantialias.jpg

    hmm thanks renderhjs but that's not what I'm looking for.

    We have to use indexed .bmps for our textures (remember it's a DS game) and our engine uses the first slot in the pallette for 1 bit transparency. There are multiple objects in the scene, so setting the background to my transparency color won't do it.

    I'm basically trying to find a way (or a plugin) which allows me to use the same .bmp for both diffuse and opacity, and tell max to use the first color in the pallette for 100% transparency. (I always use the same RGB value for this, 255 0 255)

    Since this is a common feature in many engines (I remember goldsrc had a similar system for transparency) there must be a workaround somewhere to do that on max.
  • danr
    Offline / Send Message
    danr interpolator
    yep, if you always use the same colour :

    drop an RGB Tint material in the opacity slot, and for magenta (255 0 255) set the colours to
    r - black
    g - white
    b - black
  • Mark Dygert
    If you turn on "don't alias against the background" it will render everything 100% opaque and nothing will be transparent.
  • Minos
    Offline / Send Message
    Minos polycounter lvl 16
    danr wrote: »
    yep, if you always use the same colour :

    drop an RGB Tint material in the opacity slot, and for magenta (255 0 255) set the colours to
    r - black
    g - white
    b - black

    hmm that should work in theory but it's not working.

    I noticed that if one of the RGB slots in RGB Tint is set to white the entire texture gets opaque, while if you set them to gray/black it turns transparent :(
  • Mark Dygert
    Try setting the tint to:
    r-white
    g-black
    b-white
    Then in the map go into output, and check on invert. That seems to work for me.
  • Minos
    Offline / Send Message
    Minos polycounter lvl 16
    Vig wrote: »
    Try setting the tint to:
    r-white
    g-black
    b-white
    Then in the map go into output, and check on invert. That seems to work for me.

    Still nothing... Maybe I'm being stupid here but all I get is a transparent line where my texture tiles. Here, I made an example texture:

    4207559071330bb509e54416502dc0e203fbaae.jpg
  • Ghostscape
    Offline / Send Message
    Ghostscape polycounter lvl 13
    Minotaur0 wrote: »
    Still nothing... Maybe I'm being stupid here but all I get is a transparent line where my texture tiles. Here, I made an example texture:

    4207559071330bb509e54416502dc0e203fbaae.jpg

    That is an issue with max's .bmp display, not your UVs. It doesn't tile them correctly. It sucks.

    I think there is another format or two that has that issue as well (.png?). .tgas are the best to work with, IIRC.
  • danr
    Offline / Send Message
    danr interpolator
    minotaur0 - make sure you're displaying end result of the material (checkered cube icon at the top level of the material) and set the viewport transparency to "best"

    haven't got max in front of me, but it should just ... work
  • Minos
    Offline / Send Message
    Minos polycounter lvl 16
    danr wrote: »
    minotaur0 - make sure you're displaying end result of the material (checkered cube icon at the top level of the material) and set the viewport transparency to "best"

    haven't got max in front of me, but it should just ... work

    Thanks man, I'll try that!

    Ghostscape: Yeah I hate .bmps as well but it's an engine specification (remember, its a DS game =))
  • danr
    Offline / Send Message
    danr interpolator
    BMPs, gaaaah ... ask your coders to look into the nns_tga format. There's a photoshop plugin you can download from warioworld so you can play with it. It gives you the best possible control over alphas and colour depth, all specifically tailored for the ds hardware
  • Minos
    Offline / Send Message
    Minos polycounter lvl 16
    danr wrote: »
    BMPs, gaaaah ... ask your coders to look into the nns_tga format. There's a photoshop plugin you can download from warioworld so you can play with it. It gives you the best possible control over alphas and colour depth, all specifically tailored for the ds hardware

    I've used nns_tga's before and got some nasty artifacts on my textures. I went for a "pixel art" look, so all my textures were around 8x8 - 16x16 most of the time, so no need for compressed textures. They work great for bigger textures though (64x64, 128x128)

    I actually used only about 60% of the available vram I had for my scene.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    I looked at the composite material where you can tweak and define layers
    http://www.cgnewspaper.com/load/images/feature2008/max09/max9-colormap.jpg
    and it lets you tweak booth alpha and RGB apart. Maybe there is a way through blend modes to filter out a specific RGB color.
    Once that is figured out it could be automated by using maxscript and reading out the initial bitmap and within that file the first color in the palette. That color will then be used in the other part.

    I did not succeeded yet but it might be worth a try
  • Minos
    Offline / Send Message
    Minos polycounter lvl 16
    renderhjs wrote: »
    I looked at the composite material where you can tweak and define layers
    http://www.cgnewspaper.com/load/images/feature2008/max09/max9-colormap.jpg
    and it lets you tweak booth alpha and RGB apart. Maybe there is a way through blend modes to filter out a specific RGB color.
    Once that is figured out it could be automated by using maxscript and reading out the initial bitmap and within that file the first color in the palette. That color will then be used in the other part.

    I did not succeeded yet but it might be worth a try

    Hmm I'm using Max 9, my composite maps look quite different than that =(
  • Mark Dygert
    Yea 2008 they upgraded the composite map to actually be useful.
  • kio
    Offline / Send Message
    kio polycounter lvl 16
    Minotaur0 wrote: »
    I've used nns_tga's before and got some nasty artifacts on my textures.

    just dont use the stupid texel compression - i just finished a whole title with extensive use of the nns_tga, it works like a charm if you work with the limitations in mind.

    you just have to export them correctly from photoshop that max has an alpha channel to work with, as the nns stuff is just in the tga header..

    read the documentation, its rather usefull - the whole 3d tool stuff for ds is quite mature.
Sign In or Register to comment.