Kyle_W

Are there any tools out there to enable the graphical building of a shader network, such as in Autodesk Maya's Hypershade tool or Softimage XSI's RenderTree tool, which can enable you to use a GUI to set up an object's basic material properties and then automatically generate the appropriate HLSL shader fragments needed to reproduce the material effect in your game without having to manually write HLSL files

Certainly, if you want to create complex shader effects, you would need to be able to edit the HLSL or manually create new custom HLSL files, but for creating HLSL files to render basic, standard material properties, there really should be a graphical tool to take some of the work and difficulty out of it.

Such a tool should allow you to set up the diffuse, ambient, and specular shading properties, as well as layered textures with alpha blending and bump and specular maps. It would be especially nice if such a tool could create HLSL shaders to render environment maps and ray traced reflections and refractions.

The only tool I know about is NVidia's FX Composer, which allows you to preview your shaders, but you still have to write the shader code. I'm looking for a tool that allows you to build the shaders graphically and link them as in Maya Hypershade or XSI RenderTree.

Any links or information will be greatly appreciated. If no such tool currently exists, I think that this represents the single greatest opportunity in which the XNA Team could make an impact on simplifying game development.

It's possible that exporting a model in Maya's FBX file format might support this, but if so, I haven't been able to find any information to confirm it.

Thank You



Re: XNA Framework Tool for auto HLSL Generation?

Gloei

I know of ATi's RenderMonkey. Which is a graphical shader development tool. But instead of using the graph-approach (like Maya's Hypershade) it uses a treelike approach. It can export shaders to .fx files afaik. I personally didn't like Rendermonkey very much, their whole way of building shaders didnt feel that natural. And I have the feeling that ATi stopped supporting RenderMonkey, since they haven't released any new version for a long time.

UnrealEngine3 comes with a visual shader/material editor where you can do exactly what you are asking for. You can easily build materials by linking nodes together in a graphlike structure. Which actually makes it possible to have an artist (without any programming skills) to create fancy shaders.

I've also been looking for such a standalone graphlike shader/material editor to create my own shaders with, but I just couldn't find anything good. The best tool around seems to be Nvidia's FX Composer, but this still makes shader creation more or less a programmer's job than an artist's job.

Btw, take a look at ShaderWorks, that's a tool I discovered recently and looked very promising. Until I noticed they were acquired by Activision and stopped all development and removed all downloads :(








Re: XNA Framework Tool for auto HLSL Generation?

Gloei

I just found out we're not the only onces noticing a lack of usable, artist-targeted, freely available shader design tools: check out this topic at gamedev.net. http://www.gamedev.net/community/forums/topic.asp topic_id=374383




Re: XNA Framework Tool for auto HLSL Generation?

Kyle_W

Gloei,

Thanks for the information. The UnrealEngine3 material editor looks perfect, but since I'm just trying to learn a few things, that won't be an option for me. ShaderWorks looks good also, but as you said, it's no longer available. RenderMonkey is very similar to FX Composer, and, while it is still not exactly the kind of interface I'd like to see, it looks like it might be a little better than FX Composer so I will check it out. However, I still have hopes that someone (perhaps the XNA Team) will develop a freely available tool which is more graph based like the one in UnrealEngine3. Again, thanks for the reply.

Kyle

 

 





Re: XNA Framework Tool for auto HLSL Generation?

Sentientv2

As far as game engines go, that's a steep request. The only two projects I've personally read about that use shader networks in the engine are the Offset Engine and Unreal3. The amount of programming required to manage multiple shaders being added on top of each other when there are only a set number of instructions you can send a card at one time is a bit daunting to figure out. I did some searches a while back on Google and remember seeing a post before Project Offset started getting all of the floods of mainstream press coming at them, and the programmer had some comments about how he designed his.

He had each shader programmed with and identifier somewhere in there that told the program how many assembly instructions that shader would need. This way, when he dynamically was chaining together shaders, the engine would check to see if it could handle those instructions. If so, the two shaders were combined somehow with xml. I am not sure if they were parsed together into one shader (I think there were). If anyone finds a link to that cached post through google, let me know. There's not direct stuff on Offset's engine related to that article that works (he had pictures set up).

It is a neat feature, but the engines that have it are $700k + per license, :)





Re: XNA Framework Tool for auto HLSL Generation?

Gloei

I think the complexity of the implementation depends on how far you want to go with abstracting your shader into a graph.

