Feral Heart

Help & Guidance => Game Help => Topic started by: Jurassic on March 27, 2016, 09:55:51 pm

Title: Transparency in Meshes / Material Codes
Post by: Jurassic 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
}
}
}
}
Title: Re: Transparency in Meshes / Material Codes
Post by: Preach on March 27, 2016, 09:57:35 pm
Maybe this thread will help?

http://www.feral-heart.com/index.php?option=com_jfusion&Itemid=2&jfile=index.php&topic=5665.0 (http://www.feral-heart.com/index.php?option=com_jfusion&Itemid=2&jfile=index.php&topic=5665.0)
Title: Re: Transparency in Meshes / Material Codes
Post by: Jurassic 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.
Title: Re: Transparency in Meshes / Material Codes
Post by: Bloo. 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.
Title: Re: Transparency in Meshes / Material Codes
Post by: Jurassic 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.
Title: Re: Transparency in Meshes / Material Codes
Post by: Kerriki on March 28, 2016, 03:37:12 am
Locking this since the issue seems to be fixed ^^"