surface.SetDrawColor() doesn't affect surface.DrawTexturedRect?

For some reason, I am unable to modify the color/alpha of my images with surface.SetDrawColor, before I draw them with surface.DrawTexturedRect.

Is anyone aware of incompatibilities with custom made VTFs?

post your VMT

Here’s an example. I would have replied faster, but it seems FP’s email system is down.

“$translucent” 1
“$ignorez” 1
“$vertexcolor” 1
“$vertexalpha” 1

These are pretty much standard values on HUD textures

I edited my VMT files, although that didn’t quite fix it. Do I need to do something to the VTF files as well?

And will UnlitGeneric be ok?

Anything at all?

can’t do much without it lol

Keep in mind that I’ve modified the VMT since then. Changes are also posted in this thread.

Bump :S

Post your vmt like the guy said.

I attached it, but fine, here it is:



"UnlitGeneric"
{
	"$basetexture" "damage/bodyoutline"
	"$translucent" 1
	"$vertexalpha" 1
	"$vertexcolor" 1
}


Post your VTF. Making colourables textures is sometimes ambiguous. You may have messed up your primary RGB channel.

On your VTF, the RGB channel usually may contain black and white data. (R = G = B), that’s not forced but I’d put that case so that you can get it.

Not that I’m not sure what I’m talking about because I haven’t pushed the tests too far.
Your primary RGB channel defines what is colourable and what is not.
If a pixel tends to white, then it is colourable : will be replaced by your color.
If a pixel tends to black, then it is going to be black no matter what the color is.
If a pixel is gray, then the pixel will be a shade of dark from your base color.

The alpha channel defines the transparency of the texture. Independant to color.
White is opaque, black is translucent as usual.
If somewhere is gray in the alpha channel, you can have in the same position a white in the RGB channel : This will keep the true color (otherwise it would be a shade of gray + translucency which may look bad). So don’t copy your alpha channel to your RGB channel.

If you want all the texture to be colorable, let alpha channel define the shape, then let RGB channel be white.

I’ve only been using Paint.NET, afaik, it doesn’t deal with these “channels”. The only way that I know parts of my picture are transparent is if I can see the true background of the canvas.

I’m pretty sure most browsers don’t support displaying VTFs, so please see post #3 :slight_smile:

Bump…

So any ideas as to why I’m unable to run that particular command on any of my textures?

As was mentioned at least three times, your material file is wrong or you’re doing something wrong.

It’s obvious something is wrong, but what?

So is there something I can do, or should I just install Photoshop? (I have PS 7 laying around somewhere.)

And if I tell you I gave you the answer, and actually I gave you the correct answer.

I got bored. So I opened your file you could have opened yourself.

Your material file works. Your texture file isn’t. I’m not going to help you. I already gave you the answer. Actually surface.SetDrawColor() is working. It is currently coloring the border of your texture. The border of your texture is half-transparent. surface.SetDrawColor() is able to color the border of your texture because your RGB channel has white at the points where the alpha channel bears half-transparency. The alpha-opaque contents of your RGB channel is black though. That means the opaque parts of your texture as seen from your alpha channel are uncolourable.

Get that fixed yourself. Read my post above, it contained every single detail about how you should construct your RGB and Alpha channel.

Again, AFAIK, Paint.NET doesn’t deal with channels, like Adobe PS does. (I’m assuming that’s what you’re using.)

It seems like that wasn’t the problem anyways - problem was solved by adding “$additive” 1 to my VMT file.

For anyone else who may have this problem, here’s what my file looks like now:



"UnlitGeneric"
{
	"$basetexture" "damage/bodyoutline"
	"$translucent" 1
	"$vertexalpha" 1
	"$vertexcolor" 1
	"$additive" 1
}


Thank you all for your help anyways.