You can for example have a 1 to 1 mapping for all HLSL functions/operators onto graph nodes. This will give you function nodes like "add", "multiply", "negate", "sample texture 2D", "sample texture 3d", "clamp", etc... if you combine those with "constant" nodes you can generate a HLSL shader by simply parsing the graph and converting each node into a single line of HLSL. Calculating the number of used instructions (or even cycles) is a matter of compiling the HLSL into shader assembly. If I look at UnrealEngine's material editor screenshot (from the UE3 page), this is how they do it, i think. I've also once seen a project by someone on gamedev.net, who was using this approach. And he already had some basic functionality in it. (Too bad I forgot the name of it :()

Another idea would be, I guess, to have high-level nodes like "bump map", "phong", and "mixer" etc.. Where each node would actually represent a whole shader. (vertex+pixel) I don't have any idea how to implement such an approach. And it also sounds a bit less flexible. But if this is how they did it in Project Offset, then this could be a usable approach.

This first approach sounds doable I guess. You'll need to have a nice GUI tool with graph support. You'll need to have nodes representing shader functions/constants. You have to parse this graph into a HLSL shader (consisting of a vertex and a pixel shader). And then you can also even compile it to get some instruction counts (to be able to do some performance tuning on your shaders).





Re: XNA Framework Tool for auto HLSL Generation?

Joel Martinez

if you want a bit more information about how one might implement something like this, you can check out this paper by Shawn Hargreaves:
http://www.talula.demon.co.uk/hlsl_fragments/hlsl_fragments.html





Re: XNA Framework Tool for auto HLSL Generation?

Gloei

Gloei wrote:

I've also once seen a project by someone on gamedev.net, who was using this approach. And he already had some basic functionality in it. (Too bad I forgot the name of it :()


I think I found the project again: http://www.gamedev.net/community/forums/topic.asp topic_id=407342

Joel: thanks for the link! It looks very interesting (for what I've just read). Although I have the idea that Shawn Hargreaves article is aimed at solving the shader permutation problem, not at making it possible to have treestructures, made out of several shader parts, and having them parsed into a single shader. But maybe that's almost the same thing as what Shawn is doing




Re: XNA Framework Tool for auto HLSL Generation?

Shawn Hargreaves - MSFT

They are really the same problem. Once you have a technological solution for the problem "how do I generate HLSL code from some kind of higher level shader description", that can be used both to provide a nice editing UI for artists, and also to automatically generate shader permutations.

In the system I developed at Climax (described in that article) we used a Photoshop layers style model, rather than a tree UI, so artists would say things like "start off with this diffuse texture, then layer this normalmap over the top, put a reflection map over the top of that, then maybe a radiosity layer to top things off", but that's really just semantics: the core HLSL generation problems aren't that much affected by how you present the system in a user interface.





Re: XNA Framework Tool for auto HLSL Generation?

Kyle_W

Many UI schemes are possible for implementing this sort of thing, but I think a graph is really the best way to visually represent the data, and it's something that would look familiar to artists who use Maya Hypershade, XSI RenderTree or other similar systems.

I wish Shawn had commented on whether the XNA Team is considering developing a tool like this. :)





Re: XNA Framework Tool for auto HLSL Generation?

Kyle_W

I think I may have found my own answer! I began investigating the Softimage XSI Mod Tool mentioned on the XNA Partners page:

http://msdn.microsoft.com/directx/xna/partners/

I've never looked at the Mod Tool before, so I decided to check it out. It appears to be a full blown copy of XSI only with features not related to game modeling, texturing, animating, etc disabled. When I went to the documentation download page here:

http://www.softimage.com/downloads/default.aspx downloadid=62

I noticed there is a dropdown box with an item in it called FX Add-On. I downloaded its documentation and it appears to be exactly what I was seeking: A tool to create and export shaders (FX files) using the XSI Render Tree! :) Best of all, the Mod Tool and FX Add-On are both totally free with required registration. I need to play with it before I'll know if it is everything I hope, but it sure looks promising.





Re: XNA Framework Tool for auto HLSL Generation?

Gloei

Cool! This looks really promising. I'm downloading both right now :) I haven't seen or used XSI before, but you already got me excited :)




Re: XNA Framework Tool for auto HLSL Generation?

Kyle_W

Well I've been playing around with it for the last couple of hours and it appears that the FX Add-On needs for you to be able to set an XSI viewport into RealTime Shader > DirectX9 mode. This mode appears to be disabled in the XSI Mod Tool. The Mod Tool does actually have the required DLL (DX9Display.dll), but when I tried to enable it in the Plugin Manager, nothing happens. :( So therefore, it appears that the FX Add-On is only intended for use with the full XSI product.

If you have a licensed copy of XSI, the FX Add-On appears to be a very good tool for building FX files, but the rest of us will just have to wait and hope that someone (the XNA Team ) will produce a free tool for building FX files, similar to RenderMoney but with a more intuitive graph-like interface.





Re: XNA Framework Tool for auto HLSL Generation?

Sentientv2

I am pretty sure the latest version of Maya and I am certain that 3dsMax has the HLSL rendering feature as well. Max has had this feature since version 7.





Re: XNA Framework Tool for auto HLSL Generation?

Gloei

Jep, you can easily apply and view HLSL shaders in those tools. But you cannot create new HLSL shaders in them (well, not in Maya, I don't know what 3dsMax's latest version is capable of).