[MAYA][PYTHON] Custom Material

Hi guys!
I have a question, I would like to write a custom material to be able to export to our engine.
It will be based on a shaderFx shader, so in a way should be like an interface for the shaderFx and the graphs.

I know It can be done with C++, but I was wondering if needs to be C++ or it can be done in Python.

And do you know any example code I can start looking, so I can learn a proper way to start?
Thanks in advice guys! :slight_smile:

“so in a way should be like an interface for the shaderFx and the graphs.” I’ve never used shaderFx but you can use Glew to create any vertex and frag shader you want, I don’t know if that’s what you’re asking.

Even if it could be done in python I wouldn’t bother, the API is the only way I know of, here is an example shader: http://docs.autodesk.com/MAYAUL/2014/ENU/Maya-API-Documentation/index.html?url=cpp_ref/lambert_shader_2lambert_shader_8cpp-example.html,topicNumber=cpp_ref_lambert_shader_2lambert_shader_8cpp_example_html258376d8-0e2e-4f2f-8bf1-cd066be4422a

And the steps to build your own:

Software shading node: http://docs.autodesk.com/MAYAUL/2014/ENU/Maya-API-Documentation/files/Writing_a_Shading_Node.htm

Hardware shading node: http://docs.autodesk.com/MAYAUL/2014/ENU/Maya-API-Documentation/files/Writing_a_Hardware_Shading_Node.htm

As for a time estimate, it took me around 4~ days my first time writing a custom shading node for Maya in the API but I was also converting all the teams code as well and learning the API classes.

The directX shader plugin on Windows will let you apply an HLSL shader – that should be (relatively) easy to get parity between Maya and the game as long as you have an HLSL shader compiler for your game. There’s still some magic going on to do things like hook up lights (and you won’t have an easy time doing a deferred shader) but at least most of the code will be common

Thank you so much guys!
@i73 Yes, It´s kind of writing the frag and vert shader but in a more visual way with shaderFX.

That is what I was atfer, I have to dive into the API to build a shading node from scratch. Thanks for pointing me to the righ direction man!

@Theodox We are using very basic shaders, so no real fancy stuff going on here in terms of shading hehehe
I think If I can create a custom shading node with our properties, then we can do the export process based on the custom shading node I´ll create.

I´ll keep up update it I manage to do it :slight_smile:
Thanks again !!