[Solved] Models that are only partially selflit

Simon.R.K

L1: Registered
Jan 3, 2019
30
6
Hello,

I would like to make a monitor where only the screen is affected by the selfillum parameter.
I have one model, two vtf files and one vmt file.
Appareantly it is possible with the monitor on the right (made by valve). The vmt contains the following:

"VertexLitGeneric"
{
// Original shader: VertexLitTexture
"$basetexture" "Models/props_lab/monitor02b"
"$selfillum" "1"
"$surfaceprop" "plastic"
"$envmap" "env_cubemap"
"$envmaptint" "[ .4 .4 .4]"
"$envmapmask" "Models/props_lab/monitor02_mask"

}

The only difference between my model on the left and the one from valve on the right is the basetexture, which is the monitor + screen texture.

I used GFCScape to extract the model, textures and vmt files.
Paint to edit my texture.
VTFEdit to convert it into vtf again.
Skin editor to add my vtfs to the model. https://developer.valvesoftware.com/wiki/Source_model_skin_editor

upload_2022-1-15_11-11-57.png
 

Tumby

aa
May 12, 2013
1,084
1,192
When you open a vtf in VTFEdit, you can press Ctrl+M to show transparency and press it again to turn it off. (It will remember this mode after closing the program.) You can also access this and other modes by clicking on "View" at the top. One of these modes allows us to only see the alpha, without any distracting colors.
Using this information, lets analyze the hl2 monitor texture:
Default RGB view:
RGB.png

Mask view:
RGB+Mask.png

Alpha-Only view:
Alpha.png

This alphamask controls which pixels are affected by the selfillum paramater. More precisely, transparent pixels are unaffected while opaque pixels will be fullbright. The texture has some gradients in the alpha of the screen, as well as making the text more opaque than the screen. The gradients are probably to make the screen look a bit dirty, and the text is more opaque to make it look brighter.

Your custom texture probably doesn't have an alphamask like this, meaning all pixels are opaque, meaning they are all fullbright.
 

Simon.R.K

L1: Registered
Jan 3, 2019
30
6
Yeah my texture doesn't have an alphamask, do you know how I could add one to my texture?
 

Simon.R.K

L1: Registered
Jan 3, 2019
30
6
Fair enough.
Im just gonna leave this explanation I found here incase I forget.
"First you need something like Photoshop. In the "Channels" window, next to layers, add a new channel. This is commonly Alpha 1. Mark the areas you want to be opaque or transparent depending on how you want it set up and save the result as a .tga file. Import it into VTFedit and you should see the transparency in action."