Compiling shader? NOOB!
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Compiling shader? NOOB!
Say I have the cpp source code to a Mental Ray shader, probably geared towards Maya or Mental Ray standalone that I would want to compile for Softimage, with hardly any experience compiling at all,, but with a working x64 capable Visual Studio C++ Express 2012 installed and ready, what would be the specific steps needed to get this code compiled? What do I “include”, where do I “link” to, those kind of questions. Or is the process considered “rocket science”, not to be messed with by the programmatically challenged, like myself?
Stay safe, sane & healthy!
Re: Compiling shader? NOOB!
No rocket science if you already have the sources.
Not sure about each details, but ususally, you create a new 64 bit dll project, then add the source file to it. The files that must be "included" should be referenced in the source file already (#include statements). You just need to go to the project settings and set the path where Visual Studio can find these files. For MR this is just "Program Files\Autodesk\Softimage ????\XSISDK\include".
Also you need to set a library path (=binary counterpart of include files). This is "Program Files\Autodesk\Softimage ????\XSISDK\lib\nt-x86-64". and add the library that mental ray uses (shader.lib I think it is)
The most tricky part is to define the shader interface definition (what kind of data type comes out of the shader, color or vector etc. .. and what goes in). Do you also have a mi file, or an SPDL? This is not needed for shader dll compilation, but Softimage/mental ray needs it when it wants to load the dll (alternative is a "shader definition" script .. this is the more "modern" way but likely not among the files you have)
Not sure about each details, but ususally, you create a new 64 bit dll project, then add the source file to it. The files that must be "included" should be referenced in the source file already (#include statements). You just need to go to the project settings and set the path where Visual Studio can find these files. For MR this is just "Program Files\Autodesk\Softimage ????\XSISDK\include".
Also you need to set a library path (=binary counterpart of include files). This is "Program Files\Autodesk\Softimage ????\XSISDK\lib\nt-x86-64". and add the library that mental ray uses (shader.lib I think it is)
The most tricky part is to define the shader interface definition (what kind of data type comes out of the shader, color or vector etc. .. and what goes in). Do you also have a mi file, or an SPDL? This is not needed for shader dll compilation, but Softimage/mental ray needs it when it wants to load the dll (alternative is a "shader definition" script .. this is the more "modern" way but likely not among the files you have)
softimage resources section updated Jan 5th 2024
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: Compiling shader? NOOB!
Thanks for the explanation.
Currently I have two pieces of source code I wanted to try, one without any mi or spdl accompaniment and one that has a mi file. So, I'd best try the one with the mi file first, I guess.
Currently I have two pieces of source code I wanted to try, one without any mi or spdl accompaniment and one that has a mi file. So, I'd best try the one with the mi file first, I guess.
Stay safe, sane & healthy!
Re: Compiling shader? NOOB!
Saves you some work, otherwise you'd have to analyze the code etc.. Btw, added some important "details" to the explanation (like pointing the project to the mental ray lib file). Let me know if it works. I'll add it to the rray site then.
softimage resources section updated Jan 5th 2024
- xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 11:02
- Location: Montreal Canada
- Contact:
Re: Compiling shader? NOOB!
I'd use the Shader Wizard to get started...
Re: Compiling shader? NOOB!
Hirazi, maybe this could help too ... it's in German and explain how to write shaders from scratch. This includes all C++ Settings and all the stuff. Maybe this help
https://whurst.net/2012/09/mentalray-sh ... ammierung/
https://whurst.net/2012/09/mentalray-sh ... ammierung/
Last edited by whurst on 08 Jul 2017, 10:44, edited 1 time in total.
Re: Compiling shader? NOOB!
Great job putting this pdf together, one of the few things worth printing
softimage resources section updated Jan 5th 2024
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: Compiling shader? NOOB!
After a very lenghty battle of trial and error I finally convinced Visual C++ to compile without errors, but loading this new dll into Softimage results in the following error:
One would expect an external "dll/mi"-shader to not have the correct entry point either, or am I simply not getting this (highly likely, BTW)?
Is there an easy fix for thi, something I should easily change or is this simply a case of me having bitten off more than I can chew?# VERBOSE : 5359 - This plug-in doesn't have the correct entry-point and will be ignored:
# <entry-point requested: XSILoadPlugin>
One would expect an external "dll/mi"-shader to not have the correct entry point either, or am I simply not getting this (highly likely, BTW)?
Stay safe, sane & healthy!
- xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 11:02
- Location: Montreal Canada
- Contact:
Re: Compiling shader? NOOB!
A shader isn't a plugin and won't have that entry point. It sounds like you're trying to load it as a plugin. Just put it and the spdl in place and start Softimage.Hirazi Blue wrote:After a very lenghty battle of trial and error I finally convinced Visual C++ to compile without errors, but loading this new dll into Softimage results in the following error:Is there an easy fix for thi, something I should easily change or is this simply a case of me having bitten off more than I can chew?# VERBOSE : 5359 - This plug-in doesn't have the correct entry-point and will be ignored:
# <entry-point requested: XSILoadPlugin>
One would expect an external "dll/mi"-shader to not have the correct entry point either, or am I simply not getting this (highly likely, BTW)?
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: Compiling shader? NOOB!
Indeed, that caused the error message,,,xsisupport wrote:A shader isn't a plugin and won't have that entry point. It sounds like you're trying to load it as a plugin. Just put it and the spdl in place and start Softimage.
Sadly the shader doesn't show up when installed the other/correct way, so I have now officially given up.
Thank you all for your assistance.
;)
Stay safe, sane & healthy!
Re: Compiling shader? NOOB!
Just curious, what kind of shader is it? Can you share the sources?
softimage resources section updated Jan 5th 2024
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: Compiling shader? NOOB!
I'm not sure if I can share this (it's from a book),
had it worked I would have had an incentive to figure that out...
edit: heavily edited updated post...
had it worked I would have had an incentive to figure that out...
edit: heavily edited updated post...
Stay safe, sane & healthy!
- Daniel Brassard
- Posts: 878
- Joined: 18 Mar 2010, 23:38
- Location: St. Thomas, Ontario
- Contact:
Re: Compiling shader? NOOB!
Which book Hirazi? Andy Kopra Mental Ray Programming?
Last edited by Daniel Brassard on 13 Dec 2014, 01:39, edited 1 time in total.
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: Compiling shader? NOOB!
Yes, quite probably, as I once owned that book...
But I've given up on this already:
Upward and onward to even more futile activities!!!
;)
But I've given up on this already:
Upward and onward to even more futile activities!!!
;)
Stay safe, sane & healthy!
Who is online
Users browsing this forum: No registered users and 29 guests