• Transparency problem in model [sfm]
    6 replies, posted
Alright so I'm a bit of a pickle here. I've got this transparency problem with a model I downloaded where you can see through the texture that's transparent but it's black and white. Specifically it's this Blitz model from R6. [url]https://steamcommunity.com/sharedfiles/filedetails/?id=882231980&searchtext=blitz[/url] Here's what it looks like in engine. [img]http://i.imgur.com/enEY11v.png[/img] I would ask the guy who ported it, but lucky me he seems to have turned off comments on the page and his profile. The preview image doesn't seem to have it so I'm a bit stuck here. Anyone who has an idea of how I can fix this please let me know.
There's three things you can do to try to fix this. The model actually needs all three done, but if you're lucky, some of these have already been done. In order of intensity: [b]1.) Material adjustment[/b] a.) Find the materials for the visor, open with Notepad (or Notepad++ if you have it) b.) If the material has both $phong, $alphatest (or $translucent), [b]and[/b] does [i]not[/i] have "$ambientocclusion 0", (or does have "$ambientocclusion 1", but that's rare to see), then remove the $phong lines. [b]2.) QC Adjustment[/b] a.) Decompile the model using [url=http://steamcommunity.com/groups/CrowbarTool]Crowbar[/url] b.) Open the resultant .qc with Notepad(++) c.) If the .qc does not already have the following two lines, then add them: "$mostlyopaque" "$ambientboost". d.) Recompile the model using Crowbar. [b]3.) Mesh adjustment[/b] - [i]You're going to need a 3D modeling program for this; the below is for 3dsMax, but you can find analogues for the free Blender program[/i] a.) Import the relevant .smd for the mesh with the visor using [url=https://facepunch.com/showthread.php?t=1546878]GameZombie's SMD importer[/url] (or another, but I recommend GZ's) b.) Create a new submaterial for the visor, with a new name. For example, if the visor's material is "visor_d.vmt", then name this new submaterial "visor_d_alpha.vmt." c.) Use Element selection to select the visor mesh, then go to Detach -> As Element Clone d.) The cloned mesh is now selected; assign it the material ID for the new submaterial you just made e.) Export out your new visor mesh as a .smd, overwriting the one you imported f.) Compile the model g.) Go to the model's materials, and copy-paste-rename the visor's VMT to the new material you made (again, from "visor_d.vmt" to "visor_d_alpha.vmt") h.) Open the new vmt in Notepad(++). It should have a "$translucent" line. Replace that with "$alphatest", and add "$nocull 1" if it doesn't already exist. By the end of this whole ordeal, the model's visor should be fixed. It might seem like a lot of work, when looking at it from an outside perspective, but once you get used to the whole workflow, it could be done in less than 10 minutes. :smile:
[QUOTE=Gmod4ever;52403189]There's three things you can do to try to fix this. The model actually needs all three done, but if you're lucky, some of these have already been done. In order of intensity: [b]1.) Material adjustment[/b] a.) Find the materials for the visor, open with Notepad (or Notepad++ if you have it) b.) If the material has both $phong, $alphatest (or $translucent), [b]and[/b] does [i]not[/i] have "$ambientocclusion 0", ([B]or does have "$ambientocclusion 1[/B]", but that's rare to see), then remove the $phong lines. [/QUOTE] Seems like it does have $ambientocclusion 1. Removed the Phong line and that seems to have fixed the problem, but now It's not transparent enough to see through well. Is there a specific value or line I have to insert to change it? Or do I have to do something to the texture file itself?
[QUOTE=Hogie bear;52403294]Seems like it does have $ambientocclusion 1. Removed the Phong line and that seems to have fixed the problem, but now It's not transparent enough to see through well. Is there a specific value or line I have to insert to change it? Or do I have to do something to the texture file itself?[/QUOTE] You can try to give it a float value to $alpha, such as "$alpha 0.5", but that [b]generally[/b] causes transparency issues of its own. You can use [url=http://nemesis.thewavelength.net/index.php?c=178]VTFEdit[/url] to convert the visor's .VTF to .TGA, and then use a photo editor to darken the alpha channel of that .TGA, before converting back to .VTF, to make it more transparent. The darker the alpha channel, the more transparent it is. :smile:
[QUOTE=Gmod4ever;52403313] use a photo editor to darken the alpha channel of that .TGA, before converting back to .VTF, to make it more transparent. [/QUOTE] Yup that did it. Thanks man, can always count on ya for anything source.
Just disable ambient occlusion in the VMT.
Phong and AO have trouble working together in SFM, disable ambient occlusion for transparent materials
Sorry, you need to Log In to post a reply to this thread.