Issue in Source Filmmaker with object becoming transparent while Ambient Occulusion is in effect

This is a common problem for many SFM users, and in my case it’s with the Warpig hat model from TF2 I added to SFM using GCFScape:

I went ahead and decompiled the model using Crowbar, and once that was finished I opened up its .qc file and added two new lines: ‘$mostlyopaque’ and ‘$ambientboost’ before recompiling the model and shoving it back into SFM. Now normally this works according to the tutorial I looked up but in my case these steps just made the model completely invisible instead. As a result, I don’t know what the hell to do and I’m hoping one of you might have had this problem before. Any ideas what I can do to fix this?

Most likely this is because the glass and the opaque stuff both belong to the same material and they used an alpha mask to get the transparency.
Source is really dumb with transparency so the only real way to fix this would be to split the model up into two materials, one that’s fully opaque and the other being transparent.

compile the model with this line in the qc
$mostlyopaque

Tried using just $mostlyopaque but that just makes the model fully invisible again. Guess I’m going to have try what you’ve suggested, Jojje.

That or I could just use a different hat since this is apparently taking a stupid amount of effort for a really minimal thing.

Just make sure the parts of the model that should be transparent have $transparent 1 in the materials, $alphatest 1 too just make sure only one is in the material at the same time. as it’ll override the one above it.

Sorry to bump this thread, but you can also just try $opaque. That usually works for me. If you have problems with the model being invisible, what you can do (and I have no idea why this works) is just copy the materials into the directory and overwrite the ones that are already there. Again, I have no idea why this works for me, but it does.