Author Topic: transparent code/image not working?  (Read 1563 times)

Offline parler

  • Forum Newcomer
  • *
  • Posts: 3
  • Floof-O-Meter: 0
    • View Profile
transparent code/image not working?
« on: July 07, 2012, 04:42:29 pm »
i cannot, for the life of me, figure out what i did wrong. i know the common errors are that not all of the code matches the preset number (like preset_5body.png), or that the image isn't a .png file. however, my file is a .png file and i've gone through my code over and over to make sure i didn't make a dumb mistake. every time i export the file, though, nothing changes at the preset stays white. ):

here's the code:
Code: [Select]
material preset_5_bodyMatL
{
      receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     [size=10pt][size=10pt][size=10pt]scene_blend [/size][/size][/size]alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture transparentbody.png
                         tex_address_mode wrap
                         filtering trilinear
         }
      }
   }
}
         texture_unit
         {
            texture transparentbody.png
         }
      }
   }
}

material preset_5_bodyMatR
{
   receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_5body.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_5body.png
         }
      }
   }
}

material preset_5_headMatL
{
        receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_5head.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_5head.png
         }
      }
   }
}

material preset_5_headMatR
{
  
        receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_5head.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_5head.png
         }
      }
   }
}
material preset_5_eyeMatL
{ receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_5eye.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_5eye.png
         }
      }
   }
}

material preset_5_eyeMatR
{
    receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_5eye.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_5eye.png
         }
      }
   }
}

material preset_5_tailMat
{
   receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_5tail.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_5tail.png
         }
      }
   }
}

material preset_5_maneMat
{
   technique
   {
      pass
      {
         lighting off
         cull_hardware none
         cull_software none
         scene_blend alpha_blend
         depth_write off
         texture_unit
         {
            texture preset_5mane.png
         }
      }
   }
}

the image name i'm using is "transparentbody." it's only partially transparent, but i don't think i need a different code for that, do i? if i do, could somebody please link me to it or paste it here? i'm desperate ; o ;

feralheartdog

  • Guest
Re: transparent code/image not working?
« Reply #1 on: July 07, 2012, 05:01:08 pm »

Hmm...The first line...it usually for me is:

material preset_5bodyMatL (Unless I am wrong)


I will check if there is another code.

*Edit*
From HappyShadow on DA:


This is a simple script, you need to save your texture as png,and with transparent spots. With this script, your texture transparent parts wont be white anmore,yaay! :D
 To make it work,add a new row above texture_unit and paste alpha_rejection greater_equal 128 in it. like that:
Code: [Select]
material preset_(FOLDER NUMBER)_(BODY PART)Mat
{
 technique
 {
 pass
 {
 alpha_rejection greater_equal 128
 texture_unit
 {
 texture (your texture).png
 }
 }
 }
}
 

And I am guessing this is the one you used?

Code: [Select]
material preset_8_bodyMatL
{
      receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_8body.png
                         tex_address_mode wrap
                         filtering trilinear
         }
      }
   }
}
         texture_unit
         {
            texture preset_8body.png
         }
      }
   }
}
material preset_8_bodyMatR
{
   receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_8body.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_8body.png
         }
      }
   }
}
material preset_8_headMatL
{
        receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_8head.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_8head.png
         }
      }
   }
}
material preset_8_headMatR
{
  
        receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_8head.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_8head.png
         }
      }
   }
}
material preset_8_eyeMatL
{ receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_8eye.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_8eye.png
         }
      }
   }
}
material preset_8_eyeMatR
{
    receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_8eye.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_8eye.png
         }
      }
   }
}
material preset_8_tailMat
{
   receive_shadows on
   technique
   {
      pass
      {
                     ambient 1.000000 1.000000 1.000000 1.000000
                    diffuse 1.000000 1.000000 1.000000 1.000000
                     specular 0.050000 0.050000 0.050000 1.000000 12.500000
                     emissive 0.000000 0.000000 0.000000 1.000000
                    cull_hardware none
                     cull_software none
                     scene_blend alpha_blend
             alpha_rejection greater_equal 128
                     texture_unit
         {
            texture preset_8tail.png
                         tex_address_mode wrap
                         filtering trilinear
         }
            texture preset_8tail.png
         }
      }
   }
}
material preset_8_maneMat
{
   technique
   {
      pass
      {
         lighting off
         cull_hardware none
         cull_software none
         scene_blend alpha_blend
         depth_write off
         texture_unit
         {
            texture preset_8mane.png
         }
      }
   }
}


From HappyShadow on DA:

1) My preset texture is white!

 Almost all time what happens is that you did not named the texture with the same name you wrote in the material file. Capitalisation matters here. so bUtts.png is different from butts.png.
 Texture and material file must be in the same folder. The folder number in the material file must match with the folder number where the file is stored.

« Last Edit: July 07, 2012, 05:15:23 pm by Shanith »

Offline parler

  • Forum Newcomer
  • *
  • Posts: 3
  • Floof-O-Meter: 0
    • View Profile
Re: transparent code/image not working?
« Reply #2 on: July 07, 2012, 05:03:10 pm »
okay, thank you! i'll see if that works and edit my post later.

edit or not? i saw you struck out your suggestion..

feralheartdog

  • Guest
Re: transparent code/image not working?
« Reply #3 on: July 07, 2012, 05:10:27 pm »
I did, because I think I was thinking 'bout something else. I will post more transparent codes, if there are any more in my post.

Offline parler

  • Forum Newcomer
  • *
  • Posts: 3
  • Floof-O-Meter: 0
    • View Profile
Re: transparent code/image not working?
« Reply #4 on: July 07, 2012, 05:15:05 pm »
no, no, the code from happyshadow was exactly what i needed! thank you so much! ; u ; i'm so happy, ahhhh. thank you, thank you, thank you!

feralheartdog

  • Guest
Re: transparent code/image not working?
« Reply #5 on: July 07, 2012, 05:17:03 pm »
You are very welcome!
I am glad I could help you out.
If you need help on anyhting else, you can message me.