0
$\begingroup$

I'm trying to make a semi-transparent texture for a car wheel.

Here is the base texture I use:

Rim Texture

And here's my shader:

Rim Shader

Here's how it's supposed to work: it picks out the magenta pixels and uses the opposite of that to set the final material's alpha. Meanwhile, the color is defined with a mix between a customizable flat color and the texture's color, using the texture's alpha as the factor.

Here's how the transparency is supposed to look like. This is before I plug the texture alpha into the color mix as the factor, with the blend mode set to alpha clip.

enter image description here

But when I plug the texture alpha into the color mix, it looks like this:

enter image description here

It looks like whenever I try to use the texture alpha channel for data, it overrides whatever transparency I'm trying to set. What am I missing here? Can you please help me?

$\endgroup$
3
  • $\begingroup$ Hi :). Why not simply use a BW texture? Anyways, consider sharing the file, so others can take a look ;) pasteall.org/blend $\endgroup$ Apr 5, 2022 at 20:35
  • 1
    $\begingroup$ I wanted to keep all the data I need on a single small texture. It's for a video game and I want semi-transparency, a customizable base color and colored inserts all packed on a single RGBA texture. Anyways, Here it is $\endgroup$
    – user46965
    Apr 5, 2022 at 20:57
  • $\begingroup$ 1) When you have a PNG in RGBA format why don't you use the alpha mask from the alpha channel for transparency as it is supposed? 2) You can connect the Alpha slots of the Image Texture node and the Principled BSDF. The Transparent + Mix Shader setup was needed in the early 2.8 versions of Blender when the Principled BSDF did not have an Alpha input slot. $\endgroup$
    – Blunder
    Apr 5, 2022 at 23:42

2 Answers 2

0
$\begingroup$

Using magenta as a color to represent transparency does not work well unless you are using closest interpolation and do not anti-alias the texture. This approach works alright for pixel art, but I don't think it is the best choice for you.

Also, you should understand that this approach increases shader complexity. It may not be worth it.

Here is what I came up with:

Download the .Blend

Image of a shader node tree.

$\endgroup$
1
  • $\begingroup$ Hello, sorry for replying late, I copied your shader and it still doesn't work. I don't understand... I'll try another workflow. $\endgroup$
    – user46965
    Apr 7, 2022 at 21:04
0
$\begingroup$

When you want to use the model in a game engine keep in mind that the Principled BSDF kind of an interface and all other shader nodes of Blender might not work in the game engine and must be replaced by the game engine's nodes. (UE4 node example)

For some reason, the transparency of your image is inverted. When you check the Alpha channel (top left in the screenshot) you see that the background is white → opaque and the spokes of the wheel are grey → semi-transparent. The result is shown at the bottom left in the screenshot.

The background of the alpha mask should be pure black and the spokes should be white with some grey for smooth transparency.

You can use the Invert node in Blender but it's better to invert the alpha channel in a paint program. Then you can use the Alpha channel directly.

enter image description here

$\endgroup$
1
  • $\begingroup$ My idea was to use the alpha to as a mask for a customizable color and the magenta as a chroma key for the final transparency. I guess it was a bad idea. $\endgroup$
    – user46965
    Apr 7, 2022 at 21:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .