I asked this question recently on the XSI Base forum and thought I'd post it here as well (since most of the people there don't deal with realtime shaders). If anyone has any experience with this (and 5.0 obviously, which you can try out as a free download for 30 days), try this out and see if it works for you.
I'm basically trying to create a custom property set so that I can tweak values passed into my HLSL shader (vertex shader in my case). The 5.0 docs mention this as being possible, but it's not working for me.
Instead of reposting the exact question, take a look at this thread in their forum:
Question
XSI 5.0 Custom Parameters in Realtime shader (DX HLSL)
- Kentamanos
- Minaton
- Posts: 980
- Joined: Sat Aug 07, 2004 12:08 am
- Location: Dallas, TX
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
I played with this a little in 4.2 but abandoned exporting shaders from XSI in the material exporter at the time, since there was no way to share shader files between models (you had to embed everything) which meant manual trickery to merge shaders from different exports anyway, and it wasn't at all artist friendly. I raised this with Softimage at the time but was told I'd have to extend the Cg/HLSL plugins if I wanted to do that, which I didn't have time for.
Thus, I never got to linking parameters up to them, sorry
Thus, I never got to linking parameters up to them, sorry
- Kentamanos
- Minaton
- Posts: 980
- Joined: Sat Aug 07, 2004 12:08 am
- Location: Dallas, TX
No problem. Just trying to figure out my "workflow" for future projects at this point.
I also realized they don't have a "semantic" (something I can use the "uniform" keyword on) for any time values. I wanted to play around with some cheesy "warping" vertex shaders and couldn't find a good way to get a t for my sin(t) calls
.
When you say "no way to share shader files", you basically mean the text property of the (in my case) DXHLSLProgram, right? In other words, you'd like that to be more like a reference rather than a string that gets duplicated. I can see how that would be a real pain in the butt.
I went poking around the SDK and a quick glance made it look like the source for the shaders were in there. It would be cool to fix these problems at some point, but that would probably require quite a bit of effort.
I also realized they don't have a "semantic" (something I can use the "uniform" keyword on) for any time values. I wanted to play around with some cheesy "warping" vertex shaders and couldn't find a good way to get a t for my sin(t) calls
When you say "no way to share shader files", you basically mean the text property of the (in my case) DXHLSLProgram, right? In other words, you'd like that to be more like a reference rather than a string that gets duplicated. I can see how that would be a real pain in the butt.
I went poking around the SDK and a quick glance made it look like the source for the shaders were in there. It would be cool to fix these problems at some point, but that would probably require quite a bit of effort.
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Yep. Really you want to pull the shader definition out as an object in it's own right which can be saved from one model and re-used in another more easily without duplicating it's definition.Kentamanos wrote:When you say "no way to share shader files", you basically mean the text property of the (in my case) DXHLSLProgram, right? In other words, you'd like that to be more like a reference rather than a string that gets duplicated. I can see how that would be a real pain in the butt.
Yeah, all the source is in there (which I didn't expect, but SI pointed that out to me at the time), but I really didn't have the time.I went poking around the SDK and a quick glance made it look like the source for the shaders were in there. It would be cool to fix these problems at some point, but that would probably require quite a bit of effort.
- Kentamanos
- Minaton
- Posts: 980
- Joined: Sat Aug 07, 2004 12:08 am
- Location: Dallas, TX
Hey sinbad, I just tried something and wanted your input on if it helps alleviate some of the problem.
In my "Explorer View", I created a "Group". Inside that group, I cut and pasted my material. The material's Render Tree just has a DXDraw and DXHLSLProgram in it that basically creates a color cube out of the normalized x,y, and z coordinates of the vertex.
I then dragged and dropped this material to two different objects in my scene (a cube and a torus). This basically makes their material a reference to the original material. I was then able to edit this single material and get both of the objects to update.
Does this resolve some of the problems for something like exporting a scene. Perhaps the exporter would allow you to specify the name of your material group or something?
I've included 2 screenshots of what my scene/workspace looked like:


In my "Explorer View", I created a "Group". Inside that group, I cut and pasted my material. The material's Render Tree just has a DXDraw and DXHLSLProgram in it that basically creates a color cube out of the normalized x,y, and z coordinates of the vertex.
I then dragged and dropped this material to two different objects in my scene (a cube and a torus). This basically makes their material a reference to the original material. I was then able to edit this single material and get both of the objects to update.
Does this resolve some of the problems for something like exporting a scene. Perhaps the exporter would allow you to specify the name of your material group or something?
I've included 2 screenshots of what my scene/workspace looked like:


- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
No, what I really wanted was to be able to share these things between completely separate scenes, rather than within a single scene. You might have a brushed metal shader you want to use on armour for several different characters, for example, and defining it separately each time is not ideal. You'd typically be modelling in different scenes (it might be different artists in fact).
- Kentamanos
- Minaton
- Posts: 980
- Joined: Sat Aug 07, 2004 12:08 am
- Location: Dallas, TX
- Kentamanos
- Minaton
- Posts: 980
- Joined: Sat Aug 07, 2004 12:08 am
- Location: Dallas, TX
FYI: I figured out my original problem. The main problem was that the XSI Explorer was filtering out some of the nodes in the material for some reason. Once I told it to show all nodes (drop down on top right of the XSI Explorer), I was able to see the shader that actually needed the Custom Parameter Group (DXHLSLProgram). I then selected that shader, and created the Custom Parameter Group (and Custom Parameters under that group). It then worked like a charm. The weird thing is this did not work while selecting that shader under the Render Tree.