Compiling shader? NOOB!

Discussions concerning programming of SOFTIMAGE©
Post Reply
User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Compiling shader? NOOB!

Post by Hirazi Blue » 11 Dec 2014, 17:40

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!

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Compiling shader? NOOB!

Post by rray » 11 Dec 2014, 18:05

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)
softimage resources section updated Jan 5th 2024

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Compiling shader? NOOB!

Post by Hirazi Blue » 11 Dec 2014, 18:09

Thanks for the explanation. :ymhug:
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!

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Compiling shader? NOOB!

Post by rray » 11 Dec 2014, 18:12

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

User avatar
xsisupport
Posts: 713
Joined: 09 Jun 2009, 11:02
Location: Montreal Canada
Contact:

Re: Compiling shader? NOOB!

Post by xsisupport » 11 Dec 2014, 18:47

I'd use the Shader Wizard to get started...
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage

User avatar
whurst
Posts: 46
Joined: 16 Dec 2012, 11:00
Location: Germany
Contact:

Re: Compiling shader? NOOB!

Post by whurst » 11 Dec 2014, 20:17

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/
Last edited by whurst on 08 Jul 2017, 10:44, edited 1 time in total.

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Compiling shader? NOOB!

Post by rray » 12 Dec 2014, 12:36

Great job putting this pdf together, one of the few things worth printing B-)
softimage resources section updated Jan 5th 2024

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Compiling shader? NOOB!

Post by Hirazi Blue » 12 Dec 2014, 13:03

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:
# VERBOSE : 5359 - This plug-in doesn't have the correct entry-point and will be ignored:
# <entry-point requested: XSILoadPlugin>
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?
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!

User avatar
xsisupport
Posts: 713
Joined: 09 Jun 2009, 11:02
Location: Montreal Canada
Contact:

Re: Compiling shader? NOOB!

Post by xsisupport » 12 Dec 2014, 13:47

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:
# VERBOSE : 5359 - This plug-in doesn't have the correct entry-point and will be ignored:
# <entry-point requested: XSILoadPlugin>
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?
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)?
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.
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Compiling shader? NOOB!

Post by Hirazi Blue » 12 Dec 2014, 15:33

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.
Indeed, that caused the error message,,, :ymblushing:
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!

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Compiling shader? NOOB!

Post by rray » 12 Dec 2014, 16:21

Just curious, what kind of shader is it? Can you share the sources?
softimage resources section updated Jan 5th 2024

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Compiling shader? NOOB!

Post by Hirazi Blue » 12 Dec 2014, 16:39

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...
Stay safe, sane & healthy!

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Compiling shader? NOOB!

Post by Daniel Brassard » 12 Dec 2014, 21:07

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

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Compiling shader? NOOB!

Post by Hirazi Blue » 12 Dec 2014, 21:24

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!!!
;)
Stay safe, sane & healthy!

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests