Author Topic: Transparency in Meshes / Material Codes  (Read 927 times)

Offline Jurassic

  • Experienced Traveler
  • **
  • Posts: 110
  • Country: de
  • Floof-O-Meter: 8
    • wolfwicks
    • wolfwicks
    • wolfwicks
    • View Profile
Transparency in Meshes / Material Codes
« on: March 27, 2016, 09:55:51 pm »
I'm not sure if this is where I should post this, but, I'm working on an indie-styled map with cartoon textures, grass, trees, sun, etc.

I'm trying to retexture the default grass patch to look like dead grass / a dead bush, and instead of transparency behind the doodle, it's just black, so it looks very blotchy.

The image is a 512x512 .png image, and I made a new .material with the grass's code, but I'm not sure what else to do for this, and if there's a different material code to use. I tried looking around the site, but could only find things about preset transparency. Help?


Code I used looks like this:
Code: [Select]
material Edeadbush
{
transparency_casts_shadows off
receive_shadows off
technique
{
pass
{
diffuse 0.05 0.05 0.05 1
cull_hardware none
cull_software none

alpha_rejection greater_equal 128

texture_unit
{
texture deadbush.png
}
}
}
}

wolfwicks on dA

Preach

  • Guest

Offline Jurassic

  • Experienced Traveler
  • **
  • Posts: 110
  • Country: de
  • Floof-O-Meter: 8
    • wolfwicks
    • wolfwicks
    • wolfwicks
    • View Profile
Re: Transparency in Meshes / Material Codes
« Reply #2 on: March 27, 2016, 10:02:52 pm »
See, that's with presets so I'm not 100% sure it'll work?
I haven't been retexturing for that long, so I'm not too sure.

wolfwicks on dA

Offline Bloo.

  • Space-Child ✌
  • Moderator
  • Elder Grey Pelt
  • *****
  • Posts: 2,657
  • Country: us
  • Floof-O-Meter: 191
  • nyoom
    • Bloopaloozer
    • Bloopalooza FH
    • aLittleProzium
    • Bloopalooza
    • View Profile
    • DeviantArt
Re: Transparency in Meshes / Material Codes
« Reply #3 on: March 28, 2016, 12:03:12 am »
I know exactly what you're going through~ I posted a help thread for this very thing.

Here's the reply I got that helped immediately<3
I believe you have to add the line  "alpha_rejection greater_equal 128" over the texture_unit line so that the code is more like this:

Code: [Select]
material whbl3
{
    technique
    {
        pass
        {
            alpha_rejection greater_equal 128
            texture_unit
            {
                texture 9cdc8b28_D.tga
                filtering trilinear
            }
        }
    }
}

If that doesn't work, I'd try changing the image file to a .png and then trying it. Hopefully this helps!

In the code you provided, there are a few 'enter' spaces or blank lines between the "alpha_rejection" line and the "texture_unit" line.


You are amazing <3

Offline Jurassic

  • Experienced Traveler
  • **
  • Posts: 110
  • Country: de
  • Floof-O-Meter: 8
    • wolfwicks
    • wolfwicks
    • wolfwicks
    • View Profile
Re: Transparency in Meshes / Material Codes
« Reply #4 on: March 28, 2016, 12:16:34 am »
Ah thank you, turns out it was just a faulty image though! All the others worked perfectly fine with this code, except for the dead bush I was using.

wolfwicks on dA

Offline Kerriki

  • Band Geek
  • Immortal Legend
  • *****
  • Posts: 5,670
  • Country: us
  • Floof-O-Meter: 371
  • Who needs furniture when you have the floor?
    • Kikiorylandia
    • View Profile
    • DeviantART
Re: Transparency in Meshes / Material Codes
« Reply #5 on: March 28, 2016, 03:37:12 am »
Locking this since the issue seems to be fixed ^^"
Farewell everyone<3