I just found I miss some extended bloom options in the material which I know fom MCX:
"Bloom material by copying" and "Bloom material modulating by copying".
Is it possible to add these or is that even covered by a different option already?
Also it seems I found another bug: The "no base material specular" flag seems to export inverse (showing inverse in MCX at least)
Hi Dave,
It might be possible. I'll try to explain in very short words how the python files work.
FSX_Material.py
- Find the section that starts with "class FSXMaterial"
- There, find the section that says "def draw(self, context)"
- You find numerous layout.label sections that each define one section of the FSX Material Params tab
- You can add another one by yourself. What I did last summer (just an example):
Code:
layout.label(text = "Specularity")
box = layout.box()
box.prop(mat, 'fsxm_specvalue')
- Then proceed to the section right below the "#############", the "def register()" section
- There I added:
Code:
Material.fsxm_specvalue = FloatProperty(name ="Specular Value", min = 0.0, max = 999.0)
- Then proceed to the section "def unregister()" where I added:
Code:
del Material.fsxm_specvalue
- Done for this file. We created the property "Material.fsxm_specvalue". This property, we can take it along in our export, see below.
export_fsx.py
- Find the section "# FS10 material parameters" (mine was around line 1270)
- Somewhere in this section, I added our previous made property.
Code:
if Material.fsxm_isFSXmaterial:
Exporter.File.Write("FS10Material {\n")
Exporter.File.Indent()
Exporter.File.Write("{:9f};{:9f};{:9f};{:9f};;\n".format(Diffuse[0],
Diffuse[1], Diffuse[2], Diffuse[3]))
Exporter.File.Write("{:9f};{:9f};{:9f};;\n".format(Specular[0],
Specular[1], Specular[2]))
Exporter.File.Write(" {:9f};\n".format(Material.fsxm_specvalue))
Exporter.File.Write("{:9f};{:9f}; // Detail and bump scales\n" .format(
Material.fsxm_detailscale,
Material.fsxm_bumpscale))
Exporter.File.Write("{:9f}; // Reflection scale\n" .format(RefScale))
Exporter.File.Write("%i; // Use global env\n" %(Material.fsxm_globenv))
Exporter.File.Write("%i; // Blend env by invdifalpha\n" %(Material.fsxm_bledif))
Exporter.File.Write("%i; // Blend env by specalpha\n" %(Material.fsxm_blespec))
Exporter.File.Write("%i; %i; %i; // Fresnel affects dif - spec - env\n" %(
Material.fsxm_fresdif, Material.fsxm_fresspec, Material.fsxm_fresref))
Exporter.File.Write("%i; %i; " %(Material.fsxm_precip1, Material.fsxm_precip2))
Exporter.File.Write("{:9f}; // Precipitation...\n" .format(Material.fsxm_precipoffs), Indent = False)
Exporter.File.Write("{:9f}; // Specular Map Power Scale\n" .format(
Material.fsxm_specscale))
Exporter.File.Write("\"{}\"; \"{}\"; // Src/Dest blend\n" .format(
Material.fsxm_srcblend, Material.fsxm_destblend))
Exporter.File.Write("BlendDiffuseByBaseAlpha { %i; }\n" % Material.fsxm_blddif)
Exporter.File.Write("BlendDiffuseByInverseSpecularMapAlpha { %i; }\n" % Material.fsxm_bldspec)
Exporter.File.Write("AllowBloom { %i; }\n" % Material.fsxm_allowbloom)
Exporter.File.Write("SpecularBloomFloor {\n")
Exporter.File.Write(" {:9f};\n" .format(Material.fsxm_bloomfloor))
Exporter.File.Write("}\n")
Exporter.File.Write("EmissiveData {\n")
Exporter.File.Write(" \"{}\";\n" .format(Material.fsxm_emissivemode))
Exporter.File.Write("}\n")
Exporter.File.Write("AlphaData {\n")
Exporter.File.Write(" %i; // ZTest Alpha\n" %(Material.fsxm_ztest))
Exporter.File.Write(" {:9f}; // Alpha test threshold\n" .format(Material.fsxm_ztestlevel))
Exporter.File.Write(" \"{}\"; // Alpha test function\n" .format(Material.fsxm_ztestmode))
Exporter.File.Write(" %i; // Perform final alpha write\n" %(Material.fsxm_falpha))
Exporter.File.Write(" {:9f}; // Final alpha value\n" .format(Material.fsxm_falphamult * 255.0))
Exporter.File.Write("}\n")
Exporter.File.Write("EnhancedParameters {\n")
Exporter.File.Write(" %i; // Assume vertical normal\n" %(Material.fsxm_assumevertical))
Exporter.File.Write(" %i; // Z-Write alpha\n" %(Material.fsxm_zwrite))
Exporter.File.Write(" %i; // No Z-Write\n" %(Material.fsxm_nozwrite))
Exporter.File.Write(" %i; // Volume shadow\n" %(Material.fsxm_vshadow))
Exporter.File.Write(" %i; // No shadow\n" %(Material.fsxm_noshadow))
Exporter.File.Write(" %i; // Prelit vertices\n" %(Material.fsxm_pverts))
Exporter.File.Write("}\n")
Exporter.File.Write("BaseMaterialSkin {\n")
Exporter.File.Write(" %i; // Skinned\n" %(Material.fsxm_skinned))
Exporter.File.Write("}\n")
Exporter.File.Write("DoubleSidedMaterial {\n")
Exporter.File.Write(" %i; // Double sided\n" %(Material.fsxm_doublesided))
Exporter.File.Write("}\n")
Exporter.File.Write("BlendConstantSetting {\n")
Exporter.File.Write(" %i; // Blend constant\n" %(Material.fsxm_blendconst))
Exporter.File.Write("}\n")
Exporter.File.Write("ForceTextureAddressWrapSetting {\n")
Exporter.File.Write(" %i; // Force texture adress wrap\n" %(Material.fsxm_forcewrap))
Exporter.File.Write("}\n")
Exporter.File.Write("ForceTextureAddressClampSetting {\n")
Exporter.File.Write(" %i; // Force texture adress clamp\n" %(Material.fsxm_forceclamp))
Exporter.File.Write("}\n")
Exporter.File.Write("BaseMaterialSpecular {\n")
Exporter.File.Write(" %i; // AllowBaseMaterialSpecular\n" %(Material.fsxm_nobasespec))
Exporter.File.Write("}\n")
Exporter.File.Write("NoSpecularBloom {\n")
Exporter.File.Write(" %i; // Allow specular bloom\n" %(Material.fsxm_nospecbloom))
Exporter.File.Write("}\n")
Exporter.File.Write("EmissiveBloom {\n")
Exporter.File.Write(" %i; // Allow emissive bloom\n" %(Material.fsxm_emissivebloom))
Exporter.File.Write("}\n")
Exporter.File.Write("AmbientLightScale {\n")
Exporter.File.Write(" {:9f};\n" .format(Material.ambient))
Exporter.File.Write("}\n")
- To find out to what thing it should be written, dig in a .X file. But I advice to dig into the py files as well. I might have forgotten one section in one file, to explain here.
Test anything with your .X file. It is very structured and hence I was able to locate the specular value slot in the .X file. Then it was a matter of inserting the fsxm.specvalue variable at the right location in the exporter script.
Hope this makes sense ;-)
Hopefully this gets you somewhere closer.
Cheers, Daan