Interesting, thanks for the info. I might do that at some point. For now, the simple exclusion rules are working out but it does feel a bit hacky.
-----Original Message----- From: softimage-boun...@listproc.autodesk.com [mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of John Voltaire Tensuan Sent: Wednesday, September 18, 2013 7:55 PM To: softimage@listproc.autodesk.com Subject: RE: A minor change with RTShaders in SI2013 that might affect shader input-aware exporters Hi, Alternatively if you have a copy of the CgFX SDK, you could also use that to enumerate the exact parameters contained in the CgFX file without all of the Softimage specific stuff. Something like: (haven't tested but it should work) bool getParamNames(const char* szFilename, vector<string>& outNames) { outNames.clear(); CGcontext ctx = cgCreateContext(); if (ctx) { CGeffect effect = cgCreateEffectFromFile(ctx, szFilename, NULL); if (effect) { CGparameter param = cgGetFirstEffectParameter(effect); while (param) { outNames.push_back(cgGetParameterName(param)); param = cgGetNextParameter(param); } cgDestroyEffect(effect); } cgDestroyContext(ctx); return effect != 0; } return false; } After getting the list of parameters you could check them against what Softimage gives so you could query what the current values are. Regards, John From: softimage-boun...@listproc.autodesk.com [mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Eric Cosky Sent: Wednesday, September 18, 2013 5:21 PM To: softimage@listproc.autodesk.com Subject: A minor change with RTShaders in SI2013 that might affect shader input-aware exporters This is a bit long but I thought perhaps other RTShader users out there might benefit from me sharing these details since it isn't exactly easy to find clues for when things related to RTShaders break and I've found the occasional semi-related post very helpful for muddling through this sort of thing. I have written an exporter for Softimage which I've been using a couple years now. One of the features it has is the ability to discover and export all shader input parameters. I use this to configure a set of RT shaders with asset-specific tunings that you'd expect to need to do with RT shaders. The exporter extracts all these parameter values to send them off to the game engine. With SI2014, Softimage has begun reporting parameters that are not present in the .cgfx file. This is new behavior with SI2014 that did not happen with SI2013 and it (unfortunately for me) has the side effect of breaking the runtime code of our game engine because the game engine expects that any parameters provided by the pipeline are for valid things that actually exist in the shader code. There doesn't seem to be any way to distinguish between these unspecified parameters and parameters that actually exist in the .cgfx file, either. To diagnose this new behavior, I turned on some extra logging which emits all shader parameters using this method in the exporter. For example, in SI2013 the input parameters to a particular shaders are as follows, which correspond exactly to what is defined in my .cgfx: # INFO : Input parameters: # INFO : ShaderParam: 'previous' 'previous' Value: Type:siShaderDataTypeCustom HasDefault:true # INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:-1 # INFO : Min: Max: SuggestedMin: SuggestedMax: # INFO : Attributes: # INFO : customtypename = xgsRTCtx # INFO : ShaderParam: '_input_TexCoord' '_input_TexCoord' Value:0 Type:siShaderDataTypeProperty HasDefault:true # INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 # INFO : Min: Max: SuggestedMin: SuggestedMax: # INFO : Attributes: # INFO : propertyfilter = 1 # INFO : ShaderParam: 'Technique' 'Technique' Value:Emissive Type:siShaderDataTypeString HasDefault:true # INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 # INFO : Min: Max: SuggestedMin: SuggestedMax: # INFO : Attributes: # INFO : ppgportenumvalues = Emissive,Emissive; # INFO : ShaderParam: 'EmissiveMap_RGBA' 'EmissiveMap_RGBA' Value: Type:siShaderDataTypeImage HasDefault:true # INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:-1 # INFO : Min: Max: SuggestedMin: SuggestedMax: In SI2014, the same scene exported by the same exporter DLL has a *LOT* more input parameters, none of which found anywhere in the .cgfx but are in the new PPG for RTShaders. It wasn't until very recently that I even noticed the new tab and new sliders... had they registered in my head I probably wouldn't have needed to turn on the logging.. anyway, I've highlighted the ones that are newly visible only within SI2014. ' INFO : Input parameters: ' INFO : ShaderParam: 'previous' 'previous' Value: Type:siShaderDataTypeCustom HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:-1 ' INFO : Min: Max: SuggestedMin: SuggestedMax: ' INFO : Attributes: ' INFO : customtypename = xgsRTCtx ' INFO : ppgportlayouttab = Default ' INFO : ShaderParam: '_input_TexCoord' '_input_TexCoord' Value:0 Type:siShaderDataTypeProperty HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min: Max: SuggestedMin: SuggestedMax: ' INFO : Attributes: ' INFO : propertyfilter = 1 ' INFO : ppgportlayouttab = Default ' INFO : ShaderParam: 'Technique' 'Technique' Value:Emissive Type:siShaderDataTypeString HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min: Max: SuggestedMin: SuggestedMax: ' INFO : Attributes: ' INFO : ppgportenumvalues = Emissive,Emissive; ' INFO : ppgportlayouttab = Default ' INFO : ShaderParam: 'Blending' 'Blending' Value:false Type:siShaderDataTypeBoolean HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:0 Max:-1 SuggestedMin:0 SuggestedMax:-1 ' INFO : Attributes: ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Blending ' INFO : ShaderParam: 'SrcBlendingFunction' 'SrcBlendingFunction' Value:1 Type:siShaderDataTypeInteger HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:-2147483648 Max:2147483647 SuggestedMin:-2147483648 SuggestedMax:2147483647 ' INFO : Attributes: ' INFO : ppgportenumvalues = Zero,0;One,1;DestColor,2;OneMinusDestColor,3;SrcAlpha,4;InvSrcAlpha,5;DstAlp ha,6;InvDestAlpha,7;SrcAlphaSaturate,8; ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Blending ' INFO : ShaderParam: 'DstBlendingFunction' 'DstBlendingFunction' Value:0 Type:siShaderDataTypeInteger HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:-2147483648 Max:2147483647 SuggestedMin:-2147483648 SuggestedMax:2147483647 ' INFO : Attributes: ' INFO : ppgportenumvalues = Zero,0;One,1;SrcColor,2;OneMinusSrcColor,3;SrcAlpha,4;OneMinusSrcAlpha,5;Dst Alpha,6;OneMinusDstAlpha,7; ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Blending ' INFO : ShaderParam: 'CullingMode' 'CullingMode' Value:0 Type:siShaderDataTypeInteger HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:-2147483648 Max:2147483647 SuggestedMin:-2147483648 SuggestedMax:2147483647 ' INFO : Attributes: ' INFO : ppgportenumvalues = None,0;Back,1;Front,2;Back and Front,3; ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Culling ' INFO : ShaderParam: 'DepthTest' 'DepthTest' Value:false Type:siShaderDataTypeBoolean HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:0 Max:-1 SuggestedMin:0 SuggestedMax:-1 ' INFO : Attributes: ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Culling ' INFO : ShaderParam: 'DepthWrite' 'DepthWrite' Value:true Type:siShaderDataTypeBoolean HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:0 Max:-1 SuggestedMin:0 SuggestedMax:-1 ' INFO : Attributes: ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Culling ' INFO : ShaderParam: 'AlphaTest' 'AlphaTest' Value:false Type:siShaderDataTypeBoolean HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:0 Max:-1 SuggestedMin:0 SuggestedMax:-1 ' INFO : Attributes: ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Alpha Test ' INFO : ShaderParam: 'AlphaComparisonFunction' 'AlphaComparisonFunction' Value:2 Type:siShaderDataTypeInteger HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:-2147483648 Max:2147483647 SuggestedMin:-2147483648 SuggestedMax:2147483647 ' INFO : Attributes: ' INFO : ppgportenumvalues = Never,0;Always,1;Less,2;LessEqual,3;Equal,4;GreaterEqual,5;Greater,6;NotEqua l,7; ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Alpha Test ' INFO : ShaderParam: 'AlphaReferenceValue' 'AlphaReferenceValue' Value:0 Type:siShaderDataTypeScalar HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:0 Max:1 SuggestedMin:0 SuggestedMax:1 ' INFO : Attributes: ' INFO : ppgportlayouttab = Drawing State ' INFO : ppgportlayoutgroup = Alpha Test ' INFO : ShaderParam: 'Technique_Emissive' 'Technique_Emissive' Value:Blending,false;SrcBlendingFunction,1;DstBlendingFunction,0;CullingMode ,0;DepthTest,false;DepthWrite,true;AlphaTest,false;AlphaComparisonFunction,2 ;AlphaReferenceValue,0 Type:siShaderDataTypeString HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min: Max: SuggestedMin: SuggestedMax: ' INFO : Attributes: ' INFO : ppgportlayouttab = Default ' INFO : ShaderParam: 'EmissiveMap_RGBA' 'EmissiveMap_RGBA' Value: Type:siShaderDataTypeImage HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:-1 ' INFO : Min: Max: SuggestedMin: SuggestedMax: ' INFO : Attributes: ' INFO : ppgportlayouttab = Default ' INFO : ShaderParam: 'EmissiveMap_RGBA_WrapS' 'EmissiveMap_RGBA_WrapS' Value:0 Type:siShaderDataTypeInteger HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:-2147483648 Max:2147483647 SuggestedMin:-2147483648 SuggestedMax:2147483647 ' INFO : Attributes: ' INFO : ppgportenumvalues = Repeat,0;Clamp,1;Clamp to Edge,2;Clamp to Border,3;Mirrored Repeat,4;Mirror Clamp,5;Mirror Clamp to Edge,6;Mirror Clamp to Border,7; ' INFO : ppgportlayouttab = Default ' INFO : ShaderParam: 'EmissiveMap_RGBA_WrapT' 'EmissiveMap_RGBA_WrapT' Value:0 Type:siShaderDataTypeInteger HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:-2147483648 Max:2147483647 SuggestedMin:-2147483648 SuggestedMax:2147483647 ' INFO : Attributes: ' INFO : ppgportenumvalues = Repeat,0;Clamp,1;Clamp to Edge,2;Clamp to Border,3;Mirrored Repeat,4;Mirror Clamp,5;Mirror Clamp to Edge,6;Mirror Clamp to Border,7; ' INFO : ppgportlayouttab = Default ' INFO : ShaderParam: 'EmissiveMap_RGBA_WrapR' 'EmissiveMap_RGBA_WrapR' Value:0 Type:siShaderDataTypeInteger HasDefault:true ' INFO : IsArray:0 IsArrayItem:0 IsOutput:0 IsStruct:0 MainPort:0 Texturable:0 ' INFO : Min:-2147483648 Max:2147483647 SuggestedMin:-2147483648 SuggestedMax:2147483647 ' INFO : Attributes: ' INFO : ppgportenumvalues = Repeat,0;Clamp,1;Clamp to Edge,2;Clamp to Border,3;Mirrored Repeat,4;Mirror Clamp,5;Mirror Clamp to Edge,6;Mirror Clamp to Border,7; ' INFO : ppgportlayouttab = Default These parameters seem to have appeared with the changes made to the RTShader PPG in 2014 that adds a new tab for "Drawing State" and wrap controls for the textures. I suppose someone may find these useful to have in the PPG, but personally I never had the need to change these particular shader parameters since they tend to be hard coded and specific to a given shader (for me). TL;DR: SI2014 has new input parameters for RTShaders that might be a problem if you previously extracted parameter name/values for pushing into a game engine. I'm going to work around this by having the exporter ignore all the new parameters with fixed names, and any parameters that ends with _WrapS/T/R to deal with the new params related to textures. -Eric Cosky -------------------------- To unsubscribe: mail softimage-requ...@listproc.autodesk.com with subject "unsubscribe" and reply to the confirmation email.