Home Technical Talk

Best 3dsmax realtime shader atm?

Ramza24
polycounter lvl 18
Offline / Send Message
Ramza24 polycounter lvl 18
Hi, just wondering what everyone was using these days to view their NM'd models in realtime. I'm using one I found from Ben Cloward, its a 3 light source, spec map shader for MAX. Not sure what everyone thinks is the best for games these days so I'd thought I'd ask.

Replies

  • Ryno
    Options
    Offline / Send Message
    Ryno polycounter lvl 18
    I just activate DX display under the Direct X Manager in the Material Editor. It won't display lightmaps that you have on another channel, but for diffuse, spec, normal, it works fine.
  • mvelasquez
    Options
    Offline / Send Message
    what Ryno said. I also tend to "save as .fx file" so you can load it up in a "directx 9 shader" I seem to get better results that way.
  • conte
    Options
    Offline / Send Message
    conte polycounter lvl 18
    Standart 3dsmax dx shader sux so much...
    i am second, any body have free and nice directx shader,
    what working with normal maps, alpha channel?
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Standard DX shader in Max8 is actually pretty damn good.
    Ben Cloward's is probably better for larger map sizes though, it just seems crisper to me (and handles specular better - default DX shader seems to ignore colour spec). You can also use it to add opacity but it doesn't look all that good in the viewport due to some sorting issues.
  • EarthQuake
  • conte
    Options
    Offline / Send Message
    conte polycounter lvl 18
    EarthQuake, we are talking about simple shader, not ss.
  • EarthQuake
    Options
    Offline / Send Message
    I dont see anywhere mentioned that he only wants a basic shader. Even if thats the case what harm could it posibly do to show him that one? Its bad ass dude, as you know.
  • Ramza24
    Options
    Offline / Send Message
    Ramza24 polycounter lvl 18
    Yeah I was thinking more .fx and DirectX shaders, but i get the feeling that not many have been written yet. I really like Mr. Cloward's shader, but sometimes the lighting seems off. May just be the way I set up my lights. Other than that, it's perfect for normal map work.

    MoP- How do you affect opacity?
  • Ryno
    Options
    Offline / Send Message
    Ryno polycounter lvl 18
    Does anyone have a shader that will also display an ambient occlusion/lightmap on channel 2 in addition to the diffuse, normal, and spec and opacity? Or even better, one that will do a good job of displaying specular color too?

    This would be for environmental objects, fyi. I've got one from one of our clients, but opacity is a little wonky and it really isn't kosher to use outside of their project.
  • Joshua Stubbles
    Options
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    I just look at everything in Xnormal :P

    go jogshy!
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Hey, I'm glad you guys like my shader. smile.gif Oh - and you don't have to call me "Mr Cloward" - just Ben is fine. Take a look at my latest project - it'll let any Max artist create FX shaders with no programming experience:

    http://www.lumonix.net/frames_shaderfx.html

    Kees Rijnen and I made it. It will be ready for release in a couple of weeks.
  • Pedro Amorim
    Options
    Offline / Send Message
    looks nice. looks node based.. is it?
    is it gonna be free?

    edit: just saw its gonna cost $249
  • Joshua Stubbles
    Options
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    Can we sign up for the beta test? wink.gif
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Our shader editor is node based, yes, and it's built right into 3ds Max. We are looking for people with experience writing shaders or working with other node based editors to join the beta testing. We want testers who are willing to work with the tool, give us feedback and suggestions, participate in forum discussion, and help us make ShaderFX better. If you'd like to help, send me an email and I'll get you an invitation.

    (We're not interested in people who download the plugin and then we never hear from you again.)

    -Ben
  • J.I. Styles
    Options
    Offline / Send Message
    J.I. Styles polycounter lvl 18
    "We're not interested in people who download the plugin and then we never hear from you again"

    I'm in that category right this second, but I promise I've got a nice little .txt file I'm filling up with comments and feedback when I get the chance to use it smile.gif
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Heheh - Good to hear from you, Joel! I'm really looking forward to getting your feedback. Do you have access to the beta board at Lumonix.net? If not, let me know and we'll give you access so you can post the stuff in your text file. Thanks a lot for helping us test it.
  • conte
    Options
    Offline / Send Message
    conte polycounter lvl 18
    woah, 250$!? that price is biting, u know;)
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Yeah - it does seem kinda expensive, but think about it this way: Right now, if you want to create real-time shaders in Max, you need to learn to program in HLSL. How long would that take? 6 months? A year? Let's say you were really dedicated and you had 8 hours per day and it only took you two months to learn HLSL. If you took weekends off that would be about 48 days. If you value your time at about $15 per hour that would come to a total of $5760 worth of time spent to learn to write shaders. Our system is a steal compared to that. smile.gif

    Not only that, but the end product of our system is a shader that's in the FX format - so anyone can use it. You don't need to the plugin to use the shaders - just to create them. That means that a game company only needs to buy one copy - for the artist that creates the shaders - and everyone else can benefit from it.
  • spacemonkey
    Options
    Offline / Send Message
    spacemonkey polycounter lvl 18
    hey ben, I'm be very interested in testing the plugin, you and Kees working together now? smile.gif he was a big loss for bioware but its great to see he should be doing just fine on his own!

    send me some info bdimonkey(HaT-)hotmail.com

    I have a project I shall be texturing soon and a max node based shader sounds the perfect alternative for waiting for Unreal 3 to be released in some form.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    looks neat, reminds me of rtzen, just even more artist friendly than it
    rtzen
    but I think rtzen has died or so...

    also had another app in mind, a procedural texture generator which was similar


    intend on doing something similar (graph based) for luxinia's shader editor in the future as well.

    about the price, well considering that you need to build up some vector maths knowledge the 15 $ per hour thing would reach the 250 pretty fast, then again imo one doesnt come around this knowledge if he seriously wants to get into shaders. however as noone wants to code "shaders" as in max materials either, just build together some effects and play around, the graph-based stuff should boost the ability and the fun factor greatly.

    sadly if you have an app like max which isnt exactly cheap, the 250 isn't much for a company, plus not all artists would need it, and I can understand them having the price a bit higher, after all you need to feed your familys somehow... and likely the people who warezed max wouldnt pay you a dime either wink.gif

    however I dont think the app will be alone for long, so get the cash in while the competition isnt out yet, or even more expensive smile.gif good luck with it.

    edit: on rtzen's death I quote someone from DICE who posted at beyond3d

    [ QUOTE ]
    RTzen was the only stand alone graph-based shader creation tool I knew about (it had both code and graph views) but it was IMO not very useful since it focused on just wrapping a single-pass FX shader commands into a graph instead of having a higher level abstraction that can handle multiple passes and arbitary lighting. This is of course very difficult to do if it's just a stand alone editor without a runtime system.

    [/ QUOTE ]

    just a question, what do you need max for actually ? I mean couldnt you sell it as standalone, as well ?
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Hi CrazyButcher! Thanks for your comments.

    I never used rtZen, but from what I saw in the demo videos that they released it seemed a lot more technical that our system. Kees and I are trying to make ShaderFX as easy as possible for artists.

    In theory it would be possible to make ShaderFX a stand-alone app - but one of the main strengths of the plugin is that it's tightly integrated into Max. You don't need to export your model to see it with the shaders applied, and you can see the results of the shader you're building update in real-time on your model. We're cutting out the extra step of taking your model out of Max to see the shader results.

    Also, all of the nodes that are avaliable to add to your shader node network are written in MaxScript. The advantage there is that any tech artist that knows HLSL and MaxScript can add new nodes and extend the system without needing to compile anything or even restart Max. So there's some flexibility there for more advanced users that probably wouldn't be as easy to keep if ShaderFX were stand-alone.

    Good luck adding your graph based editor to luxinia. They're really fun to play with like you said.

    -Ben
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    [ QUOTE ]
    any body have free and nice directx shader,
    what working with normal maps, alpha channel?

    [/ QUOTE ]

    I've got a decent one posted on my web site here:
    http://www.bencloward.com/shaders_NormalMapSpecular3lights.shtml

    This version does diffuse and specular and normal mapping and supports three point lights. On that page you can grab the version that supports transparency, or the non-transparent version. Is that what you meant by "alpha channel" ? If there's anything else you'd like to see in the shader, let me know and I'll see if I can get it in for you.
  • Neox
    Options
    Offline / Send Message
    Neox godlike master sticky
    Hey Ben, been using your shaders fr a while now, is it possible to get the alpha sorting to work right, or is that a max issue? And also i'd like to turn of that 2sided Mode, it almost looks like the inside of my model is additive, which ends up in some bad z-fighting areas on thin surfaces with 2 modelled sides.
    The shaders are great no question, and a big help to check how the models look like with normalmaps applied, i love em smile.gif
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Alpha sorting is a huge pain. It's not something that I can fix in the shader. Shaders only work at the individual object level, and sorting requires working with multiple objects to get them to draw in the right order. I'm pretty sure that it's something that has to be fixed in Max.

    As far as the 2 sided thing goes, that's a really easy change. Just open the shader in Notepad and do a search for:

    CullMode = none;

    Replace that with:

    CullMode = CW;

    There are probably several places where the change needs to happen so just keep doing the search until it doesn't find it anymore. Let me know if you have an issue with it and I'll take a look.
  • Ryno
    Options
    Offline / Send Message
    Ryno polycounter lvl 18
    [ QUOTE ]


    I've got a decent one posted on my web site here:
    http://www.bencloward.com/shaders_NormalMapSpecular3lights.shtml

    This version does diffuse and specular and normal mapping and supports three point lights. On that page you can grab the version that supports transparency, or the non-transparent version. Is that what you meant by "alpha channel" ? If there's anything else you'd like to see in the shader, let me know and I'll see if I can get it in for you.

    [/ QUOTE ]

    Thanks, Ben. My biggest issue however is finding one that will display lightmaps on a separate UV channel in conjunction with diffuse/normal/spec/opacity. Lightmap should be some sort of multiply function to the diffuse, and UV layout will be different (no overlaps) than the UVs for the diffuse/spec/normal.
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Adding a light map that uses a different channel is really easy. Do you want it to be a light map (additive) or a shadow map (multiply) ?
  • Ryno
    Options
    Offline / Send Message
    Ryno polycounter lvl 18
    Shadow! Multiply! Thanks!
  • Neox
    Options
    Offline / Send Message
    Neox godlike master sticky
    Thanks ben it works! I'll ask our Max Coder if he could take a look at that sorting issue, when he has some time smile.gif
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Here's the shader that does shadow mapping. It does everything that the shaders on my site do and also shadow mapping. If you want transparency, choose that technique from the Techniques drop-down.

    HLSLnormal_map_specular_3lights_trans_lightmap.fx

    I hope this is what you wanted. Let me know how it goes and if you have any questions.

    -Ben
  • Ryno
    Options
    Offline / Send Message
    Ryno polycounter lvl 18
    I'll give it a whirl tomorrow. Thanks for the help, Ben.
  • Eric Chadwick
    Options
    Offline / Send Message
    Ben, thanks for this cool shader!

    Doesn't work well though unless the UVs are in channels 1 and 2... my mesh was using the 3rd and 4th channels, but the shader would then force the diffuse to share the same UV as the lightmap.

    One thing that would be uber-helpful would be a 3d paint solution that let me paint into one UV, while showing 2 (or 3 or more!) UVs at once. Something like this:
    non-tiled_mask_example.jpg

    AFAIK there is no painting tool that allows this. We're using bitmap masks more and more, as a replacement for vertex alpha.

    I wonder if HLSL could dynamically update a texture that's in memory, like a bitmap being generated in RT by a painting script?
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    No problem, Eric. I'm glad you like it. I know that Max shows the little numerical inputs for you to pick the channels, but it doesn't work unless you leave them at their defaults (in the tests I've done anyway). Kinda frustrating. I wish Neil would make it so those numerical inputs either weren't editable, or even better, make it so changing them actually worked correctly.

    I've also been having issues lately with passing in UV coordinates or vertex colors when they're not in channel one. A lot of the time I just get garbage for UV coordinates (or a scrambled looking shadow map) when using channels other than one. Let me know if you see that problem. I want to let Autodesk know about it.

    The tool you're proposing would be very cool! I don't think Max's implementation of HLSL and textures works like that. It does update textures when they're saved in an external app, but I don't think it can update real-time as you paint. I could be wrong.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    they used to have a sample were you could paint in 3d view and it auto updates texture. that was pre-hlsl stuff when the painter interface was added, but at least in theory the texture is always the same at the end, hlsl or not...

    re-uploading the texture, while a bit slow if the texture is big, as I dont think they do partial updates, should still work...

    I am with you on the channel stuff, its really wonky, but I guess for them to improve such stuff they will either let middleware do it, or wait for max 10 wink.gif

    I just looked at the DxStdMtl2.cpp file and they nowhere call the function which allows specification of texcoord channels (IRenderMesh->SetMappingData). but I guess one could hack that in yourself ?
    also interesting that the function descriptors of IRenderMesh mention DirectX 10...

    edit: ben, the numerical inputs you refer to, where do they show in the DxShader material I dont see anything ?

    edit2: I digged a bit deeper and the "SetTextureParam" function of DxStdMtl2 doesnt actually use the last two parameters (mappingchannel) ?

    although stuff like that is pretty SDK specific, I will have a look over at sparks
  • Eric Chadwick
    Options
    Offline / Send Message
    Thanks Ben, I'll let you know if any UV errors popup.


    Peter Watje has a painter plugin that almost does what I'm looking for.
    http://www.max3dstuff.com/max5/3dPainterPrototype/help.html

    I'd love to see either of you guys tackle this one.

    If I put his map in the Mix Amt slot of a Mix map, then put two other bitmaps in the #1 and #2 slots, I can paint my mask. If I turn on Show Map In Viewport at the Mix map level, I see the mask I painted.

    Unfortunately tho, I have to manually toggle this off/on every time I want to update the Mix result in the viewport. If there was just an auto-update that worked, it'd be usable.

    It also doesn't support more than one UV, though it does seem to support tiling within the individual map controls themselves.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    tiling works as they pass texture matrices on map level, but texcoords is a different story.
    and cool for digging that up, that was the painter I meant.
  • Eric Chadwick
    Options
    Offline / Send Message
    Hmmm it seems to only have the illusion of tiling... looks like max bakes my tile settings into a single untiled image, then uses that in the viewport. Zooming in close reveals larger-than-expected texels.
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    CrazyButcher,

    There is some Max specific code for binding a mapping channel to a specific texcoord input. Details can be found on this page:

    http://sparks.discreet.com/knowledgebase...fect_format.htm

    Basically when you create your texture as a UI element in the FX file, you do it like this:

    texture colorTexture : DiffuseMap
    <
    string name = "default_color.dds";
    string UIName = "Diffuse Texture";
    int Texcoord = 0;
    int MapChannel = 0;
    >;

    The "int texcoord" and "int MapChannel" bits tell Max which Map Channel to put into which incoming texcoord. This also creates a little spinner in the UI in the Material Editor that appears to allow you to set which map channel the texture should use, but as far as I've been able to tell, it only works when the value is set to what it does originally.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    ah okay then no texture matrix but manual texture image...
    I am also just looking at the sourcecode of the "mix" map, the code was actually meant to support hardware blending of multiple textures (any multitexturing card with more than 2 units could render this in singlepass) but for some reason it looks like its not working at all (always shows only 1), I would have to debug it in detail to find out why... this bug is very old then. (because at the time it was written cards with 3 texture units were still new (that is pre geforce3)

    another test I did was using the painter in a dummy material, and set the output texture of it, as input bitmap in another material. I could still paint but didnt see the immediate updates, only after the "painter" texture got saved, it was loaded from the bitmap material.

    the reason for this is that I guess for performance sake the paintertexture only modifies the texture on video mem and then after you stopped your "paint" run it stores to disk.

    to make this work with hlsl textures we would need a special non-standard bitmap texture support in the hlsl files, not sure if that is easily achieveable, I doubt it a bit, as the dx material was done very straight forward, it loads the textures itself and so on.

    alternatively fix the "mix" material's realtime preview
    although this is actually a autodesk job..

    edit:
    ben then I suspect the dxmaterial not calling the proper functions when the UI changes stuff... problem is a lot of the functions used in it are exported from max, ie no source available...
  • Eric Chadwick
    Options
    Offline / Send Message
    Heheh, yeah. You might also try a Composite map containing two Mask maps, each containing a bitmap and the 3DPainter, with one Mask using the Inverse Mask checkbox...?
  • Ghostscape
    Options
    Offline / Send Message
    Ghostscape polycounter lvl 13
    [ QUOTE ]
    Here's the shader that does shadow mapping. It does everything that the shaders on my site do and also shadow mapping. If you want transparency, choose that technique from the Techniques drop-down.

    HLSLnormal_map_specular_3lights_trans_lightmap.fx

    I hope this is what you wanted. Let me know how it goes and if you have any questions.

    -Ben

    [/ QUOTE ]

    I have a question about this shader - it looks like it's using 1bit opacity, is there something I can change to make it 8bit instead? Also the opacity doesn't self-uh...I'm not sure the term. I have an interior inside a car(imagine that), and want to make the windows transparent, and the transparency shows right through the model, hiding the interior. For now I'm just detaching the interior but what am I doing wrong?

    edit: actually it is sometimes using 8bit alpha. With the interiors detached, if I have the Exterior selected, I can see the interior, and the windows are 8bit alpha. If I do not have the exteriors selected, or I have them all attached as one object, the interior vanishes, and the windows show straight through to viewport grey frown.gif Except I can see other car exteriors through one exterior's windows. I'm guessing it's some goofy alpha-sorting thing where it is having difficulty with the enclosed objects (sorting by bounding box or something?) And the reason the interiors show up only when I have the cars selected is because Max draws everything that isn't selected, then draws the selection on top.

    I don't know its 1:20 in the morning and the whole thing is confusing all I want is taxis so I can put them on a street and then blow them into bits laugh.gif
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    right click the objects that are transparent, and change "render visiblity" (or so) in their poperties to a value less than 1, so that max knows it should sort stuff.
  • Ghostscape
    Options
    Offline / Send Message
    Ghostscape polycounter lvl 13
    Hey that worked, thanks!
Sign In or Register to comment.