What's the best way to start coding viewport shaders for Maya?


#1

I just did some research on coding shaders for Maya. You can use plug-ins to get HLSL shaders and GLSL shaders working in Maya by wrapping them into .fx files or .ogsfx files. Or there is a node based system called shaderFX that let you create real time shader as well. I’m a student and have some experience coding shaders with GLSL and C++. Say, if I’m going to create a Lava shader that uses a flowmap to control its flow, what is the best practice? And is there a place where I can find corresponding tutorials? Or code samples?

Thank you

miiicom


#2

ShaderFX is the lowest friction method these days, unless you’re already skilled with HLSL/CGFX and want stick with what you know.

I’m not sure if the current iteration of ShaderFX includes the ability to execute arbitrary CG or HLSL code too; maybe somebody else could chime in on that.

@kees and @bcloward are the original authors of what became shaderFX, if I recall, they may know more about the current state


#3

I managed to get some interesting result by reading the vertex color and use that to control UV distortion. It seems ShaderFX is power and semi-artist friendly. From what I know you can promote parameters into the attribute editor and eventually writing a simple tool that grant artist control over the flowmap details.


#4

Here is a update. I managed to get the flowmap in shaderFX. Now the shader takes vertex color as flowmap information and tweak the textures. :smiley:
flowmap_GIF

Here is my question. I’m now trying to find a proper way to export my shaderFX file. I don’t know if it only happens to me or not. Autodesk instructions and this Tip block seem not to be working for my Maya 2017(student version ). There are no .fx file or .ogsfx file saved to dedicated directory. The only work around is to save the shaderFX graph directly into a .sfx file. Is it a common thing?


#5

It might be a limitation of the student version.
I’ve seen it behave a bit differently with exports at times. Primarily to keep people from using the student version to do proper production work.

But I will add, the last time I encountered the student version, ShaderFX wasn’t a thing for maya yet, so I have no idea there.


#6

Thank you for replying. I will try start a new project with normal Maya 2017 and see if it works.:grinning: