Please Note: Materials attributes have changed as of 3D Ca

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’

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.

What about the scripting interface, i.e.

object.SetTranslucent 1

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

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]

You must be logged in to reply in this thread.

5 posts