CGFX and HLSL integration to Maya


#1

I am attempting to get a WYSIWG shader viewer within Maya6.0 . In previous versions , we used the cgfxShader.mll to drive “.fx” shaders that were rough reprensations of our DirectX in game shaders .

I cant get cgfxShader.mll to work in Maya6.0 ! Any advice ?

OR

Is there a better way to get these shaders viewed ? I have been looking into the DirectX9.0 SDK viewer . Any opinions ?

Thanks


#2

IMO, maya’s implimentation of Hardware shaders was a tad hacky. Under the API you need to derive a node from the base class MPxHwShaderNode. One or two problems arise when trying to access shaders. Theorectically you can create the texture each time it’s renderered by reading back the image data from connected file texture (via MImage).

Unfortunately this is somewhat in-efficient. Within the devkit folder of the maya install you will find a few files, MTexture.h MTexureCache.h etc. Basically these use a set of callbacks internally to manage textures between successive draw requests. According to some comments at the top of those files, they may be added into the Maya API in a later revision.

At the moment though, it’s probably best to create you shaders using those example files - though you do start to feel like Alias didn’t put too much thought into the interface…

I’ve never used the cgfx shader because cgfx is not supported under linux… :frowning:

hope that’s some help…


#3

Thanks Robert ,

I have thought about creating my own hwShader but I have found that many of the devkit shaders do not work properly and that are missing many includes .

Hmmmm , seems like Alias is a little disorganized on this one .

I am new to the HLSL / cgfx shader world . Do you think that that the *_NV20 examples should work with current implementations of Cg1.2 ?

-chaney


#4

Yeah, some of them are very dodgy. Some of them use the older depreceated interface, ideally you should be overloading the glBind, glUnBind and glGeometry methods. I think the other files needed (for the NV ones anyway) are available within the NV SDK available from www.nvidia.com

Hmmmm , seems like Alias is a little disorganized on this one .

bit of an understatement :wink:

I am new to the HLSL / cgfx shader world . Do you think that that the *_NV20 examples should work with current implementations of Cg1.2 ?

well, i code my stuff directly in vertex & shader programs, no real reason, thats just me :wink:

I just use glew to initialise the openGL extensions, which i do within initializePlugin(). I see no reason why you could not initialize Cg in the same way.

The texture problem is basically my main nasty gripe at the moment. I’ll try and send you my basic code for a Hw Shader (really basic ambient, diffuse, specular openGL 1.1 implimentation). I’d look to using the MTexture and MTextureCache though to make the shader perform a little better (study the devkit examples).

I’m not a fan of the devkit examples tbh, very few give you any real insight into how to do it properly. Also, having to connect the shader to the hardwareShader attribute of a surface material seems a bit counter-intuitive to me. It’s also very annoying that the shader only displays when you have texturing enabled…

ps. I’m slowly starting to hate HwShaders. I don’t think anyone at alias has actually tested the interface under linux, i can’t get any of the devkit examples to work, and am quickly coming to the conclusion that it might actually be totally broken under linux… :frowning:


#5

Check your private messages.


#6

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.