Home Technical Talk

glass shader in 3DSMax viewport ?

grand marshal polycounter
Offline / Send Message
pior grand marshal polycounter
Hey all. I've been trying to figure a very small thing but failed miserably :P

Do you know if there is a way to display a rough aproximation of a glass shader in a realtime 3DSMax viewport? By this I mean a transparent object that still shows a hotspot reflected from lightsources. Because when giving a 0% opacity and strong spec to an object, said object gets rendered perfectly in a scaline render but completely disappears in the realtime viewport.

I am hunting for that kind of looks :
Crystal-Ball.jpg

I have seen many demos showing objects with such a material, even with realtime hdri and refractions. So I was curious to know if there are .FX librairies available for Max doing that kind of effect.

Which makes me think about something else. I have searched a fair bit already but couldn't really find librairies of realtime shaders for Max except Ben Cloward's and the Nvidia CGFX plugin. Is there some place where to find some nice premade .FX, or artist-friendly shader editors that output max-compatible shader code?

Thanks if you can help!

Replies

  • Joao Sapiro
    Offline / Send Message
    Joao Sapiro sublime tool
    i can ask a programmer friend that is developing an engine if he can make .fx to 3ds max , cant promise thou..its something i also want eheh...
  • poopinmymouth
    Offline / Send Message
    poopinmymouth polycounter lvl 19
    Download RenderMonkey and the Nvidia one, I think it's called CG something. Both come with premades, and can output to .fx, and I think glass is one of them.

    We have one at NS, but as usual, it's NDA, heheh.

    poop.gif
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    I tried the fx composer glass.fx but as it relies on automatic textures that fx composer generates, it will not work with 3dsmax. then again if its just the specular that bugs you, and you dont need fake reflections/refraction, then it would be a not too hard to write shader.

    I'll give it a try...

    okay got something working now

    simple_glass_vertex.jpg

    the light position is not correct, not sure how to retrieve it from max properly yet, will work it out.

    and the effect is per-vertex now, per-pixel technique to come.

    There is 2 sorts of rim lighting options, one time based on the light and one time based on camera.

    to make the transparency works well in the viewport make sure that you do:

    object properties-> Rendering Control -> Visibility = any value < 1.0

    there is no reflection/refraction stuff for simplicity. It would be done via a cubemap that you pass in. Not sure if I have that much time to do that as well, but I will do the per pixel version now

    http://crazybutcher.cottages.polycount.com/wip/fxshaders/simple_glass.fx
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    simple_glass_pixel.jpg

    now with per pixel support, too. It's a bit super glowy but well, hopefully it helps. Light position seems to be warped a bit, but at least moving an omni light around does change something now.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Woah that's so cool! And fast! This is exactly what I was after - and the rim light effect is a sweet addition. It will be very, very handy for things such as eyeballs and visors, as I like realtime screenshots way better than renders. I was stuck with 'fixed' specular workarounds before but this is just great smile.gif

    I'll give it a try asap and will show you the results. Very nice of you man.

    Now that you mention it, cubemap based-spec is a nice idea, but overkill for what I was after. Anyways, I think I am going to try and understand the syntax of these sweet .fx files from now on.

    Nice fur on that horse, also :P Is this the fur shader provided with max? Or a just alphas?

    Thanks again!
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    just alphas for the fur.
    and no problem always wanted to play with fx composer and max. waiting for fx composer 2.0 to support cgfx which I intend to add to our engine, too, so far we had our own .shader format.
  • EarthQuake
    Cooool shader looks nice, we were actually just about to look into something like this for eyes for the project i'm working on as well. Do you mind if I have our programmers look over what you're doing there CB?
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    sure, the shader is really simple, it's just adding the specular into the alpha basically.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Okay, it works!

    old_011.jpg

    I used it on the cornea lens and also on a thin object I put where the eyeball meets the lower eyelid. I also rotated the cornea normals slightly to get better control on highlight position.

    Only drawback is that the objects dosent appear transparent on top of other object if said transparent objects are not selected. On deselection, it's shows up fine until I rotate/pan/zoom the viewport.

    Anyways! Awesome tool I must say. Thumbs up!
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    have you done the "visibility" object propertiy I mentioned above ? that fixed the transparency sorting issue for me. Else max will not know that it is transparent and treat it like opaque.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Ha yeah still need to play with that. Since the result was already workable I thought I didnt need to. My bad! I'll check that tonight.
  • EarthQuake
    eyes are way too white you silly french man!
  • conte
    Offline / Send Message
    conte polycounter lvl 18
    pior, great result!=) put more bloody red to eyes=))))
  • Fuse
    Offline / Send Message
    Fuse polycounter lvl 18
    i've a question, is there a way for me to up the aa in the viewport ? should i go into ati settings and enforce it manually ?

    i also prefer to use viewport screens
  • conte
    Offline / Send Message
    conte polycounter lvl 18
    CrazyButcher
    hello! i am searching directx realtime shader, what support cubemaps or reflections. Can u write one? please?=)
    that's for eyes too.
Sign In or Register to comment.