Okay, got another mystery for you guys.
Why does a C# Shader definition not load in SI?
In the SDK there is an example included that defines a Shader via C#, I think its called CSShader or something. But SI refuses to load the plugin.
-TS-
C# Shader Definition
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
Re: C# Shader Definition
You think it's called CShader? That makes me think you didn't compile it.TwinSnakes007 wrote:Okay, got another mystery for you guys.
Why does a C# Shader definition not load in SI?
In the SDK there is an example included that defines a Shader via C#, I think its called CSShader or something. But SI refuses to load the plugin.
-TS-
-
TwinSnakes007
- Posts: 316
- Joined: 06 Jun 2011, 14:00
Re: C# Shader Definition
Yes, I compiled it, and verified the syntax by removing the call to PluginRegistar.RegisterShader(); If you comment that line from the SDK example, the plugin loads fine (without registering a shader of course).
The project is called CSShaderExample.csproj
Since its included in the SDK, I assumed that shader definition via C# is possible?
The project is called CSShaderExample.csproj
Since its included in the SDK, I assumed that shader definition via C# is possible?
-
TwinSnakes007
- Posts: 316
- Joined: 06 Jun 2011, 14:00
Re: C# Shader Definition
I've got a huge 3000+ line python file with shader definitions in it, and wanted to refactor that using C#, so I could better manage the body of shaders. I didnt want to use C++, so when I saw the C# SDK example, I thought, that's just perfect. But SI wont load the darn thing.
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
Re: C# Shader Definition
I turned on Verbose messages and got this when I tried to load that plugin:
Edit: that's with Visual C# Express 2010, with or without the call to RegisterShader
Code: Select all
// VERBOSE : 5359 - This plug-in doesn't have the correct entry-point and will be ignored:
// <entry-point requested: XSILoadPlugin>
// <path: C:\Program Files\Autodesk\Softimage 2013 SP1\XSISDK\examples\workgroup\Addons\ShaderDefinitions\cssrc_CSEnvBlur\obj\Release\CSShaderExample.dll>
//
-
TwinSnakes007
- Posts: 316
- Joined: 06 Jun 2011, 14:00
Re: C# Shader Definition
Thanks Steve! Cool, I didnt know about verbose messages setting. That will help alot with debugging. I probably wont need a million Info() calls anymore.
I use MSVC 2010 Express as well. SI only works with the .Net 3.5 target. It defaults to 4.0 when you open SDK projects, so you have to manually set the target version in the project settings.
I use MSVC 2010 Express as well. SI only works with the .Net 3.5 target. It defaults to 4.0 when you open SDK projects, so you have to manually set the target version in the project settings.
-
TwinSnakes007
- Posts: 316
- Joined: 06 Jun 2011, 14:00
Re: C# Shader Definition
So, since I know the RegisterShader call is failing, if I wrap it in a try/catch, the plugin loads fine, and SI "kinda" thinks it a valid Shader. It's listed in the PluginManager as a Shader. But if you try to create it via scripting you get:
Now, the SDK says you need two callbacks to register a shader, and those callbacks are there....I just think the signature is not correct somehow (even though it appears to be)
If you add some Info() calls in the code, you can see that the Base constructor is called, then LoadPlugin is called and then it fails on the RegisterShader method invocation, which I assume is because it cant successfully locate and invoke the required DefineInfo & Define methods.
-TS-
Code: Select all
// ERROR : 21000-REND-CreateShaderFromProgID - Unspecified failure
CreateShaderFromProgID("CSShaderExample.CSEnvBlur.1.0", "Sources.Materials.DefaultLib.Scene_Material", null);
// ERROR : - [line 1]If you add some Info() calls in the code, you can see that the Base constructor is called, then LoadPlugin is called and then it fails on the RegisterShader method invocation, which I assume is because it cant successfully locate and invoke the required DefineInfo & Define methods.
-TS-
-
TwinSnakes007
- Posts: 316
- Joined: 06 Jun 2011, 14:00
Re: C# Shader Definition
I emailed ivan @ autodesk and he said they will look into it.
Will post here if/when I hear anything back.
-TS-
Will post here if/when I hear anything back.
-TS-