Home Technical Talk

Xoliul's 3DS Max and Maya Viewport Shader

1457910

Replies

  • boyluya
    Offline / Send Message
    boyluya polycounter lvl 10
    Hey laurens my man, really awesome shader! Started playing with it last night but I couldn't get a "true glow" with my glow maps.

    Here's what it looks like.

    tower3.jpg


    Plus I'm having an error when I try to load cubemaps (actually i'm a noob when it comes to this). Am I not doing something that needs to? Thanks.

    cubemap_prob.jpg
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    00Zero wrote: »
    just tried out the shader for the first time last night. its super great, thanks laurens. I can finally get stuff to look close to how our assets look at work. thanks for all the effort, the video tutorial helped a lot.

    Thanks Serozh! I thought you used Maya? And yeah I noticed how things in MW2 frequently get this cool fresnel rim effect around it, sorta like my shader, I always notice that when I play :p

    Boyluya: the "actual" glow thing has been pretty much the most asked about issue lately, but I haven't been able to do that yet. You can fake it by using bloom and tweaking that a bit.
    Regarding the DDS: sounds like a problem other people have had before. See if it works in 32bit Max. There was a topic about this on Polycount before.
  • slave_one
    Offline / Send Message
    slave_one polycounter lvl 18
    Xoliul, awesome work once again! Great video on setting up the shader as well.

    Boyluya: I had the same prob a while ago (when using the 1.3 version) For me the problem got fixed by disabling shaderFX .. (for some strange reason). BradMeyers had something similar and for him it was due to polyboost. (see his post here ... http://boards.polycount.net/showpost.php?p=978464&postcount=92) Don't know if there is a topic about this .. this is just what I know .. hope it helps!
  • Taz
    Awesome Shader Xoliul :thumbup:

    Quick Test, More to come :poly121:

    02.jpg
    Nismo_Front_Test.jpg?w=ae6b9211
  • Revel
    Offline / Send Message
    Revel interpolator
    Hi Laurens, really great shader man! love it very much.

    One question though, how to tell whether we need to check the "flip green" checkbox?..I generate the normal map from nVidia Photoshop filter. Can we tell the "which one in need to flip - which one is don't" from the visual appearance of the normal map itself? (for example like which colour point in which direction)

    Once again thanks for this great shader!

    _Revel
  • felipefrango
    Offline / Send Message
    felipefrango polycounter lvl 9
    Revel wrote: »
    Hi Laurens, really great shader man! love it very much.

    One question though, how to tell whether we need to check the "flip green" checkbox?..I generate the normal map from nVidia Photoshop filter. Can we tell the "which one in need to flip - which one is don't" from the visual appearance of the normal map itself? (for example like which colour point in which direction)

    Once again thanks for this great shader!

    _Revel

    Yeah, it's definitely visible. The green channel controls the Y direction of the light, so everything looks pretty much inside out. Holes become bulks and vice versa.
  • Revel
    Offline / Send Message
    Revel interpolator
    Hi Felipe, yes that we can see the inside out effect on the object. But what about on the map itself? I mean not when applied on the object but in Photohop, for example..is there any definite "green should be pointing up" or such? or we can just tell it after applied it into the 3d object?...

    Cus seems like everybody said that Max use a flipped green channel but in my case the un-check version is looks much nicer..hmmm :poly132:

    _Revel
  • felipefrango
    Offline / Send Message
    felipefrango polycounter lvl 9
    Revel wrote: »
    Hi Felipe, yes that we can see the inside out effect on the object. But what about on the map itself? I mean not when applied on the object but in Photohop, for example..is there any definite "green should be pointing up" or such? or we can just tell it after applied it into the 3d object?...

    Cus seems like everybody said that Max use a flipped green channel but in my case the un-check version is looks much nicer..hmmm :poly132:

    _Revel

    Oh, I see what you mean, but yeah, it's also noticeable:

    ezlo5f.jpg

    Now, I don't know which is which, but you can see the green information either appears on the top or at the bottom of the shapes. The one on the left was how it baked from Max by default (although you can invert the green channel when baking), and it showed ok using Xoliul's shader.
  • Revel
    Offline / Send Message
    Revel interpolator
    Heheh ok thanks man..Guess what appear on the object is more important then which way the green should face (duh!..obviously lol)

    By turning off the diffuse map for a sec will show much clearer which setting should go with particular model regarding the normal map :poly142:

    _Revel
  • ScoobyDoofus
    Offline / Send Message
    ScoobyDoofus polycounter lvl 20
    Hey Xoliul,

    Love the shader! Thanks so much for all the time you've invested to make this great tool for the community. It makes almost everything look better.

    That said, I have 2 things I'd love to see personally.

    Maybe they are in there already and Im just too dumb to make them work correctly. Also apologies if these gripes have been mentioned elsewhere. Too lazy to read the whole thread.

    First is a "clear" button next to the reload button on all image fields.
    If Ive dropped an image into a slot, it doesn't seem like there is any way currently to remove it. I cant even drag a "none" value into the slot from another field, like most other Max dialogs. I can replace it with another image, but what if I just want it gone? As it is, I've got to reload the shader, and completely re do all my configuration. Very tedious.

    Second, is the Half-Lambert shading option. You've got a power spinner, but thats not quite the same as "intensity" or opacity. The default value is 2.0, which is a little strong, IMO. if I dial up the value to darken the effect, it also makes my material go metallic/contrasty. Not quite what I'm looking for. I'm just wanting to reduce the intensity, to make it more like regular shading or to split the difference. Is this possible?

    Anyway, thanks again for the shader!
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Revel, didn't see your post yesterday, glad Felipe put you on your way. It's really a general thing not exactly related to the shader.

    Scooby, thanks for the feedback.
    Regarding the "clear" button; I'll check if that is possible, if the default SAS UI supports it I can add it. I never needed that though; If you don't want to use a map, turn off the checkbox for it and it'll show the default global value again. There's no point in turning on the "use map" checkbox with no image in the slot, as that'll load pure black...
    Regarding Half Lambert; I'm a bit confused as to what you want. The default value of 2.0 is what Valve uses for TF2 shading, and I figured this as a good base. I think you're expecting the wrong functionality from this value; it controls the hardness of the HL shading. If you want to control global intensity, I'd recommend using the ambient controls. There isn't much point in wanting to have Half Lambert be more similar to regular Phong shading, as the whole point is that it's different...
  • Revel
    Offline / Send Message
    Revel interpolator
    No worries man!
    I just ask it whether your shader's normal map section behave the similar way then Max's standard shader or not (without the "flip green" checked, cus its on by default)..I'm still quite new to texture creation thingy, from what I heard and read that eveybody been trying to say that Max use flipped green channel so need to do it in PS manually, but I found that turning off "flip green" on your shader looks better on my latest model (I didn't flip it in PS also), well actually this is my first model using your shader and I love it!...

    Then I just come to conclusion that it doesn't matter "green should face what direction" but instead "does it look correct in my model or not"...heheh..guess I just think too much about this flipping green issue :poly132:

    Once again, thanks for sharing this to the community!

    _Revel
  • feriferi
    working v-ray i dont no plz teel me
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    feriferi wrote: »
    working v-ray i dont no plz teel me

    Try again, with an attempt at proper sentence structure this time.
  • Revel
    Offline / Send Message
    Revel interpolator
    Mop
    Lol..I guess what he mean was "how to make it working with V-Ray, I don't know please tell me" hmm..I think so.. :poly132:

    feriferi
    But the thing is, this is a viewport shader with a realtime render. You get the result from the viewport, as like what you get from the game engine. You don't need to render it out, in fact when you render it the materials all gone. And that's how it works.

    _Revel
  • felipefrango
    Offline / Send Message
    felipefrango polycounter lvl 9
    Maybe english isn't his first language. Not that it's a fair excuse but I'd rather believe that, otherwise it's just retarded.
  • A R K A I K O
  • Revel
    Offline / Send Message
    Revel interpolator
    Hi Laurens, I just notice something in your video Shader Setup Video 2 you've opened your PostShader folder which have few more fx to choose from compare to the one that we can download from your site. Just curious is there anyway we can download it/ update to the current 1.0 version?

    Cheers for the great sharer~!

    _Revel
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Those are test versions i think. Some might also be examples I just pulled out of 3DS Max/maps/fx/, to base my code on. Don't worry, you're not missing anything (don't bother trying the ones that come with Max, 80% doesn't work, the rest is crap).
  • tda
    Offline / Send Message
    tda polycounter lvl 16
    Hey laurens, im using your shader to render the materials on car i'm making at the moment and the realtime cubemapping makes it look gorgeous. While i was playing around with the frensel options today i got to thinking, would it be possible to get a single bounce of full raytrace reflection working in realtime with your shader? I know it'd probably be extremely performance hungry and but for cars or anything reflective it'd be an awesome feature.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Thanks TDA, but I'm afraid that's totally impossible. The way the current shader pipeline works, is that every object is calculated "by itself". That means, it has no idea of whatever is surrounding the object and has no way of accessing that information. It even goes as far as that, when computing the pixels on an object's surface, a single pixel does not have access to the pixels around it.
    The only thing that gets close, is having your application render to a cubemap rendertarget, and use that for reflections. Still means no self-reflection though.
  • Revel
    Offline / Send Message
    Revel interpolator
    Is there any way we can access/ use the alpha map other than saving it into the diffuse's alpha channel through .tga file?..it seems like saving .tga file make the file extra huge compare to the .jpeg that I usually use for diffuse/ spec/etc map..

    It'll be cool if we can have another map slot for alpha channel like the standard material.
    Or using .jpeg is a wrong thing to begin with?

    _Revel
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    revel, the realtime shaders for 3dsmax or any dcc app typically aid content creation where you normally work with uncompressed files.
    png and dds formats also support alpha channel and compression if you are really worried about filesize (but you shouldn't, this is not about shipping stuff)
  • Revel
    Offline / Send Message
    Revel interpolator
    Thanks for the answer CrazyButcher, so tga is a common file type to use in this realtime shader correct?..will try to use it more often then. Thanks.

    _Revel
  • Revel
    Offline / Send Message
    Revel interpolator
    I've been asking lots of question about your shader lately, hope you don't mind hehehh..
    What I wanna ask right now: is it possible to "cheat" the shadow of an object that have alpha/ transparency applied to it to display correctly?..like the pic below..

    shadowu.jpg

    Thanks in advance for any help..
    All the best to you and your shader Laurens!

    _Revel
  • zxcman
    Offline / Send Message
    zxcman polycounter lvl 10
    you can try to bake the light map
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Sure. You gotta duplicate them, and create a software material (standard) for them, with an opacity map. Set the material to show in viewport, and it should cast alpha masked shadows. Then you'll have to play with the other object's "cast shadow" settings and so. It's tricky and will probably not work 100% like you want it...
  • Incomitatum
    Offline / Send Message
    Incomitatum polycounter lvl 17
    For the life of me I cannot get shadows to show up. Now, faces are "shaded". I can see where the light is hitting vs where it is not, but nothing casts a shadow, hard or soft. :|

    Is it... Is it my video card? I have an Nvidia GeForce 9500 GT. I really wanted to make the most of this shader. Marmoset is nice, but I can't seem to make my models ultra sexy in it either.

    I am hoping it is not an issue of scale. I model everything in inches "to scale". I notice with Marmoset to get nice shadows I have to scale everything "Down". Here, I am not sure what direction to go, or if I even need to mess with it.
  • Revel
    Offline / Send Message
    Revel interpolator
    Are you sure you have checked "use shadow" in the 3 places? light propeties, viewport setting, xoliulshader properties?

    _Revel
  • Incomitatum
    Offline / Send Message
    Incomitatum polycounter lvl 17
    I have indeed.

    In fact, now that I have given up, I am seeing shadows with my "Default Lights", but not on materials I have the DX Shader on. :|
  • lildragn
    Offline / Send Message
    lildragn polycounter lvl 17
    Absolutely awesome shader Laurens, I'll be using it from now on, Marmoset is cool but kinda involved if you know what I mean :).

    Incomitatum what version of Max are you using? Make sure you go to the Lighting & Shadows menu for the viewport you want to enabled shadows for, then use "Scene Lights" and enable Hardware shading and make sure Hard Shadows are enabled. Good luck!

    ~t
  • Incomitatum
    Offline / Send Message
    Incomitatum polycounter lvl 17
    I think my problem was solved by installing a couple of the Hotfix updates. I had SP1 for 2010 already.

    And yes, Marmoset is pissing me right off so I will be using this or a 3 point lighting model and render from now on. I have gotten better results by importing and skinning my models in Crazy Bump of all things. :P
  • aNarchy
    will this shader working with max 2010 sp1?
  • firsak
    Can anyone explain why I get only half of FPS (yeah, right 0.5 fps) when I deform a model with a shader applied? It's fine if I just move the camera around or move the entire object (50-100 FPS in this case), but if I animate the object that has a Skin modifier or go to edit mesh/poly mode and transform polygons, vertices, etc - it is SLOW AS HELL.

    I use 3ds Max 2009 64, WinXP64SP2. My video is Ati 4650 1GB.
  • Incomitatum
    Offline / Send Message
    Incomitatum polycounter lvl 17
    I am having a new issue with this. Normally when I am done with the shader and want to cease using it. I copy an instance of my renderable texture up into the Texture Type button, thus going from DirectX Texture to Standard. This has been fine, but lately, if I do that I only see a wire-frame of my model regardless of if I am telling it to show in the view-port or not. If I don't have it selected, the whole model is invisible. It still -renders- fine, but will not show up in the view-port as anything other than a wire-frame, even if objects around it are showing up normally.

    I don't know how to undo this. I have tried nuking it, and rebuilding the material but it seems to plague anything with that Material ID. I have to try it in a whole new number on my Multi-sub Material. :|

    ::EDIT::
    I was able to resolve this by going back to a DirectX Shader, then telling it to only have 1 light and resetting all the lights to Default Lights; THEN overriding it with a standard material. Seems something was getting stuck in there.
  • NBLM
    Offline / Send Message
    NBLM polycounter lvl 13
    How i can use the shader with shadows in max 2010? The non-shadow version works fine,but if i select the other my model appear as a red wireframe.

    I have selected the hard shadows in the config. and turned them on in the Viewport.

    Any idea?
  • SpeCter
    Offline / Send Message
    SpeCter polycounter lvl 14
    @NBLM:

    ATI graphics card maybe?
  • NBLM
    Offline / Send Message
    NBLM polycounter lvl 13
    yes, x1950 pro
  • SpeCter
    Offline / Send Message
    SpeCter polycounter lvl 14
    It seems ATI graphic cards have problems with some features of this shader.I also have an ATI but with no problems, but with my old ones the Shader with shadow just crashed my max, be lucky that it just turns to a wireframe.

    One suggestion though, make a new Material(don´t copy your old one) apply a standard material to your model and then the new one . For me this sometimes helped with the "red wireframe" issuse.
  • Miguelito
    Offline / Send Message
    Miguelito polycounter lvl 18
    Hey Xoliul. I really love the shader. I have little request though. I tried to change some stuff in the render passes to switch to alpha test mode. I switched Alphablend mode to false and added those lines:
    alpharef = 128;
    alphafunc = greaterequal;
    The Sorting of my alpha planes worked fine after that. But it seems that turning off alphablend mode disables the Fresnel Reflections somehow. And that makes me sad!
    Maybe you have an idea why this happens.
    Also in the next update you could add an option to switch between alphablend and alphatest :)

    Cheers
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Hey guys, sorry that I was a bit inactive here.
    The shader will work with all Max versions from 9 onwards, but best you keep them updated: especially for 2010 a few fixes can solve issues.
    Hardwarewise it's the same story all over, NBLM. Your card is too old and has silly ATi issues, upgrade to Nvidia to get rid of these problems.
    Firsak: skinning isn't done by the shader, it's all performed on CPU so it's dreadfully slow. Not my fault, it's just how Max works.

    Miguelito; thanks for the post, I never got those pass options right for alpha test. Thing is, the shader has become so big, that I must do things in two passes. The fresnel stuff is done in a seperate pass and blended additively on top, something that probably doesn't play nice with alphatest. I'll look into it.
  • Miguelito
    Offline / Send Message
    Miguelito polycounter lvl 18
    Excellent. Thank you :)
  • advance-software
    Hi Laurens,

    The problems you've run into re-dynamic mesh performance & compiler limitations are DirectX Shader limitations, not 3dsmax limitations. A 3dsmax shader built via the DirectX Manager interface builds & renders its own mesh, so could in theory hardware skin (though I haven't tried doing this yet). Secondly, by running directly through the latest Microsoft DirectX HLSL shader compiler you can avoid many of the problems of the DirectX Shader compiler. You're still however limited to SM3 constraints & no standard 3dsmax real-time shadows. It might be possible to implement independent shadowing in the viewport but I haven't had time to look at this yet either. Variance shadow mapping is more accurate than 3dsmax standard viewport PCF solution.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Hey advance. I'm pretty sure hardware skinning is not possible, the guys from ShaderFX (Ben & Kees are much more experienced with shaders in Max than me) state it's not possible. I think this is just because Max doesn't feed the weights and deformations to the shader; there's just no interface for it. Unless you'd go around it with scripting but, I don't think anybody wants to go there.
    Regarding the compiler: do you mean the runtime DXSAS compiler vs precompiling your FX files to assembly code ? I really prefer not to do this as it adds another extra, tedious step to the process + it closes my source code away from other people, something I want to avoid.
    The shadows are also really hard; it would require c++ plugins or similar, and even then I don't know if the SDk even allows this sort of access to the viewport.
  • advance-software
    Hey.

    We have a C++ plugin that can do everything I've stated.
    The hardware skinning & shadows aren't there yet, but support could be added - it's just finding the time. I'm busy porting our engine to OpenGL/Linux at the moment.
    Infinity (our engine) has support for variance shadow mapping & I should be able to port that implementation into our max shader.
    Regarding the compiler - our solution works basically the same way as the DXSAS compiler you're using - compiling from source except it dynamically recompiles on the fly as the shader configuration changes. This means you don't need a bunch of if statements all the way through the shader slowing it down & using up valuable instructions as it dynamically compiles in the bits it needs as required.

    The MaxSDK provides full DirectX9 access to the viewport via the DirectX Manager C++ SDK plugin interface.

    I think it makes sense to enable third party access to our shader pipeline, but this will require extra work to allow you to define additional rollout parameters like the DirectX Shader does. Our current implementation has a hardwired rollout that implements everything I need in our current shader.

    I don't think anyone's tried pushing the DirectX Manager interface yet - the only examples I know of are ours (Infinity Shader) and the two SDK examples - MetalBump9 & Lightmap.

    Edit: Will do.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Well, what you are saying sounds interesting, I'm just hoping your solution will be as open as possible, not limiting to specific implementations as most solutions these days seem to be. Do keep me updated if you get all of this working.

    Small update: my shader now supports Maya. I ported the current 1.5 version and gave it a small test, seems to run OK. Not guaranteed to be flawless, that's why I putting it out there, to get tested.
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    YAY another maya shader I can use as reference :) I was pounding my head as to why my shader wasnt working in maya and then saw in one of the reference shaders I downloaded that cull mode has to be set to none

    EDIT: Will give it a whirl when I get back home.
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Just wanted to pop in and say that everything works. Now to study it :)

    EDIT: Tested on Maya 2011
  • zxcman
    Offline / Send Message
    zxcman polycounter lvl 10
    when can we see new updates? =)
  • willy-wilson
    Offline / Send Message
    willy-wilson polycounter lvl 8
    hmm i couldn't get my alpha to work :/
1457910
Sign In or Register to comment.