Home Technical Talk

State of the: HLSL and CGFX in Maya

polycounter lvl 10
Offline / Send Message
chronic polycounter lvl 10
If anyone has some concrete information on performace differences between HLSL and CGFX in Maya I would really apreciate it. Currently I have been developing shaders hand coded in HLSL for Maya because I had some bad experiences with scene corruption with CGFX from the Mental Mill beta a few years ago. Any news on the current state of these things?
I have found the HLSL Reference on MSDN increadibly helpful ( http://msdn.microsoft.com/en-us/library/ee418346(VS.85).aspx ) - is there a similar reference for CGFX? I haven't had luck digging one up.
I know Maya's not the best target for development, but its what I use and I'm very forgiving.

Replies

  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
  • Brice Vandemoortele
    Options
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    HLSL in maya is emulated. A second buffer using directX is composited at every frame onto the native openGL viewport of maya. Performance of HLSL compared to cgfx is about 1/4th, based solely on my personal experience.
    It has the advantage of being able to load hdr textures, other than that: it sucks.
    (no reload button, weird connections name, doesn't support UIname, no custom matrix input, no integer slider etc)


    cheers :)
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    will profiles like fp40 and vp40 only run on Nvidia gpu's? - I don't have any ATI cards available to test?
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    I'm having problems getting user tweakable variables to show up in maya with default values set - colors, floats, bools, all are defaulting to 0. I've reread over my code and everything seems set up correctly - another set of eyes on it would be wonderful.

    lcShader.cgfx
  • Brice Vandemoortele
    Options
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Well you should avoid using 'half' and use 'float' instead. Sorry if you've taken that bad habit from my code hehe, but this should really be used as last optimization. It will cause more precision issue than gain in performance.
    And i just noticed that maya doesn't load default parameters of UI defined as half :)
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    thanks for the help - ill check out that fix for the UI
    dont worry, i didnt pick up the 'half' thing from you - i was under the incorrect? impression that GPU's did most of their internal calculations in half and that it was a best practices optimization - but it doesnt really make a difference for Maya shader dev.
  • Brice Vandemoortele
    Options
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    I think it makes a lot of sense when you have a precise target, like optimizing a PS3 shader for it to use just the exact size of the bus. But I used to do that in general, thinking it was inherently faster. It's not, but on the other side I had specific bugs using it.
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    seem like the cgfx plugin is incredibly finicky - i could only get default values to show up properly after adding: string type = "slider"; to my sliders. If thats not present even the other UI elements, unrelated to the sliders didn't work.

    EDIT: I spoke too soon - UI doesnt seem related to the above so much as to how i was loading my shaders
    I was loading them using a custom mel script to create and link the files - doing it by hand creates the correct UI.
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    Not sure if this is possible to do 'in shader':
    I'm interested in being able to throw away the geometry surface normal data and use 'hard' surface normals - no matter the input
  • Brice Vandemoortele
    Options
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    I think you can't, or I'd be very surprised.
    The normal is related to the surrounding geometry and is generated by a cpu process, something you can't do with the parallel/local nature of vertex shaders.
Sign In or Register to comment.