Skip to content

Commit

Permalink
Quick fix x2
Browse files Browse the repository at this point in the history
Quick fix x2
  • Loading branch information
caseytube committed May 16, 2020
1 parent c49395f commit 7747822
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions utils/vmt_to_vmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def parseVMTParameter(line, parameters):
if bumpMap.size != (3,3):
if "$ssbump" in vmtParameters and "1" in vmtParameters["$ssbump"]:
print("- WARNING: " + os.path.basename(vmtFileName) + " uses $ssbump, which is not supported in Source 2. Skipping normal maps.")
vmatFile.write('\t// $ssbump in original .vmt used, which are unsupported in Source 2. Normal maps skipped to retain visual quality.')
vmatFile.write('\t// $ssbump in original .vmt used, which are unsupported in Source 2. Normal maps skipped to retain visual quality.\n')
else:
if not OVERWRITE_TGA or OVERWRITE_TGA and not os.path.exists(vmatFileName.replace('.vmat', '_normal.tga')):
bumpMap.save(vmatFileName.replace('.vmat', '_normal.tga'))
Expand All @@ -513,7 +513,7 @@ def parseVMTParameter(line, parameters):
'\t"legacy_source1_inverted_normal"\t"1"\n'
'}')
vmatFile.write('\tTextureNormal "' + basePath + '_normal.tga' + '"\n')

# Rarely used, but ambient occlusion maps are sometimes available
# However, since we use a hack in vr_complex for phong masks, we prioritize that over custom AO textures
if phongMap.size != (3, 3):
Expand Down Expand Up @@ -543,7 +543,7 @@ def parseVMTParameter(line, parameters):
aoMapConvert.save(vmatFileName.replace('.vmat', '_ao.tga'))
print(os.path.basename(vmatFileName.replace('.vmat', '_ao.tga')) + " saved!")
vmatFile.write('\tTextureAmbientOcclusion "' + basePath + '_ao.tga' + '"\n')

# This value is a guess on comparing strengths of Phong exponent.
# https://developer.valvesoftware.com/wiki/Phong_materials
# My current theory is that $phongexponent's equvalent range (of usable numbers is 5-150 in Source 1)
Expand All @@ -567,7 +567,7 @@ def parseVMTParameter(line, parameters):
else: # VDC says the default value for $phongexponent is 5.0, but in my testing, I think it's actually 150, at least in SFM. TODO: Check this
finalSpec = 60
vmatFile.write('\tTextureRoughness "[' + str(finalSpec) + ' ' + str(finalSpec) + ' ' + str(finalSpec) + ' 0.000]"\n')

# Prep TextureSelfIllum using selfillum stuff
if "$selfillum" in vmtParameters:
vmatFile.write('\tF_SELF_ILLUM 1\n')
Expand Down Expand Up @@ -636,7 +636,6 @@ def parseVMTParameter(line, parameters):
if "$detailblendfactor" in vmtParameters:
vmatFile.write('\tg_flDetailBlendFactor "' + vmtParameters["$detailblendfactor"] + '"\n')


vmatFile.write('}\n')

elif SHADER == "vr_standard":
Expand Down

0 comments on commit 7747822

Please sign in to comment.