Alphas from foliages

Your forum for all discussions around Modding.
shfarming123
Posts: 1
Joined: Mon Nov 20, 2023 12:51 pm

Alphas from foliages

Post by shfarming123 »

Hello, I would like to create plant textures like in the base game. My problem is that I don't know how the alpha textures are created. I would be particularly interested in which programs and settings are necessary and how the grayscale values ​​for visibility are structured
olahaldor
Posts: 267
Joined: Wed Oct 03, 2012 11:08 am
Location: Norway

Re: Alphas from foliages

Post by olahaldor »

I don't know what level of knowledge and skill you have prior to this. Have you made 3D models before ? Textures?
Foliage can be tricky even for the seasoned artist. So don't be disappointed if it at first doesn't look like you want it to.

There's a few ways you can make foliage and textures for them, I'll cover the easiest method;
download a texture atlas. It's many leaves, stems and flowers and so on in the same image. It usually contains
- color ( base color / albedo)
- roughness / specular
- normal map
- alpha

Alpha is where the material is told "keep this opaque, leave this transparent" based on black and white values. White is visible, black is invisible.

You'll usually create polygons around the specific leaf/stem/flower based on this atlas, and arrange the different parts to make it look like the plant you're creating.

So to make foliage it will involve knowing how to handle textures, and how to make 3D models.
The FS-specifics can be a rollercoaster too, but that comes later, after the model is done.
XPModder
Posts: 68
Joined: Thu Oct 30, 2014 2:45 pm

Re: Alphas from foliages

Post by XPModder »

If I understand the question correctly, you have a diffuse/albedo map for some foliage type (an image file), but no alpha map and want to create the alpha map for it.
There are multiple ways this can be done in an image editor. Here is how I do this:

Method 1:
Open the albedo/diffuse map and create a new layer.
Make the new layer entirely black.
Switch to the original layer.

If the diffuse/albedo does not have a solid (or completely transparent) background:
You will have to manually select everything that is part of a plant first.
If the diffuse/albedo does have a solid color or completely transparent background:
You can use the wand tool (assuming your image editor of choice has this functionality) to select everything thats part of a plant (this can easily be done by selecting the background and then inverting the selection).

While keeping the selection as is, switch back to the black layer.
Fill the selection white.
You should now have a layer that is black with the outlines of the plants filled in white.
Delete the original layer (the one that contains the albedo/diffuse map) and save as a new file.

Method 2:
This method uses the 'Paste Alpha' tool thats part of Paint.NET (not sure if/how other image editors have an equivalent) and uses an albedo/diffuse with a completely transparent background.
If your albedo/diffuse does not have a completely transparent background, use the other method or select the entire background and delete it/make it fully transparent.
Make a new image file of the same dimensions as the albedo/diffuse.
Create two layers: one completely black, one completely white.
Position the white layer above the black layer.
Copy the entire albedo/diffuse (as in open it in the image editor, select the entire thing and copy).
While having the white layer in the new image selected, open the 'Paste Alpha' tool.
In the tool, select: Replace current alpha with Alpha channel from clipboard.
Click ok.
You should now have a white layer where everything thats not part of a plant is completely transparent and therefore you can see the black layer below in these places.
Now merge the two layers, resulting in one layer that is black with the outlines of the plants filled in white.
Save this as your alpha map.

As Paint.NET is my image editor of choice, I usually use method 2, as thats just faster and doesnt require me to play around with the settings for the wand selection tool. Given a albedo/diffuse with a transparent background I can make the alpha map in probably less than 2 minutes if I want to...

In your foliage i3d with the shape selected, go to the shader section of the material editing window. Underneath the fields for the shader parameters there will be two files selected. One of these files is the alpha map, so select your new alpha map there. The other file is wind noise and should already be the default wind noise file included in the game.

As for 'how grayscale values for visibility are structured': The grayscale value is just 1 to 1 mapped to the alpha. Black=0 -> Alpha=0 -> fully transparent. White=255 -> Alpha=255 -> not at all transparent. Everything in between is just linear. So eg grayscale value of 127 -> Alpha=127 -> 50% transparency.
Das Universum ist unvorstellbar groß und wir sind im Vergleich dazu winzig.

Daher kann mir jemand der unter uns Winzlingen Unterschiede in Hautfarbe oder Herkunft sucht, nur Leid tun, weil seine Sichtweise so begrenzt ist!

Fremdenfeindlichkeit ist Menschenfeindlichkeit!
Post Reply