January 16, 2008
at 6:36 am /
#1348
Thanks a lot,
I think I got it, and in addition to be a bit more consistent to the provided script examples 2 minor corrections:
lngTxAlphaCustomMaterialFieldID = [span class=’ev_code_GREEN’]3DCApp[/span].GetMaterialCustomFieldID(‘Tx Alpha’)
If lngTxAlphaCustoMaterialFieldID = -1 Then
lngTxAlphaCustoMaterialFieldID = [span class=’ev_code_GREEN’]3DCApp[/span].AddMaterialCustomField(‘Tx Alpha’)
Endif
[span class=’ev_code_RED’]Material[/span].SetCustomFieldValue lngTxAlphaCustomMaterialFieldID, ‘Translucency’
January 16, 2008
at 6:36 am /
#12863
There have been some changes in the MSTS export recently.
The setting of material translucency to indicate if a texture is transparent or translucent is no longer supported.
This has been replaced by a new custom material field ‘Tx Alpha’. This material field is used to indicate if a texture has transparency, translucency or not. Valid values for this field are: Translucency/Transparency/None
A new custom material field ‘Alpha Pr’ is used to indicate the priority of translucency rendering. This is used in the rare case where there are multiple layers of translucency. Setting this field to ‘1’ for the ‘outside’ part of the object will ensure that both layers of translucency look correct.
These fields can be created can be created via File -andgt; Properties -andgt; Custom Fields.
But, a better way is to let the Train Simulator Wizard setup these fields for you. It also converts your materials to the new format. You need not actually export with the Train Simulator Wizard, all you need do is start it and then cancel.
January 16, 2008
at 12:43 pm /
#12864
What about the scripting interface, i.e.
object.SetTranslucent 1
January 16, 2008
at 2:34 pm /
#12865
That won’t work, but this will:
lngTxAlphaCustomMaterialFieldID = 3DC.GetMaterialCustomFieldID(‘Tx Alpha’)
If lngTxAlphaCustoMaterialFieldID andlt;andgt; -1 Then
3DC.SetCustomFieldValue lngTxAlphaCustomMaterialFieldID, ‘Translucency’
Else
‘say the field wasn’t there
End If
January 17, 2008
at 12:56 am /
#12866
Alternative coding to create if the field does not already exist:
[pre class=’ip-ubbcode-code-pre’]
lngTxAlphaCustomMaterialFieldID = 3DC.GetMaterialCustomFieldID(‘Tx Alpha’)
If lngTxAlphaCustoMaterialFieldID = -1 Then
lngTxAlphaCustoMaterialFieldID = 3DC.AddMaterialCustomField(‘Tx Alpha’)
Endif
3DC.SetCustomFieldValue lngTxAlphaCustomMaterialFieldID, ‘Translucency’
[/pre]