Home Technical Talk

Free Maya/max cgfx/fx Shader

135

Replies

  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    @bugo: you haven't reply yet to my post on the other shader. Your screenshot is done using this brdf shader, so I guess your problems are different. I'll check today at work since that might be a sampler state issue (a configuration of the textures). Basically the bug looks like the texture is not wrapping (repeating outside 0-1 uv range). As I mentionned i had this bug before but I cannot reproduce it all the time, since just reloading the shader fixes it :) A first test would simply be to check if the texture displays properly between 0 and 1. If not I'll send you a bunch of simpler shaders to see if the problem stills shows up.
    (btw maya uses openGL so this has nothing to do with directX)
    Please post the issue from one shader into its own thread btw it'll be easier.

    @MM glad to see you got it working :) Adding multi-lamp is one of my future goal. But since the shading is based on a texture it is less easy than just adding lamps intensities together as with regular lighting solution. I just need to think of an efficient way to do it.
    The black outline bug use to show up on earliest version of the shader on 8xxx series. Are you sure you are using the latest beta version posted on this thread? I haven't been updating the webpage for some time now.

    vertex inputs are just below parameters, they specify how vertex informations from the mesh should be connected to the shader (normals, color, position, uvs etc)

    inputs.gif
    this is the screen for the env shader's vertex inputs (http://boards.polycount.net/showthread.php?t=54839) but most of these are pretty common across shaders.
    post some screens, it's nice to see something else than problems :D


    cheers
  • MM
    Offline / Send Message
    MM polycounter lvl 17
    vista64 + 8800 gt + maya 2008 (ext 2)

    one the left is just normal map plugged, on the right is diffuse + normal

    btw, this is v3 and you were right, i was getting the black shadows on earlier versions.

    1431203.jpg
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    yes, that´s exactly what im getting MM! Hey Brice, i got here for not long time, but i will answer the other shader later, thanks man.
  • MM
    Offline / Send Message
    MM polycounter lvl 17
    here is a screen of the working shader version 3 on 8800gtx+xp64+maya2008

    diffuse+normal+spec+glow
    BR_CGFX3.jpg
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    My congrats Bryce, wasnt your birthday yesterday?
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    hehe thx, but in my timezone it is still my birthday ^^
    I did some quick tests today with MM and the problem doesn't seem to be where i was expecting it to be, so this is gonna probably take some more time :S This doesn't stop him from doing some cool screenshots :P congrats
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    ow, so, MY CONGRATS MAN! Have a great day on your birthday buddy!
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    Got the shader working, and am using it to try to emulate some of Valve's shaders used in TF2 with a decent amount of success.

    I need to take some nice big renders (not just screengrabs), and was wondering how to go about using Maya's Hardware render to do it. I've fumbled around in the render settings, but only managed to render out a black screen so far. If someone could post a screengrab of their settings it would be really helpful, or just a description would do.
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Great :) yeah tf2 is also lookup based so it should be pretty simple. I have a paper somewhere from valve about the shading in tf2: Most of it is really simple, even tough not everything works the same way in this one (especially the rim effect etc)
    Sorry but for hardware rendering everything works out of the box for me, so I can't really tell where the problem is :S
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    MM wrote: »
    vista64 + 8800 gt + maya 2008 (ext 2)

    one the left is just normal map plugged, on the right is diffuse + normal

    btw, this is v3 and you were right, i was getting the black shadows on earlier versions.

    1431203.jpg

    Yeah, no matter what I do, i am always getting these results, i tried to install another driver, reinstall cg sdk and directx sdk, still nothing. How did you make it work MM?
  • rebb
    Offline / Send Message
    rebb polycounter lvl 17
    Is it possible that, since its a "Hardware Renderer", the Graphics Card needs to be able to support the huge Resolutions you are trying to render out ?

    Maybe yours doesn't have enough Memory or some other Limitation that causes the huge Ouput to just be black.
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    nah, even at the default 640x480 I'm getting a black screen. This is on a geforce 7950, BTW.

    Brice, it would be cool if you could find a way to clamp the rimlight effect to normals pointing upward-ish (or a user-defined direction and tolerance). The current effect is more "mario galaxy" than TF2.
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Hey cheese that's already the way it works (see top of this page). The only difference with tf2 is that I use a constant color, while they sample the color from the ambient 'cubemap'.

    http://www.valvesoftware.com/publications/2007/NPAR07_IllustrativeRenderingInTeamFortress2.pdf
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    well, I have a Geforce 8800gts 640mb, and I´m using xp x64, near as MM´s using.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Beta3 rocks! Loving the new tickboxes!
    There might be one more suggestion : maybe adding 2 more tickboxes to invert the X and Y orientation of the gradient texture. I would expect some engines to adopt different standards (just like normalmaps...) hence it would be nice to adjust this on the fly in the shader as opposed to having flipped variants of the same image stored somewhere.
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    Hi Brice, i went trying your first 1.0 and 1.1 version and it works, but 2.0 and 3.0 dont, do you think I should change something on my nvidia settings?
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    The samplers (the way the shader fetch textures) are identical. I guess the problem lies somewhere else. Maybe it's about reaching a max number of samplers or anything more specific to the card. I don't really have time to look for it at the moment but I'd definitely like to solve it one day ^^
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    cool Brice, no problem at all, any help testing it im here
  • KillerPlatypus
    Hey Brice, I recently stumbled across your shader and I must say it is awesome.

    I have two questions,

    Is there a way to adjust the intensity of your lamp other then the color slider, as it seems that the lamp only effects the color of the model in a very small range?

    Is there some secret to getting the SSS to work, as again the intensity of the back light coming through does not seem to be working for me? I am not getting nearly close to the same effect you produced in your little tutorial. Is there anyway that you can post an example of the alpha map you used get the light passing through skin look?

    I have read all of your documentation and I think I am setting it up the correct way I just wanted to be sure.

    Again man this shader rocks :thumbup:
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Hi there :)
    I don't use translucence very often. I just checked and the version 1.1 of the shader supports it, but it is broken for some reason on the latest beta. I'm very busy at work these days but I need to look into this :)
    The intensity of the diffuse contribution is limited to the range of the brdf lookup, which is 0-1. It might indeed be a good idea to offer a slider to scale it, and it's very easy to integrate.

    Do you need some specific functions of the shader only available in the beta or can you make it with the 1.1 release? I'll try to look into it soon, thanks for your input
  • KillerPlatypus
    I have been using the beta shader, as the controls come very close to mimicking a real time shader I use at work.

    One difference from your shader is, we use what we refer as a transmission map to control to control fake sss. This an additional color map with an alpha channel that controls what color bleeds through the surface and to what itensity(anything close to black in the alpha gets masked out entirely). We also have the ability to adjust the intensity of this to give more bleed through or less. This really comes in handy when your creating monsters, etc. that are very fleshy.

    There is really nothing I am specifically looking for as I am just having fun playing around with this shader, but I just wanted to give some feedback.

    When I get a chance I will post some of my personal work on here :)
  • rooster
    Offline / Send Message
    rooster mod
    hi brice, i got some time so im trying to give it a go, if I load the shader and apply it to a sphere, it goes green- is that normal? the material preview shows a white sphere
  • Funky Bunnies
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    weird, are you sure hardware texturing is enabled, rooster?
  • rooster
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    Hey Brice, just bugging you a bit, is there a chance to create 4-bit alpha instead of 1-bit?
    Thanks man
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    I guess you mean 8bits right? like alpha blended?
    There is no way I'm aware of to do a proper sorting per polygon in maya, but I could create a second technique to allow transparency. You would then need to split the mesh for the sorting to work properly per object. We're crunching for a deadline in about two weeks, I might take a look at it afterward :)

    cheers
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    Thanks a lot Brice, you rock
  • frogspasm
    Hey Brice,

    Very awesome of you to have done all this! I had a question about CGFX and sprite particles. Do you know if they can be made compatible? I've tried using a generic CGFX shader (not yours) assigned to Maya's sprites, but the shader doesn't seem to be viewable on the particles. I expect you could get some pretty cool realtime effects if it worked.

    ~Mike D.
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    That's funny because I made some searches a few days ago to do that, and I was very disappointed, because it seems you can't do it...
    For some reasons it seems maya has its own way of rendering particles that the cgfx plugin don't understand. The vertex information might not be passed to the shader properly while in regular engines particles are just meshes. Another defect to mention to Autodesk :P
  • Master_v12
    Hey awesome work man. I only got one question. How do you make your map 2 sided?
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Do you mean having a double-sided mesh?

    if that's what you're looking for just open the shader with a text editor and add this: "CullFaceEnable=false;" just before "VertexProgram = compile [...]" at the very end of the script
  • Master_v12
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    This seems really cool Brice!

    Is there any tutorial or get started guide on this?

    Been fiddling a bit with both your 1.1 and 3 Beta version in Maya 2008 and I'm not getting them to work all that well. 1.1 did not show proper Gouraud shading, but the 3 Beta version had it. Although with the 3 Beta version I have my diffuse map floating around on the surface and I cannot get my normal map to show.

    I am guessing I have to set the correct UV-map in the Vertex Data > TextCoord input field, but I am unsure how to set up this link.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    After some more experimenting I found that the Vertex Data -> TexCoord as "uv:map1" seems to work fine with the version 1.1 Shader, but not the 3 Beta version. On the other hand there's other stuff that I haven't figured with version 1.1 (does not work?) as I previously wrote about.

    I am going to try this on my highend laptop here at work to see if I get the same results. Apparently some people have got it working here, referring to the screenshots in this thread.

    Update

    The v3 Beta works fine on my laptop with Maya 2008. Laptop has a Nvidia Quadro NVS 320M. The workstation which has problems with the shaders has a Nvidia GeForce 8800GT.

    brdfscreen1cw0.th.jpg
    Diffuse, Spec, Normalmap, Cubemap, BRDF, some rimlight, etc. Everything seems to be working on the laptop. Too bad it doesn't work properly with the 8800, wanted to show this to my students.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    Man I am loving this shader so far. If only I could get it working on my workstation (Vista 64bit, Maya 2008 32bit, GF8800GT).

    Here's some more screwing around with a human face. Using a flat colored diffuse, the bundled BRDF SSS texture and a very simple normal map (smoothed version).

    emanuelfacebrdfshaderhw9.th.jpg
  • pixelherder
    Offline / Send Message
    pixelherder polycounter lvl 18
    looking at some of the example in this thread, i'm chomping at the bit to my hands on this, as theres not a lot like it out there (that i'm aware of)

    however, whatever i do i cant seem to get it to work at all - either version 1 from the website or the latest beta in this thread. I dont know if its the shader, or user error on my part - so if i'm just being very dense, my apologies!

    i've tried it on multiple configurations
    maya 2008 ext 2, winxp 32bit, 8800gts, 181.20 drivers
    and
    maya 2009 64 bit, vista 64 bit, 9600gt, 180.48 drivers

    shader 1.1
    - textures show up alright but the lighting in v1 seems like a toon shader. when you plug in a brdf shader it just get weirder

    shaderv1.gif

    shader 3 beta
    - texture Dont show up at all - theres's just a weird pixelated wireframe across the whole object.

    shaderv2.gif

    i dont know if youre still developing the shader, but i'm keeping my fingers crossed that you are!
  • thomasp
    Offline / Send Message
    thomasp hero character
    have you plugged in normal maps for those tests? some shaders do have a tendency to look silly without per-pixel normals assigned. also some can look stupid if you view them in an orthogonal viewport and/or with the wrong type of light in the scene. they're fairly specific affairs.

    note - i haven't used the maya-version of the shader discussed in this thread so take it with a grain of salt.
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Hi there :)
    I'm still working once in a while on it ^^ I'd like to have the soft self-shadowing to work before i release the next version.
    The black spot looks like the usual bug I had only showing up on 8xxx, it is corrected on most versions (including the beta(s)), I REALLY need to update the web page... soon(tm)
    The second screenshot is more confusing. The fact is that I couldn't produce such an effect even if I wanted to. I had a similar problem once at work with another shader and it was a driver issue. It seems like mipmapping is going wrong.
    An easy way to check is to use a very colored image (like a checker of red and pink, so that it doesn't average to a grayish color) and see if you have the same hues showing up (in the solid color and the 'wireframe').
    I think most problems are from the crappy cgfx plugin maya is using, I never had that much problems under our directX engine at ccp. For some reason friends of mine had less trouble after installing the Cg Toolkit from Nvidia (http://developer.nvidia.com/object/cg_toolkit.html) but I never checked (since I mysteriously hardly ever have a problem ^^).
    Do you have the same issue with both systems?
  • pixelherder
    Offline / Send Message
    pixelherder polycounter lvl 18
    thomasp wrote: »
    have you plugged in normal maps for those tests? some shaders do have a tendency to look silly without per-pixel normals assigned. also some can look stupid if you view them in an orthogonal viewport and/or with the wrong type of light in the scene. they're fairly specific affairs.

    not in the examples i've posted, but i have tried it with things plugged into the slots. V1 will show textures correctly, but wont shade properly while ver 3 wont map textures properly...not much else i can try at the moment!
  • pixelherder
    Offline / Send Message
    pixelherder polycounter lvl 18
    An easy way to check is to use a very colored image (like a checker of red and pink, so that it doesn't average to a grayish color) and see if you have the same hues showing up (in the solid color and the 'wireframe').
    I think most problems are from the crappy cgfx plugin maya is using, I never had that much problems under our directX engine at ccp. For some reason friends of mine had less trouble after installing the Cg Toolkit from Nvidia (http://developer.nvidia.com/object/cg_toolkit.html) but I never checked (since I mysteriously hardly ever have a problem ^^).
    Do you have the same issue with both systems?


    thanks for the reply!

    here's another test showing what textures are plugged in where - i've also installed cgtoolkit, but things are still a little, er, unusual!

    shaderv3.gif

    and for added weirdness look what happens if you tick "use hemispheric ambient" - !
    shaderv4.gif
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Hi :)
    the first screen kinda 'validates' my theory of a driver issue (or anything else that could mess up mipmapping). The brownish color displayed is the value you would get by averaging the colors from your diffuse texture (red and flashy green) which is what you get by fetching the smallest mip.
    The hemispheric bug is especially weird hehe. It almost seems like the diffuse map is used as a brdf sampler but with no eye dependence.
    The wireframe showing up is something I couldn't even try to do. I remember at work it was loading lower mips really quickly, somehow dependent on the face normal. It produced a 'faceted fresnel' look even to meshes with smoothed normals.
    It would be interesting to try a modified version that displays ddx and ddy (the variables generated by the shader that calculate how quickly the surface varies to choose the appropriate mipmap). I'll see what I can do.
    Since I don't see any black spot, but a vista interface I assume you're using the beta shader and the 9600. Could you have a try at the 181.20 and see how it goes? My coworker really solved his own problem just by using different driver.

    Sorry I don't see anything here I could try on my side :S
  • pixelherder
    Offline / Send Message
    pixelherder polycounter lvl 18
    if i have a bit of time at the weekend i think i'll just try and find some older drivers and roll back - maybe that might do the trick.

    thanks again for looking into this!
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    btw could there be a conflict with some driver presets? like trying to force anisotropic filtering in the NVIDIA control panel?
  • pixelherder
    Offline / Send Message
    pixelherder polycounter lvl 18
    and the good news is it's all nvidia's fault

    i went back to 175.80 drivers, and so far everything works like a charm!

    nice way to start the weekend!
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    awesome ! now I want pretty pictures ;)
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    and the good news is it's all nvidia's fault

    i went back to 175.80 drivers, and so far everything works like a charm!

    nice way to start the weekend!

    Sweet!
    I can't wait to try this at my workstation. Will give you and update later.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    The 175.80 with 8800GT, Vista 64-bit, Maya 2008 ext2 32-bit, works fine!

    Thanks a lot for the all the good effort in this thread. Keep updating this lovely shader Brice. I am going to let my students try this shader this Wednesday.
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    nice ! invasion of question on Wednesday right? :P
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    Haha, if you want me to. I could force them all to post here to spam your thread, but I am not sure that would generate such a positive effect.

    I will definitely refer to this thread and encourage those who think they produce nice results with your shader to post here.

    v3 BETA is the latest right?
  • pixelherder
    Offline / Send Message
    pixelherder polycounter lvl 18
    awesome ! now I want pretty pictures ;)

    i'll see what i can do!
135
Sign In or Register to comment.