3DTotal Forums

3DTotal Forums (http://forums.3dtotal.com/index.php)
-   Realtime/Low poly art (http://forums.3dtotal.com/forumdisplay.php?f=7)
-   -   DirectX Shaders (http://forums.3dtotal.com/showthread.php?t=63244)

Buzzy 23-11-2008 05:46 PM

DirectX Shaders
 
Buzzy's 3dsMax DirectX Shaders

Latest Update 5/01/09
New Shader, codenamed 'Bleach' (for reasons I'll explain in a moment):
- Improved Vertex Color and Alpha support
- Tweaked the glow system to reduce blown-out glowing
- Added Light Attenuation (not yet linked to the lights' actual attenuation settings, but very good for moody lighting)
- Added Fresnel Highlights
- Added some simple subsurface scattering (nice alliteration, eh?)
- Added 'glowthru' subsurface scattering
- Half-Lambert is now tied to the alpha channel of the SSS map for added control
- Added a "Bleach Bypass" filter. Hence the shaders name. This is by no
means the marquee feature, its just a nifty little addition.

This shader is still a bit raw I feel, so I wanted to get it into your hands and see if you folks can exploit it to the point of breaking. So test the heck out of this and give me some feedback. With DomWar going on, I'm sure you all have nearly-complete characters to use as guinea pigs. ;)

Shader_Donze_Bleach_Beta.fx
Shader_Donze_Bleach_NoShad.fx




Important Info Concerning All Shaders
Any of the reflective shaders require DDS format cube maps for the environment. Since alot of folks don't know what a cube map or DDS is (or how to make them), here are a few samples that you can use:
Desert Scene
City Scene
Blurred version of Desert Scene (Good for brushed metal look)

I would like to encourage any of you to post images of work you've created with these shaders. Particularly when I start posting some of my more advanced shaders, I'd be very interested to see how you can get the most out of them. Hope you enjoy them!

Each shader has a 'No-Shadows' counterpart. Versions of Max prior to 2008 don't support shadows, so you'll need the no shadow version if you have Max9 or something.




NEW! COMPLETE SHADER - (requires Pixel Shader 3.0)
LAST UPDATED 4/13/09 - Version 1.1 Improved glow and added Vertex Color support
Shader_Donze_Complete.fx
Shader_Donze_Comp_NoShadows.fx



http://duocartoons.com/David/threedy/shaders/std.gif
STANDARD SHADER
LAST UPDATED 1/30/09 - 4 lights and proper opacity support.
Shader_Donze_Std.fx
Shader_Donze_Std_NoShadows.fx



http://duocartoons.com/David/threedy/shaders/glow.gif
GLOW SHADER - (requires Pixel Shader 3.0 support for now)
LAST UPDATED 1/30/09 - 4 lights and proper opacity support.
Shader_Donze_Glow.fx
Shader_Donze_Glow_NoShadows.fx
Note: Still has one odd little bug, but I've not been able to fix it yet. Most people will never notice it anyway.



http://duocartoons.com/David/threedy/shaders/env.gif
ENVIRONMENT SHADER - (requires Pixel Shader 3.0)
LAST UPDATED 1/30/09 - 4 lights and proper opacity support plus Fresnel reflectivity.
Shader_Donze_Env.fx
Shader_Donze_Env_NoShadows.fx



http://duocartoons.com/David/threedy/shaders/skin.gif
SKIN SHADER - (requires Pixel Shader 3.0)
LAST UPDATED 12/5/08 - first pass at skin.
Shader_Donze_Skin.fx
Shader_Donze_Skin_NoShadows.fx
Note: The skin shader has a lot of advanced features. For an explanation of them go HERE.



http://duocartoons.com/David/threedy/shaders/glass.gif
GLASS SHADER - (requires Pixel Shader 3.0)
LAST UPDATED 12/14/08 - first pass at glass.
Shader_Donze_Glass.fx
Shader_Donze_Glass_NoShadows.fx



http://duocartoons.com/David/threedy/shaders/toon.gif
TOON SHADER - (requires Pixel Shader 3.0)
LAST UPDATED 11/30/08 - first pass at toon shading.
Shader_Donze_Toon.fx
Shader_Donze_Toon_NoShadows.fx
Note: The outline part of the code is a bit shaky right now so the 'Line Thickness' setting is currently inactive.[/url]

Here's a quick explanation of the basic features available in all of my shaders. First, for those of you that have no idea how to even get a shader onto a model, here's a quick tut:

Bring up your Material Editor. Choose a material that you would like to be a DX Shader. Now in the top right there is a button that probably says "Standard" (circled in red here). Click that and you'll be presented with the menu pictured on the left. Choose "DirectX Shader" from that menu.
http://duocartoons.com/David/threedy.../matEditor.jpg



Voila, your material is now a shader. Now, to make it a specific shader (like the one you just downloaded from this thread) click on the big button at the top, circled here in red.
http://duocartoons.com/David/threedy...s/dxEditor.jpg


This is a path to an .fx file. So, find the one you like and select it. There are actually a bunch that ship with Max, but they are mostly for demonstraion and not all that useful.


So, once you've loaded my shader, your Material Editor will turn into this:
http://duocartoons.com/David/threedy...aderEditor.jpg

Now, let me explain what all of this means (most of it is pretty self-explanatory)
First, lets actually start at the bottom. The Material slot can pretty much be ignored. But, if you have an insatiable thirst for knowledge, this is a separate material that Max will use to display your model if you disable DirectX or if you try to render the scene (DirectX shaders don't render, but they really don't need to)

More importantly, at the bottom is also an option for "Technique." You have 2 options here, SingleLight and DualLight. This will tell the shader how many lights to use to light your model.

Now, back at the top, you'll see there are slots where you can specify lights and shadow casters. These, obviously, are where you specify what lights to use. If you have the Technique set to Single Light, then only "Light Position 1" and "shadowCaster1" will matter. Generally you will want the Light Position to match its cooresponding shadowCaster.

Below the lights, there is a slew of map options. First are the Diffuse Map options. This will set the color of the model. There is a "Diffuse Map" and a "Diffuse Color." If you check the box that says "Enable Diff Map" then the shader will use the Map you have selected in the Diffuse Map slot. If you uncheck "Enable Diff Map" then the shader will just use the color that you've selected in the Diffuse Color slot.

The same applies for the Specular Map. The spec map however, also has a few extra options for Glossiness. This shader is set up so that the alpha channel of the Spec Map can be used to control glossiness. If you do not want that option, you can just uncheck the box and use the spinner to control glossiness.

Next is the Normal Map. The only tricky thing here is the "Invert Green Channel" option. Basically, Max uses a somewhat oddball coordinate system. Because of this, your normal map's Green Channel needs to be inverted depending on how you generated your normal maps. So, if you select a normal map and it looks a little weird, try using this option.

You can also turn on "Half-Lambert" lighting. This is a little trick developed by Valve a long time ago. It basically softens the lighting, giving a more appealing but less-accurate look.

Buzzy 23-11-2008 05:59 PM

I forgot to mention something important. This shader doesn't create its own shadows, it uses Max's internal shadow calculations. Therefore, you must have shadows enabled in the viewport for the lights you want to use.

Another point I should make : This shader has only been tested on Max2008. I can't say whether it works with any other version. This probably only pertains to the shadow casting, because everything else is just HLSL code and has nothing to do with Max.

On that note, this shader uses Pixel and Vertex Shader 3.0. If your video card does not support either of these, then this shader won't work.
I'm not sure that the shader really NEEDS to be 3.0.....it doesn't use any crazy advanced stuff so I can probably get away with 2.0. I'll look into that post an update later.

Buzzy 23-11-2008 06:30 PM

Ok, ignore the previous comments about Pixel Shader 3.0. I have just updated the file so it uses Pixel Shader 2.0. Now, if your video card does not support Pixel Shader 2.0...then....well....you need a new video card.

poopipe 24-11-2008 03:48 PM

I've had a quick fiddle with this - very nice.

that shadow code looks very much like the code I put into another shader that made my work machine crash - I've got new graphics hardware now though so it's all good for me :)

had any joy with Alpha channel support on the diffuse?

Buzzy 24-11-2008 04:03 PM

Yeah, honestly Max seems to have issues with alpha...particularly when sorting. I haven't really worked on the alpha much with this shader, so I'm not sure how well it works in the current version.

The biggest source of sorting issues in Max is how it structures the scene. Objects are sorted internally based on the order in which they were created (not by name or heirarchy). And Max's directX engine doesn't render the things based on distance like a game engine would, it renders each object seperately. And it draws them in the order they are sorted in the scene - i.e. the order they were created. So, if you have an object that was created earlier and it is in front of an object that was created later, the alpha won't work correctly.

Alpha is admittedly a major drawback in this shader. I'm still working on it though. Hopefully I can improve it.

poopipe 24-11-2008 04:45 PM

That'll go a long way to explaining why the hair on my witch went funny during that last comp.


I'm guessing here cos I'm not up on HLSL at all but can you turn off the alpha blending and fall back to a simple alpha test?

I've not seen anyone get sorting right on alpha blended geometry without shattering objects into individual tris yet - assassins creed, farcry 2 etc all use simple alpha tests for their foliage and it looks fine til you get right up close.

Chung Wong 25-11-2008 12:43 AM

Wow, neat, you are the dude. I've been meaning to get into shaders and this looks like a perfect place to start. Thanks dude... now you would be the dude meister if you were to put up a tut for the rig you did on your awesome warrior hint hint.

Edit:Pant's, I just tried your ace looking shader but can't seem to get it working in 3dsmax 9 (not 09) I noticed you did mention that this is for 2008 and probably above. Looks like its upgrade time or am I just plain stupid and can't get it to work? Doesn't matter though. Thanks for the shader, I'm sure I'll get it working sooner or later :)

poopipe 25-11-2008 09:36 AM

you need the viewport shadows for it to cast shadows so you need max 2008.

There's no shortage of non-shadow casting .fx materials floating around. Ben cloward has released one that works in lots of max versions.

Chung Wong 25-11-2008 03:41 PM

Cheers poopipe. Downloaded them all now, will give them a bash. Really want to get a skin shader working. Just in case anyone else wants a go, here's the link: http://www.bencloward.com/resources_shaders.shtml

Buzzy 25-11-2008 04:11 PM

Hey Chung, I'll spend a few minutes today and make a version of this shader with the shadows disabled for people with pre-2008 versions of Max.

And I'll see if I can get my skin shader to an acceptable state and post it too. It has alot of experimental tech in it and I'd love to get it out to the public and see what people can come up with.

Buzzy 25-11-2008 04:19 PM

Ok, here's a version with all of the shadow code removed. Should work on Max9 but no guarantees. I don't have max9 on my computer anymore so I can't test it myself. Let me know if it works Chung
Shader_Donze_Std_NoShadows.fx

Chung Wong 25-11-2008 07:07 PM

Sweet, thanks buzzy. I'll let you know later on tonight.

Edit: Nice, it worked, I couldn't get it looking as nice as your warrior though, could seem to get the fuzzy see-through like texture to happen, any idea's why? I like the shader a lot, just seems that I'm missing something and not making the most out of it. But anyway, here's what came out...

http://s253.photobucket.com/albums/h...uzzyshader.jpg

poopipe 26-11-2008 11:05 AM

1 Attachment(s)
wee!

I hacked a version with Ambient and Glow maps in today

I'd upload it but it's a dirty hack and requires SM3 to support all the calculations - they're just simple adds (I multiplied the ambient value by 0.3)

I'm having difficulties on 2009 with the alpha not working - any clues?

here's my dom war entry looking all shadowy and glowy

Buzzy 26-11-2008 04:17 PM

I think that looks pretty awesome Chung.

And nice glowiness poopipe.

I think I'm going to spend some quality time today working on the alpha and blending code....see if I can't come up with anything better. Hopefully I can address the issues you two have. I also spent some time yesterday going over my skin shader and I should be able to post that soon....hopefully tonight if I'm feeling super motivated.

Chung Wong 26-11-2008 08:20 PM

Yes please! I love this shader and looking forwards to more exellent shaders from you. Just so I know what I'm doing, am I right in saying that these are real-time and what you see on screen is what you get? Therefore if I need a shot, I just make a screen grab and not a render? Sorry for the silly questions. Btw, I have a piece of finished work and have credited you. Thanks a bunch!

http://i253.photobucket.com/albums/h...ssspeccopy.jpg

Buzzy 26-11-2008 08:34 PM

Yup, thats how i get my images....just regular screen grabs. And yes, this is much more accurate to what the model will actually look like in a game.

Yeah man, that character looks awesome. I would really recommend you try using the Spec Alpha feature....it is really useful and would greatly improve your spec/glossiness.

Basically, the shader reads the alpha channel of the spec map and uses that as your glossiness level. So, you can use it to make different parts of the model have different levels of gloss. If you just use the spinner for glossiness, it is applied over the whole model and you have very little control.

BTW, I updated both shader files to fix a few small bugs. Also, the alpha support seems to be working much better....although I haven't had alot of time to thoroughly test it yet.

Chung Wong 26-11-2008 08:43 PM

Brilliant. I'll have to give it a go. I'll playing about with the update tonight. Must say, this is a awesome thread. Hope to see that skin shader soon:) You'll get the first five stars I've ever given. Throughly deserve it mate.

Edit: Sorry dude, the update didn't work. Couldn't get it to load (One without shading). Any ideas?

Buzzy 27-11-2008 03:10 AM

Alright, I'm not sure why you couldn't get that file to work. I updated it again so give it another try.

I found another bug that I fixed too. The color swatch for the diffuse color wasn't working before, so you were required to have a texture or it wouldn't display anything.

I've fixed that, with no change to the non-shadow version of the shader. The shadow version, however, required a minor change to get the diffuse working properly. In somewhat technical terms, this is what happened: because of all of the "enable" check boxes, there is alot of branching logic. By making the "enable diffuse" checkbox functional, it caused an overflow of arithmetic operations - more than Pixel Shader 2.0 could handle. So, rather than move everything to Pixel Shader 3.0, I removed one of the other "enable" checkboxes, specifically the "Enable Shadows" one. So, shadows still work, you can just no longer toggle them in the shader itself. It was a nice feature for previewing and looking at the difference, but I felt it was much more important that everyone could still use it without potentionally requiring a new video card.

Chung Wong 27-11-2008 04:31 PM

Awesome. Works properly now with everything working. I did notice that the colour swatches weren't working, but that was pretty minor and I could get around that. Love it. Need an upgrade so i can try the big boys version (Shadows) lol.

I was wondering, this shader would be bullet proof if it had a glow map slot and a alpha map slot. How would I go about to get these in? Are there any tutorials or books that I can read floating about? I'll try and google it or something but doubt I'll get anything. Anyways, thanks a bunch!!!

Buzzy 27-11-2008 04:43 PM

Hey, I'm going to leave this shader as it is for now because it still fits into Pixel Shader 2. But I will make another 'uber' shader with glow maps and reflections and stuff.....in order to add anything else to this, I need to step it up to Pixel Shader 3.

Chung Wong 27-11-2008 07:06 PM

Sweet. I hope this thread gets made a sticky or something as these shaders should be appreciated. Can't wait to see what you come out with next... by the way when are you going to realise your skin shader? I'll be waiting with great anticipation :)

poopipe 27-11-2008 09:04 PM

In the interim I've got this version where I've hacked ambient and glow maps into Buzzy's latest version.

it requires SM3, the alpha doesn't seem to be working on max2009 with a gtx280 and it does have the shadows.
if you have a look at the code in notepad or whatever and compare it to the non shadow version you should be able to take them out pretty easily.

just copy&paste the words into a file and name it Buzzysbrilliantshader.fx or something like that

http://docs.google.com/Doc?id=dnhm7cz_1dxch8mgc

Buzzy 27-11-2008 09:20 PM

Hey poopipe, Thanks for the input! I'll use your glow code in my next shader. But for now, I have a feast to attend....I know you Britons don't celebrate Thanksgiving, but happy Thanksgiving all the same!

poopipe 28-11-2008 01:25 AM

ta:)

enjoy your giant hot-dog or whatever it is you lot eat ;)

Chung Wong 28-11-2008 01:57 AM

Have a great thanks giving Buzzy. Hope you stuff yourself silly :)

Poopipe: I had a look at your link.... I think this stuff might need a little more looking into... Mind boggled... This is some complexed stuff, need to start from the bottom I think if I'm ever going to get anywhere. (Or wait for awesome technical artists like yourselves to produce something;P)

Buzzy 28-11-2008 08:14 PM

Ok, new treat for you all. A glow shader. And by glow, I mean GLOW. Check it out, it rocks.

Shader_Donze_Glow.fx
Shader_Donze_Glow_NoShadows.fx

poopipe 28-11-2008 09:47 PM

1 Attachment(s)
weee!

Alpha is working on vista64, max2009, gtx 260.

I'm getting a weird redraw issue when i switch from camera to perspective (or whatever) in fullscreen viewports. it goes away if you alt+W and back - if you want an example image gimme a shout



couldn't resist this....

Buzzy 28-11-2008 09:56 PM

I wanted to mention a couple things to those of you trying to use transparency. First of all, you may be asking "Where is the slot for a transparency map Buzzy?" Well, its pretty standard in the industry that the transparency map is read from the Alpha channel of the diffuse map. Hence the reason that "transparency map" is often called an "alpha map."

Another thing to note is Max's inherent sorting issues. In short, Max does a rather poor job of sorting drawcalls in any useful manner. So you will notice alot of inconsistencies in transparency. The transparency is always there and apparent, but what you can see through the transparency is the issue. I've tried everything I can think of to fix it, but it appears to be an issue in Max that can't be worked around.

Buzzy 28-11-2008 09:58 PM

Haha! Hellz yeah poopipe. Looks awesome! Are you using the new Glow shader I made?

I'll look into that problem you mentioned. Post an image if you have one. In the meantime I'll see if I get anything like it on my end.

EDIT: I don't seem to be getting any problem like that over here. Re-download the shader file to make sure you have the latest and try again.

poopipe 28-11-2008 11:25 PM

yeah, that's your one - the glow is more obvious when you can spin it round , I think there's arguing about who's in front of who going on cos the glowing bits are partially behind the face mesh, I'll see if I can tweak the model to get around it cos my altogether shaky memory of how this stuff works says your shader is doing the right thing.

I'm on my laptop now so the shader won't work but I'll try to get you a shot of the issue at some point - it looked like the sillhouette from the last view was masking out the current one.



A couple of things I'm curious about which I'm hoping you won't mind answering....

Is it possible to base the shadows on an alpha test or does that stuff happen too early on?

Can you force antialiasing though one of these shaders?

Where are you getting your information from? I really haven't seen much in the way of references etc online - I don't think I know where to look.

Buzzy 29-11-2008 04:56 AM

The shadows are completely handled by max, so I have no control over how they are rendered. I could take a shot at doing my own shadows, but that might be a rather time-consuming endevour.

What kind of anti-aliasing are you refering too? Do you want anti-aliasing on the edges of models?

Most of what I've learned about this stuff I learned by picking apart shaders made by others. It was an EXTREMELY steep learning curve at first. The Microsoft online reference is fairly helpful once oyu get going a little bit.
http://msdn.microsoft.com/en-us/libr...61(VS.85).aspx
It also really helped that I took several years of programming classes in school.

Chung Wong 29-11-2008 05:22 AM

Loving it. Just finished work a few hours ago, but could resist messing about with your new updated version. Found a bit of a problem though and I'm not sure whether it's my graphics card or not, but I've made an example for you to see (This is the no shadows one by the way) See what you think :)

http://i253.photobucket.com/albums/h...nwong/glow.jpg

I think Poopipe and I should be your official testers lol :) Hopefully, I should be able to model something and texture it based on this shader to make sure though. A light bulb or something, I don't know. Keep up the good work :)

Buzzy 29-11-2008 05:56 AM

1 Attachment(s)
Hmmmm...not sure what's going on there. I had a similar problem early in the development of the shader, but I fixed it. Here's what the test scene looks like that I used while writing that shader. It seems to be pretty rock solid for me. Maybe by seeing how I intended it to be used, does that help at all?

poopipe 29-11-2008 08:35 PM

Quote:

Originally Posted by Buzzy (Post 677824)
The shadows are completely handled by max, so I have no control over how they are rendered. I could take a shot at doing my own shadows, but that might be a rather time-consuming endevour.

What kind of anti-aliasing are you refering too? Do you want anti-aliasing on the edges of models?

Most of what I've learned about this stuff I learned by picking apart shaders made by others. It was an EXTREMELY steep learning curve at first. The Microsoft online reference is fairly helpful once oyu get going a little bit.
http://msdn.microsoft.com/en-us/libr...61(VS.85).aspx
It also really helped that I took several years of programming classes in school.

shadows : oh right. doesn't really sound like it's worth the hassle does it? :)

anti-aliasing : yeah - your standard FSAA. After reading a bit I'm now assuming that's lower level than the shaders

refs : Thanks very much :) I should have thought of microsoft really but I'd been concentrating on OGL as it's what we use at work.
I try not to think about anymore but I spent a few years coding for a living - some of it in C so I'm familiar enough with syntax etc. I just don't know much about the graphics pipelines or 3d maths.

Chung Wong 30-11-2008 02:42 AM

The glow in your example seems to work much better than in mine. I think I need to play with it some more. Looking forwards to producing a fully blow model catered for this shader :) The glow was just I needed for my next idea...

Buzzy 30-11-2008 03:02 AM

Ok, I got a solid reflection shader working. It required me to come up with completely new math for alot of things, but its working well so far.

Shader_Donze_Env.fx

Shader_Donze_Env_NoShadows.fx

There is one interesting new feature to be aware of - I have set this up so that the alpha channel of the normal map is a used as a reflectivity map. So, by painting parts of the normal map alpha darker, you can mask out the reflections.

You may be wondering why I keep using all of these alpha channels for this stuff rather than just having separate maps. Well, by using an alpha channel, you can fit this info into a pre-exsisting map rather than have a whole new map. This helps performance for two reasons. First, fewer maps means less memory required. Additionally, when you have extra maps, the GPU has to read information from each of those maps which takes time, slowing framerate. Its pretty standard in the industry to try and cram as much info in as few maps as possible.

Chung Wong 30-11-2008 03:47 AM

Clever buzzy. I too hate having to make a million maps. Some shaders take up to 8 maps plus. Whats worse is that some require the map slots to be filled. Having said that (as I'm not trashing other shaders) They look lovely when they are filled in, but it's not suited for games. That's why this shader reign's supreme :), and I find that everything just works which is very important to me. I hate working on stuff with doubt in my mind.

By the why, I know I've asked this before, but I remember you saying something about posting you skin shader at some point:drool:
Edit: I not sure there is a good way of mapping a spherical map... I'll give it my best shot if you like. How many poly's do you want in it? (like for the sphere that is) I'll have it ready for you sometime tomorrow if you want.

Buzzy 30-11-2008 03:47 AM

Oh yeah. The reflection shader requires a dds-format cube map. For those of you that have no idea what a cubemap is or how to make one, Here's some that I made:

Outdoor desert scene, not sure where it came from - skyBox.dds
The same scene, but blurred and shrunk. Good for doing a brushed metal look - skyBox_Blur.dds
Outdoor city scene, created from one of the HDR images that ships with max - skyBox2.dds

I can make more for anyone if you give me a good spherical map. I'm not really sure the best way of making cubemaps, but my method is a bit too overly complex for me to try to teach anyone.

Buzzy 30-11-2008 04:32 PM

1 Attachment(s)
Chung, by spherical map, I meant simply a landscape-type of image that can be wrapped around a sphere. Here's an example (this is the image that I created the city cubemap from...this image ships with Max)

When I said "I'm not really sure the best way of making them, but my method is a bit too overly complex ...blah blah....etc" I was referring to making cubemaps. Spheremaps are pretty basic.

Chung Wong 30-11-2008 05:45 PM

So it is a spherical map you want doing isn't it? to fix the pic above yeah? I can get that done for you. As for a cube map.... I not even sure what that is:o... Could brief explanation of what it actually does?

Oh and I'll have the sphere unwrap for you next post.

Buzzy 30-11-2008 06:31 PM

2 Attachment(s)
The whole reason I brought up sphere maps is because I was offering to turn them into cubemaps for anyone. I only posted a few examples of cubemaps, but if someone wanted to have reflections of something other than a desert or run-down city, they would need to make their own cubemap. But, like you just said, few people understand cubemaps, let alone how to make them. So, if you give me a regular environment map (aka sphere map) I can turn it into a cubemap for you so that it will work with the shader.

A cubemap is a series of 6 images, compressed together. These 6 images represent the 6 sides of a cube. If mapped to a cube, the cubemap will create a seamless environment. Here's an example of what the above sphere map looks like once its converted into a cubemap. Also, an image of the cubemap applied to a cube and a sphere. Please note that this is what the uncompressed cubemap looks like....you can't actually use it in this state.

E4sY 30-11-2008 08:15 PM

Interesting texture talk here. Makes me wish i was a 3dmax user. Im sure maya is also capable. Anyone know of links to get these effects in Maya? Nice work creating these Buzzy. :)

Chung Wong 01-12-2008 05:11 AM

Erm, I have a sphere unwrapped for you (Not sure if this is what you wanted), kinda like the one on your image above... have it saved as a zip but unsure of how to attach it to this post:o. I can send it to you via e-mail or something if you like.

Edit: Just read your last post properly. It sound like you don't need this done and that you are actually infact offering to help people out. That's pretty cool of you. If that is the case then you probably don't need it. But if you do just let me know:)

poopipe 01-12-2008 12:45 PM

e4sy : Maya does support DX viewport shaders but I doubt the shadow implementation is the same.

dark_maggot 03-12-2008 05:24 AM

Great work
 
1 Attachment(s)
Love the Shaders Keep up the great work.

Here is screenshot of my latest model.

Buzzy 03-12-2008 05:56 PM

Sweet!

Buzzy 05-12-2008 10:49 PM

Alright, here it is. The big one. My skin shader. Or as I like to refer to it - my "Adjustable Light Curve Shader."

Shader_Donze_Skin.fx

Shader_Donze_Skin_NoShadows.fx


So, this has all the same features as the other shaders, but with lots of cool new stuff. And because its some pretty heavy stuff, I've made a little tut to help you all understand whats going on under the hood.

To start off with, you need a very basic understanding of how realtime lighting is calculated. Take the following example. A simple sphere with a single spot light off to the right:
http://duocartoons.com/David/threedy.../Example01.jpg



Notice the nice smooth shading. The brightness of any given point along the surface is calculated by finding the Dot Product of the light vector and surface normal vector. You don't need to know what that means or how it works, but its good to know what the result is. The Dot Product will yield a value between -1 and +1. It will be -1 for normals facing directly away from the light... +1 for normals facing directly toward the light..... 0 for perfectly perpendicular normals....so on and so forth. It all sounds super complicated, but here's a simple illustration to help you visualize:
http://duocartoons.com/David/threedy.../Example02.jpg



Right in the middle, there is a 0 value, or what I call the "dark point," where the color reaches complete black. On the end facing the light, you have a +1 value, or what I call the "light point," where the color reaches complete white (actually, at this point it will be the full color of the diffuse, which in this case is white). This shader simply moves where those two points are. So, by default, the Light Point is at +1 and the Dark Point is at 0. If we slide the Light Point down to 0.25, we get the following result:
http://duocartoons.com/David/threedy.../Example03.jpg



If we move the Dark Point forward to 0.75, you get this result:
http://duocartoons.com/David/threedy.../Example04.jpg



By moving the Dark Point back, to say, -0.75, you get a nice pseudo sub surface look, similar to the Half Lambert function of my previous shaders but perhaps a bit better:
http://duocartoons.com/David/threedy.../Example05.jpg



Normally, the falloff between the Dark and Light points is a linear curve. However, I have made that curve customizable. Its a simple x^y function. 1.0 is the default. By going lower than 1.0, you can make the light more harsh, falling off rapidly as it approaches the Dark Point:
http://duocartoons.com/David/threedy.../Example06.jpg


Going higher than 1.0 will make the falloff from the Light Point steep, but then gradually fade into the Dark Point.
http://duocartoons.com/David/threedy.../Example07.jpg


Ok, now this is where it gets interesting. We can add a sub-surface map to blend into the surface diffuse. There are two settings here. Lets start with Color Bleed Level. This is simply how much the subsurface map shows through (my subsurface map is a simple checkerboard pattern).
http://duocartoons.com/David/threedy.../Example08.jpg



By default, this map will get blended in between +0.5 and -0.5. By adjusting the Color Bleed Offset, we can move where the blending starts.
http://duocartoons.com/David/threedy.../Example09.jpg


Lastly, by creating an alpha channel in your subsurface map, you can control how much all of these settings affect your model. Here I've painted some black wavy lines into the Alpha. Those areas are now no longer affected by any of these settings (instead they are shaded like the standard shader). This can be a grey scale to get varying amounts of subsurface effect.
http://duocartoons.com/David/threedy.../Example10.jpg



Well, thats a lot to digest all at once, so please ask questions if you have them. And please let me see what you come up with. There are alot of variables and different ways of tweaking things, so I'm really interesting in the creative ways you people can exploit this shader.

Chung Wong 06-12-2008 12:39 AM

Ah, you are the man. Looking forwards to taking this out for a test drive :)

Chung Wong 06-12-2008 04:08 AM

Just been playing about with it. Very nice, still trying to get my head around it thought. I sort of managed to get a prince of persia style thing going on which is well cool. Just wondering, is this the same shader you used to make your barbarian model with? Just asking as I'm not too sure what a sub surface map should look like. Would you mind posting your texture maps so we can see what's behind the hood and can get a better picture of how to make the most of this awesome looking shader? As I'm really interested in how you made the skin for that particular model :)

Buzzy 06-12-2008 06:41 AM

Haha...thats part of the reason I wanted to post this and let everyone experiment with it - I don't really know what a subsurface map should look like for this particular shader. For my barbarian, it was simply a solid blood-red map...and I painted the alpha lighter in areas that would transmit light better....thin areas like the ears, nose, and fingers...also "meaty" areas with no bone under the skin...like the thighs and shoulders. Other than that, I really don't know what would work best. As I said, there are alot of variables here and alot of different ways to approach it.

And yes, this is the same shader (or at least the same math).

neokyubi 06-12-2008 08:29 AM

Hey Buzzy,
I'm having Max 2008 and tried your shaders. Somehow the shaders just make my models transparent in the viewport. I also tried the no shadow ones, and it doesn't seem to work. Any advice?
Thanks in advance :-)

Buzzy 06-12-2008 04:20 PM

hey neo,
You probably don't have a texture in the diffuse slot. Try unchecking the "Enable Diffuse Map" box.

Chung Wong 07-12-2008 03:49 AM

Sweet. Thank the smart person to make this a sticky :)

Anyways, I hear you, I suppose it's better that we experiment with it ourselves :) I'll be entering the low poly comp, I hope to do a fleshly organic thing. That will give me something to play with when it comes to texturing. I'll get plenty of time to test it out then. Will post results here and whatever I find that works best as a sub scattering map.

Oh, by the way, couple of questions.
a: Can I get your renderer to render out double sided polys? (Like the way when you check the force render double sided polys box in the rendering options)

b) I noticed that you had glow maps going on in your barbarian model for behind the ears etc. Is that possible with the skin shader you provided us?

Buzzy 07-12-2008 04:22 AM

Oh cool....sticky.

To answer your questions:
a) currently the culling is a bit screwy. I've messed with it a lot and can't seem to get it to work right. But I'll spend some time and look into it.
b) The glow-thru effect is not currently in this shader. I will add that a little later. Its pretty sloppy code right now and I'd like to find a more efficient method first.

Chung Wong 09-12-2008 03:07 AM

Sweet, thanks for the answers, I'll be looking forwards to the next update.

Buzzy 15-12-2008 06:28 AM

Hey I added a new glass shader. I was inspired by the Jelly Bean material in zBrush. Check it out on the first page!

BiG ToE-3DT 25-12-2008 05:03 AM

is there a shader that lets you render with the shader applied?

poopipe 25-12-2008 08:50 PM

I'm 99% certain the answer to that is no.

you can bung your maps in a material in the submaterial slot of the DX shader and that will render using whatever renderer you have active but there's no way to render the DX shader itself that I'm aware of.

Buzzy 26-12-2008 10:32 PM

i usually just 'print screen' or make a 1-frame animation preview (animation preview allows you to get an alpha if you need it)
but no, they can't be rendered. but why do they need to be? they are right there in front of you being rendered at a blazing 30 or so fps

gaboon 27-12-2008 02:58 AM

Well hey there Mr. "Of the Eleventh Province"
I snatched up all your awesome shaders as soon as I saw them. You have been quite busy. I can't seem to get the shadows working. I am using Max 2008. I tried different types of lights with different shadow types. Any advice?

poopipe 27-12-2008 10:47 PM

have you turned on shadows in the viewports ?

you need to right click > enable shadows on the lights you want to cast shadows

omnis with mapped shadows work fine.

gaboon 28-12-2008 01:03 AM

Yeah, tried it with all different types of shadows also. With spot and Omni.Don't know.

Buzzy 29-12-2008 02:45 PM

do you have the "enable shadows" checkbox turned on under the lights' modifier tab?
And do you have the shader's "shadowCasters" set to those lights?
And lastly, sometimes max will use the default lights for shadows. So, make sure your scene is being lit with the scene lights instead of default lights (i think the hot key is L or ctrl-L or alt-L....something with L)

gaboon 31-12-2008 02:43 AM

Yes, yes, and yes. I don't know. Anything else I could try?

Buzzy 02-01-2009 12:20 AM

1 Attachment(s)
try this - select all of your lights, right click in the viewport, and find "Enable Viewport Shadows Selected"

Chung Wong 06-01-2009 02:26 AM

Hey, how are things? I've been playstationing it for a few weeks now and just left the work alone. Best catch up with it now:( Anyways, I have a question for you, I've been making this gun model and want explore the best ways of making it. I know I want to stick it in this shader, but I've come across a small hitch. I've been told that it's best to bake out world normal maps instead of tangible ones for inorganic models... I think thats the correct term, I'll double check that, but I'm sure you know what I'm on about, the thing is, it seems that your shader doesn't like them much, anyway around that?

Buzzy 06-01-2009 02:57 AM

"tangent" normals are what you are referring to. Yeah, it would be possible to alter the code a tad to make the shader use world-space normals instead. I'll look into it.

In the meantime, I have a toon shader that is near completion that I will upload a little later.

gaboon 06-01-2009 04:22 AM

That was it dude! Thanks !

poopipe 06-01-2009 12:17 PM

world space normals are only any good if the object doesn't move.

afaik there's no benefit to using them over tangent space normals - I can't see why there would be

Buzzy 06-01-2009 04:26 PM

Well, you wouldn't actually use world space normals....you'd use object space normals. Practically the same thing, but object space would allow the object to move. Because they aren't tangents, they won't work if the model is deformed with a skin modifier or something, but that doesn't matter since, in theory, this would only be used for single hard models.

Otherwise, I can see the benefit. Tangent space normals are relative vectors, where object or world space normals are absolute vectors. That means that the smoothing of the model doesn't matter at all, so you can avoid the inevitable "weirdness" that you get around hard edges.

Chung Wong 07-01-2009 02:32 PM

Quote:

Originally Posted by Buzzy (Post 683748)
"tangent" normals are what you are referring to. Yeah, it would be possible to alter the code a tad to make the shader use world-space normals instead. I'll look into it.

In the meantime, I have a toon shader that is near completion that I will upload a little later.

Quote:

Originally Posted by Buzzy (Post 683807)

Otherwise, I can see the benefit. Tangent space normals are relative vectors, where object or world space normals are absolute vectors. That means that the smoothing of the model doesn't matter at all, so you can avoid the inevitable "weirdness" that you get around hard edges.



Awesome, I think that was what I was thinking of (object space normals) as you are spot on with the description above. If we can get the enabled, this shader is becoming increasingly more versatile.

Looking forwards to the toon shader too.

poopipe 10-01-2009 10:57 PM

Quote:

Originally Posted by Buzzy (Post 683807)

Otherwise, I can see the benefit. Tangent space normals are relative vectors, where object or world space normals are absolute vectors. That means that the smoothing of the model doesn't matter at all, so you can avoid the inevitable "weirdness" that you get around hard edges.

ah, that makes sense.

I are corrected

Chung Wong 14-01-2009 03:36 AM

Hey, how you doing? Anyways, still enjoying your shader and seeing what I can get out of it. This is the latest piece of work I got out of it.

http://s253.photobucket.com/albums/h...t=Beauty-2.jpg

Any word on the toon shader? Looking forwards to it:) Will be looking to use this shader for the dom wars. Will make sure you get credited for it

Buzzy 14-01-2009 03:44 AM

Really really nice gun Chung. Great work!
I actually have the toon shader ready to go, I just kind of forgot to post it. So I will do that tonight.

BTW, are you entering the low-poly comp or are you saving yourself for DW4?

Chung Wong 14-01-2009 03:58 AM

Thanks dude :)

Oh, yeah, I'm getting ref images now to get the ideas flowing. Should be entering both the low poly challenges. Need to work on speed. I always seem to start well, but find it difficult to finish off models. I keep on working on them and never know when to stop. I know I've said this before but these shaders that you keep devolping are a Godsend! I really hope to do it justice in the dom wars;)

Also, I'd like to ask you, as your shader doesn't render both sides, how do I go about doing hair and stuff like that? It's been bothering me a little.

Buzzy 14-01-2009 04:30 AM

Hey the toon shader is posted. The outline code is a bit weird right now. I'll look into that in the future.

As for the backface stuff you asked about - I've found some settings that I've been messing with to improve the sorting issues. I'll experiment with that more and see what I can do.

I'm really glad to hear you appreciate my work. I hope the shaders serve you well!

BiG ToE-3DT 14-01-2009 09:34 PM

with this new toon shader, I might just try finishing that darn anime character I was doing.

Chung Wong 22-01-2009 05:21 PM

Oh, new stuff. Awesome. Glass shader eh? That looks really interesting. Will be incorporating these shaders on all future work, so expect plenty of images off of me, just wondering, would you prefer a link to the image or just the image to appear?

ps:Any word on rendering two sided poly's? :)

CorvideusEx 26-01-2009 05:07 PM

Hey, LOVE the shaders but im trying to slap together a demo reel necessary for graduation but the stuff i've been working on cant be rendered to video using max's renderer, all i need is to get a simple turnaround, does anyone have any ideas at all?

Buzzy 26-01-2009 05:39 PM

Yeah these shaders aren't renderable.
I have two-suggestions:
1. Just use the shaders only as a way to preview a model in realtime, and render all your turnarounds with standard materials
2. Use the shaders, but do an Animation Preview to capture turnarounds

I usually just do animation preview, and it's what I normally recommend, but its got a few limitations to be aware of.
First, you can only create images as large as your desktop resolution. This is because animation preview actually captures your screen and prints it to an image file. So, however big your screen is, thats the biggest it can capture.
Secondly, it doesn't really do anti-aliasing and other effects that would normally help improve the image during a regular render.
Lastly, you can't do cool AO lighting or other such fanciness. You only get what the shader can do.

There is also a "Material" slot in the DirectX shader. Whatever material you put in that slot is what it will use to render the model when you do a normal render. But, if you're using any of my more unorthodox shaders (glass, toon, skin), then it'll be nearly impossible to replicate what you see in the viewport.

Pickman 28-01-2009 10:08 PM

http://img220.imageshack.us/img220/5...maxgrabsv8.jpg

lit with two white omni

Check it OUT!! Its IMROD grand prize winning model from DomWar3. Model, textures, and Ztool are free to all here:http://www.parkparkin.com/

Mr.Parkin must have made his maps specifically for whatever engine (real-time renderer) he used. I rendered this in Max09 64bit, using Buzzy's awesome DX Glow shader.(Thanks man, love em' all btw ;) ) But the illumination map was WAY too intense for the shader so I had to hand tweak the output in Photoshop. I also copied the specular data into an alpha channel to control the glossiness. Didn't alter it in any way, just pasted into a seperate channel inside the spec targa.

Did this in little more than 30 min worth of "work". Thank you ParkParkin for sharing this with the community. Very inspirational.......BRING ON THE WAR!!

**Edit: Found out about the model here btw (http://gameartisans.org/forums/showthread.php?t=6951)

Buzzy 28-01-2009 10:36 PM

wow man that is fantastic!

Awesome find there pickman!

I plan on making enhanced versions of these shaders specifically for DomWar. Right now they can only use 2 lights max. I'm going to bump that up...4 or 8 even. Maybe more if it still runs fast. I also plan on consolidating some of these into a single "uber" shader. Probably a Std, Glow, and Env combo. Then maybe a Std, Glow, Skin combo. I might try all 4 of those together, but I don't know how well they will all interact.

Pickman 29-01-2009 12:02 AM

I was gonna ask if you could include at least 3 lights (foot, fill, back). Looks like you got it already.

Really love the shaders btw, especially the Skin shader, so F'n sweet. They've really reinvigorated my creativity, so thanks. Excellent job documenting their basic use here. I like the idea of glow and sss together since the two map types are so similar, it would be easy to use one map to do glows and subdermal. (Like if you character has skin and glowin eye's ect.)

If the shaders are ready by DomWar, I'll use them for SURE. :)

Buzzy 29-01-2009 06:13 AM

Ok, in preparation for DomWar, I updated the standard shader, available on the first page. It now supports 4 lights and has good 2-pass opacity support (opacity works great on each object, but its still a bit weird between objects. I think that is a sorting issue internal to max and can't be fixed by me)

I will be combining some of these shaders soon too (again, in preparation for the War), so keep an eye on this thread.

poopipe 29-01-2009 03:11 PM

Buzzy.

As you know I like to hack your shaders around to suit my purposes rather than learning to do it all for myself but I've become curious about generating a really nice metal surface

Do you know what's special about metal surfaces compared to standard plastics or somewhere I can pick up the theory from?

Buzzy 30-01-2009 06:44 PM

Ok, check the front page for a major update!

poopipe - That's a very good question. I'm not quite sure what makes metal look like metal. It probably has something to do with the small (almost microscopic) machining marks that are present on bare metal. I'll look into it and see that I can come up with.

Fenixy 30-01-2009 07:08 PM

Buzzy, you are awsome! thx man:lurve:

BiG ToE-3DT 30-01-2009 10:58 PM

thumbs up.

I can see it now, a ton of Final Entries in the War from Threedy, all using the shader. Your going to be famous. Then the money, then, the ladies.

Chung Wong 31-01-2009 03:22 AM

Awesome.

BiG ToE-3DT 07-02-2009 05:14 PM

hate to bring this up, but, I'm getting an error trying to load allt he shaders, error reads:

error X1507: failed to open source file: 'C:\Documents and Settings\DJ\Desktop\Buzzy Shaders\shadowMap.fxh'

I'm sure it's a problem on my side.

Using max 9 up in here.

Buzzy 07-02-2009 05:49 PM

Max9 doesn't have native shadow casting support. You need to download the "No-Shadow" version of the shaders.

Or, we can try an experiment. Here is a link to that file it says its missing: ShadowMap.fxh
This file was made by Autodesk, NOT me.

Put that in the same folder as the shaders. Normally, max08 and 09 will look for that file in the max/hardwareShaders folder, but I'm not sure if Max9 has that folder.

It might take a miracle for this to work, but lets see.

If not, I could rewrite the shader to make its own shadows. But that might take a while. Ooo....but then I could do fancy soft shadows and other cool shadow effects....hmmmm.

BiG ToE-3DT 07-02-2009 06:41 PM

thank you kindly

Chung Wong 10-02-2009 02:09 AM

Something else I ade using your shader, (512 map normal spec and colour) Had a little play with the reflections as well, very nice :) tis makes me very happy, especially the doudle shaded polys. Any word on the local (or world which ever one it is) map compatibility? Can wait for the soft shadows etc :)

http://i253.photobucket.com/albums/h...tefinished.jpg

Buzzy 10-02-2009 10:01 PM

Hey Chung, those are some really really nice crates! Great stuff! And thanks as always for posting work you've created with these shaders!

The object-space normals are looking unlikely to happen anytime soon. I had a hard time figuring out the math. And then I talked to our graphics programmer here at work and he says its unlikely that it'd make much of a difference anyway. He says that, mathematically, the results should be the same either way. I still might try to figure it out later, but I have bigger fish to fry for now.

I haven't started doing my own shadows yet. Not much time since the LowPoly Challenge is wrapping up. I would really like to get that done in time for DomWar so people with Max9 and below can use them for their entries.

Any word on that fxh file? Did anyone with Max9 test that and see if it works? That'd be really really awesome if it did.

Chung Wong 10-02-2009 10:29 PM

Sweet, I'll try the file either tonight or something, you'll find out the results by tomorrow though. I hope you get the shadows before the war too :) I heard that the one that starts on the 20 of feb is a mini dom wars comp and not the full fat one. That starts sometime March, so that gives you a bit more time :)

BiG ToE-3DT 10-02-2009 10:30 PM

well, it didn't work for me, but that's not saying much. I can't get mine veiwport to look nothing like you guy's.

I'll have to play with it for the week before the war, and figure something out.

Chung Wong 10-02-2009 10:36 PM

What's up BiGToE? Can't you get the shader to work?

BiG ToE-3DT 11-02-2009 02:12 AM

I think the problem I'm having is:

I have a sorry excuse for a light rigg that I use for all my models, which consists of 4 to 5 lights, one being a sky light. I noticed that the shader only handles 2 lights, well the one I'm using. So I just need to start fresg with the lights and see what happens.

Buzzy 11-02-2009 02:22 AM

download the latest versions of the shaders and you can use 4 lights. The skylight is another story however. Game engines cannot handle realtime skylights either, so any light you want from a sky light can be baked into the diffuse of your model.

BiG ToE-3DT 11-02-2009 04:04 AM

I think I got the hang of it. But I still suck at placing lights, so if it looks funky, it's my fault.
complete shader
http://i55.photobucket.com/albums/g1...GToE/020-7.jpg
toon shader
http://i55.photobucket.com/albums/g1...GToE/019-4.jpg

Chung Wong 11-02-2009 04:55 AM

Looks like you've got the hang of it to me. That'll look awesome once it's finished. Toon shader one looks fun, seeing that makes me wanna have a go :)

Fenixy 11-02-2009 10:26 AM

Toe toon shader looks intresting

about shaders: for me only 1 light works with this shader, when i trying to put second it do nothing, have eny clues?

Chung Wong 11-02-2009 03:02 PM

Fenixy: Depending on which one you have loaded, I think there are 1 to 4 lights, it will tell you how many you can have at the bottom of the shader window.

Buzzy: tried the file but it didn't work. Plan b?

Buzzy 11-02-2009 04:10 PM

Fenixy: Set the "Technique" dropdown to how ever many lights you want to use.

Chung: I figured there was more to Max's internal shadows than that one script. But it was worth a try. C'est La Vie.
I guess planB is to get cracking on an all-inclusive shadow casting shader.

BigToe - Nice hooptie. Glad to see you got the shaders working. It also reminds that the toon shader still needs some work. Its more or less just a proof-of-concept right now. It still needs some tweaking.

poopipe 12-02-2009 09:47 AM

1 Attachment(s)
buzzy - do you know how many lights are possible?

under sm3 I'm assuming there's no limit to the number you could theoretically enable which suggests GI could be faked by creating a light dome thing from a shed load of point lights.I think I'm also correct in saying you can define light positions in the shader rather than using on actual lights

I've quickly faked what I mean on our engine - I only get 8 lights to play with and in this image one of them is a spot used as a key light (the other 7 are points with a small shadow map arranged ina dome-esque formation) but it kind of works. I'd imagine putting 32 lights in a dome formation would achive a reasonable result

I might give this a poke over the weekend - the missus has taken the boy off to foreign parts to see her family so I'm at a bit of a loose end :)

Buzzy 12-02-2009 04:08 PM

In theory, I could add light passes until my computer crashes. Although, there might be a hard limit to the number of passes DirectX allows.

That is actually a great idea though. And those "extra" lights could be very simple passes that just add the basic lighting and nothing else....hell, they could even be simple directional lights. Hmmmmm..... I'll mess with that idea too. Great thinking poopipe!

EDIT: Actually....now that I'm thinking about it, I have an image-based lighting shader I was messing with a while back....That might be even better because then you could have, in essence, 1000s of lights....one for each pixel.

poopipe 12-02-2009 04:36 PM

see.

genius right here :D

discmage 10-03-2009 06:01 AM

Is there any way you can get a shader to apply AntiAliasing? All this is really cool, but it 'seems' that the images made with these are usually kind of jaggy? Especially with the toon shader...a AA ink edge would look sweet.

Nice work though. THe renders in this forum look pretty sweet! :)

poopipe 10-03-2009 09:07 AM

you should be able to force AA through your driver settings if you really need it.

I've not tried but it works in everything else

Buzzy 10-03-2009 02:58 PM

2 Attachment(s)
First of all, the toon shader is very very experimental. I wouldn't recommend using it for anything just yet. Its more or less just a proof-of-concept right now. It has all sorts of issues and is really just a toy to play around with right now.

Now, for anti-aliasing. The easiest and quickest way to do that is to use the Output scene shader. To do that, go to your Utilities tab. Click on the 'More' button. Find 'Scene Effect Loader' and select it. Now you get the Scene Effect Loader rollout.
Click on 'Load Effect' and navigate to the folder 3dsMax\maps\fx\scene. In there should be an fx file called 'post_output.fx' Load that, check the box that says 'Scene Effects' and voila, the scene is anti-aliased.

Pickman 10-03-2009 08:13 PM

http://img24.imageshack.us/img24/2382/buzzyshade.jpg

Hooray! AA and Bloom! And a hacked 4light version of your skin shader on the head. I feel special!:smug:
I'm sooo friggin' ready for the DomWar. Threedy has it in the bag yet again. The other forums won't even know what hit them.

Thanks for the info on output.fx. I was wondering how to get rid of all the jaggies.

discmage 11-03-2009 12:16 AM

Cool. Thanks for that!

poopipe 11-03-2009 02:37 PM

Quote:

Originally Posted by Buzzy (Post 696670)
scene effects etc...


I was wondering whether that was possible

I've got some copy&pasting to do

Buzzy 11-03-2009 03:14 PM

Yeah scene effects are doable. There are already some neat ones that ship with max that you can play with.

One note: with regular shaders you can easily edit their parameters in the material editor. With scene shaders, you need to double-click on the shader's name in the effect loader and it will be loaded into the material editor where you can then mess with parameters.

Sebiomegas 13-03-2009 08:52 AM

Hey Buzzy!Great stuff, nice of you to share this.
Unfortunately It doesn't work for me. I am using 3d Studio Max 9 and I get a flat white display on my model when using your shaders.
Here is my current Graphic Card (It's old, but it was pretty strong to start with.)

http://www.driverheaven.net/reviews/9800256/index.htm

I really want to display my models as close as actual real time would look.
Any solutions that would work for me?

Thanks in advance. I appreciate it.

poopipe 13-03-2009 11:26 AM

your best option is a new graphics card - afaik the 9800 doesn't support shader model3.

I'm not sure what the most recent AGP card available is - the nvidia 7600 GS came in 512mb and i think supported most of the features you'll need. there may be an AGP 8000 series card available though if you search

Buzzy 13-03-2009 03:16 PM

1 Attachment(s)
The biggest problem is that card only supports Vertex and Pixel shader 2.0
All of my shaders are currently using 3.0
Also, I only have the ability to test these on an nVidia card. I've never tried an ATi card. There's a reasonable chance ATi cards, especially and older one like this, would need some different instructions.

But after having said all of that, it sounds like you might just not have direct3d enabled. Do you know how to do that? If not, here's a brief explanation. Go to the Customize menu and open the Preferences dialog. Now, in the Pref dialog, find the Viewport tab. Click 'Choose Driver' and switch it to Direct3D. Then you'll have to restart max. Let me know if that works.

I have modified my standard no-shadows shader to use only Pixel Shader 2.0. Try that and let me know if it works. If not, I'll have to look into what needs to be done on an ATi card.
Shader_Donze_Std_NoShadows.fx

Sebiomegas 14-03-2009 05:39 AM

Wow! Fast reply.
Too bad, my model is still white. Anyway, here are my settings. :dunno:

http://img72.imageshack.us/img72/608...txsettings.gif



**Regarding the new graphic card: I was always unsure about whether to go for NVidia or ATI.
I remember a while ago, at a max 9 mini launch conference, Autodesk developer guy said they will be focusing on Nvidia cards.
He even said : "Go for Nvidia!"
Was he biased towards them? What do you think?
I always felt that ATI was slowly loosing to Nvidia. :xx:

poopipe 15-03-2009 12:29 AM

personally I like nvidia.

This is mostly because in my experience (which includes some hardware testing ) ATI drivers have proved unreliable/unpredictable/rubbish.

Fenixy 15-03-2009 04:06 AM

i have ATI my self , but personaly i prefer Nvidia
if i put 2 lights in technique or more, model become invisible. Last shader you linked, model is invisible with 1 light , but it works with 2 and more lights.

Buzzy 15-03-2009 05:07 AM

Ha, my mistake. Try that simple shader again. I accidently left the single light as vertex Shader 3.0. Should be good now.

Sebiomegas 16-03-2009 04:25 AM

As with Fenixy I have issues with the 1 light setup of the updated file.

Before this shader I had to use the metal bump.
Here is the result of that.
The second one is the fx file. I see it reacts differently to the lighting setup. I guess it's because it misses some of the options such as reflection and glow.
It would be great to have them.:hurt:

http://img17.imageshack.us/img17/9733/creechshader.jpg

One more thing... if I use max 2008; and the proper shader file, will that add shadows to the ground and also upgrade the shadows on the character ?

Buzzy 16-03-2009 04:46 AM

Try the 'Complete Shader' on the first page of this thread. It has reflection and glow support.

And yes, these shaders will create shadows in max2008 and up. (you have to enable shadows in the scene first)

Sebiomegas 16-03-2009 06:19 AM

Is there a way to modify the complete shader file so that it works with Pixel Shader 2.0.
I tried changing the 3.0 to 2.0 in the text of the file but it didn't work. Gave me this error:
E:\Tools\Display\Shader_Donze_Comp_NoShadows.fx(53 2): error X5608: Compiled shader code uses too many arithmetic instruction slots (65). Max. allowed by the target (ps_2_0) is 64.
E:\Tools\Display\Shader_Donze_Comp_NoShadows.fx(12 44): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed


Just the standard one will work.

Buzzy 16-03-2009 02:12 PM

No, the complete shader has too much stuff going on to fit under the 2.0 limit of 64 instructions. If I made a custom version with no branching logic, then maybe I can pull it off. I'll look at it.

hulahuga 29-03-2009 07:51 PM

Ey guys, nice thread. But if i use Maya, how do I make them work then??

Sry for the noob question, shaders are my absolute weakest side.

Pickman 07-04-2009 06:07 AM

Hulahuga these shaders are for max only as far as I know. Try searching the web for some shaders for Maya. I've heard there are some.

hulahuga 07-04-2009 09:34 AM

okay, thanks


I've found some. But most are locked to 8.5 versions..

well off to mental ray.

Buzzy 13-04-2009 11:54 PM

Hey everyone, I've done a bit of an update to the first post. Just some news about what I am working on, plus a significant improvement to the Complete Shader. Check it out.

Shader_Donze_Complete.fx
Shader_Donze_Comp_NoShadows.fx

Buzzy 02-05-2009 12:59 AM

I've been working on a new shader for a few weeks and I got to a good point where I think its ready to be thoroughly tested. So have a go at it and see if you can break it.

Shader_Donze_Bleach_Beta.fx
Shader_Donze_Bleach_NoShad.fx

I'll explain some of the features in further detail a bit later. Gotta run right now though.

Sebiomegas 02-05-2009 04:19 AM

Can I use these shaders without Shader 3.0 ?
Secondly, Is there a way to get double sided display with the metal bump shader ?

Buzzy 02-05-2009 04:35 AM

1 Attachment(s)
Ok, so here's some info on what's new with this shader.

1) Light Attenuation - The lights can now be set to have a falloff over distance. This is very good for creating moody lighting. Basically it has a near value and a far value. The light will be at 100% value up to the near distance then fade linearly down to the until it reaches 0% at the far distance. Now this system is a bit limited. It uses one set of distance values for all 4 lights. So if you want different falloffs, you will have to move the lights. I did this because the shader rollout is already getting real long, and I didn't want to add 8 more spinners. I would really like to link the attenuation to the actual attenuation values in the light's properties, but I haven't been able to figure that one out yet.

2)Fresnel Lighting - This basically adds a highlight around the edge of the model. Simulates the rim light causes by light scattering through the fine hairs/dust/etc on the surface of the skin. Has settings for amount and size. Giving it a negetive amount, you can actually create a "rim shadow."

3)Subsurface - I've added some subsurface controls similar to my old skin shader. These are a little simpler but with much more robust code. It will add the subsurface color to the surface color in areas perpendicular to the light.

4)Glow Thru - I had this in my barbarian, but the code was really really rough. This will simulate light passing though thin material like ears. It uses the same map/color as the sss.

5)Bleach Bypass - This should probably just be a post-process shader, but I added it here just for fun. Bleach Bypass is the process used in Saving Private Ryan and Minority Report to give them that contrasty look. It increases contrast and lowers saturation. I am working on giving it a little grain too, but noise is harder to do in HLSL than it needs to be.

6)Half-Lambert - Half-Lambert shading has been in my shaders since day 1, but it never interacted properly with cast shadows. I've fixed that and I've also linked it to the SSS Map's alpha channel, so you can control how much it affects the shading.

7)Glow - I've made a few minor changes here. First, I've changed how the glow is added so that it doesn't get increasingly blown out as you add more light passes. It also interacts a little differently with the surface shading on the model.

8)There are several other minor improvements, mostly just code cleanup that shouldn't affect the end result.

Here's an example of a model using some of the new features. There are no maps used, just solid colors and shader effects with a single light. This shows the light attenuation, the fresnel highlights, and the sss/half-lambert stuff.

Buzzy 02-05-2009 04:42 AM

Sebiomegas - If you want all of the features, then yes, you will need to have Shader 3.0 support. If you give me a list of specific features that you want, I can try to make a custom shader for you that can run under Shader 2.0

As for the Metal Bump, that is a totally different animal from HLSL shaders. It is essentially its own rendering program. I can't say that I know much about it or how to manipulate it.

Sebiomegas 02-05-2009 04:55 AM

Impressive features.
As far as the Fx I'm using, They're all in the Metal Bump, but no double sided display.:( Transparency also has some glitches.

This is what I need:
Diffuse w\Alpha
Normal
Specular
Reflection
Glow

Big thanks!

BiG ToE-3DT 02-05-2009 05:00 AM

could just be me, but I was trying out this new shader with my dom war character and all I got was black. Played withthe lights and got the black to go away, but there was no textures showing through. Just a basic matte color.

Buzzy 02-05-2009 06:01 AM

BigToe: Did you "Enable Diffuse Map"? There are check boxes to turn on all of the texture maps.
Theres also a chance that some of the default values for some of the effects are weird, but i don't think they'd turn the model black.
I'll see if I can get my model to turn black.


Sebiomegas: I'll see what I can do. What version of Max are you using?

Sebiomegas 03-05-2009 02:06 AM

@buzzy:I'm on max 9.

I really need to update my machine rig.:ugh: All your more advanced shaders look so cool.

Sebiomegas 08-05-2009 12:33 PM

I found this Generic Image Based Lighting shader.
http://www.luxinia.de/index.php/ArtTools/3dsmaxFX

After a quick try out ,It seems to work for me.
Maybe you could inspire yourself from it.

Anyway if I can't get something decent out of these DirectX shaders, I will rely on good old render engine.:hmm:

aUGIS 10-05-2009 03:26 PM

Buzzy, I tried your complete shader, it is great, but I cant get specular map working. I works somewhat when I copy difuse map on speclar slot, but not with black and whit map ate spcular map. and it does work without map at all, but it has similar specularity everywhere

pat069fmm 06-10-2009 05:19 PM

How to blend 2 textures with your last shader ?
 
Hello Buzzy,

I used your last Shader "Shader_Donze_Complete_renderstyle" in 3dsmax 2009. Everything works diffuse, specular, normal map, but can you help me with the blending with vertex color?

I try to blend 2 textures together. I added a "Mix" material after your shader in the first ID. I can see the blending of the two texture after a quick render, but not directly in the viewport.

Maybe your shader works like that.. If not I will be really happy to know how It work?

Thanks in advance.

Sebiomegas 04-02-2010 03:56 AM

Hi !

I'm looking for some info on real-time shaders and GPU.

.1 Are Nvidia Quadro cards better when it comes to real-time shaders ?
.2 Can I display the same thing with a Geforce.
(Are there any performance issues.)

I want to buy a new graphic card.

Thank you !

Buzzy 04-02-2010 02:09 PM

Quadro and GeForce both use the same chipset. The main difference (as far as I'm aware) is speed vs. quality.

GeForce cards are designed for gaming so they can render at higher framerates, but at the cost of resolution and image quality, possibly even dropping frames altogether. They are triangle-pumping machines.

Quadro cards are designed for CAD/video production, so they can't render as fast, but they can produce higher quality images and higher resolution, and it won't drop frames.

For realtime shaders, either one will work fine, as long as you are using DirectX (preferably DX 9 or higher) I would strongly recommend a high-end GeForce simply for the cost difference. Quadro's are really expensive, and not worth it for someone who is not doing heavy video processing. Plus, because Quadro and GeForce use the same core chipset, you can mod a GeForce to think it's a Quadro and install Quadro drivers. It still won't be a Quadro, but it's a good middle ground.

Buzzy 04-02-2010 02:11 PM

I think it's high-time I cleaned up this thread. That oughta be a good task for me today.

Sebiomegas 05-02-2010 12:17 AM

Thanx Buzzy !
Your shader stuff is really cool, so I need Pixel Shader 3.0 support.

I am finaly getting my second computer after six years.
Quadro are SO expensive.

I am planning to buy a i7 920 processor with 6 GB of DDR3 RAM .

I'll have to chose one of those card:

EVGA Nvidia GTX 260 896Mo DDR3

EVGA E-GEFORCE NVIDIA GTX275,SUPERCLOCKED,896MB,448BIT DDR3

ASUS GeForce ENGTS250 DK/DI/1GD3GF GTS250,PCI-E 2.0,1GB-DDR3

Any recommendations ?

Why does two of them have 896 mo and not 1 GB ?

dudeman 14-06-2010 08:24 AM

Quote:

Originally Posted by Sebiomegas (Post 768036)
Thanx Buzzy !
Your shader stuff is really cool, so I need Pixel Shader 3.0 support.

I am finaly getting my second computer after six years.
Quadro are SO expensive.

I am planning to buy a i7 920 processor with 6 GB of DDR3 RAM .

I'll have to chose one of those card:

EVGA Nvidia GTX 260 896Mo DDR3

EVGA E-GEFORCE NVIDIA GTX275,SUPERCLOCKED,896MB,448BIT DDR3

ASUS GeForce ENGTS250 DK/DI/1GD3GF GTS250,PCI-E 2.0,1GB-DDR3

Any recommendations ?

Why does two of them have 896 mo and not 1 GB ?

I know your post goes back a long time, but just to inform others who may be facing the same question:

Video cards are tricky when it comes to choosing which you'll be going for. The numbers on the cards can be both confusing and misleading - a gtx260 is lots faster than a gtx250, but there's little difference between the gtx260 and 275.

Nvidia and Ati's cards can always be seperated into 3 groups, regardless of which series. There's budget, midrange and highend cards. In older nvidia series, it was always as following: *100-*500=budget, *600-*700=midrange *800-*950=high end.
Each step in "range" will usually double the performance(and price) of the previous.
That means a GeForce8600 will get roughly half the performance boost over a previous generation graphics card when compared to a GeForce8800.
For anyone that even reads these forums; all budget type cards should at all costs be avoided. A GeForce 9600 will not even come close to the performance of even a 8800 - budget, midrange and high end are completely different leagues.

Sooooo, what to make of all this? You can either follow many tech sites and try to stay up to date with everything that goes on in this area, or simply find a proper benchmarking site. Tomshardwareguide is a good example - it has up-to-date charts of all popular processors and graphics cards, and allow an easy comparison of the choices you're facing.

Another thing I'd like to adress here is the Quadro/FireGL vs. GeForce/Radeon cards. I'm principically opposed to the expensive counterparts because it is actually the exact same hardware. The difference is the drivers. In the past, we've been able to tweak the detonator drivers (now known as ForceWare, or simply Nvidia drivers) to recognise a geforce card as a Quadro to unlock the quadro-exclusive features in some 3d software, the consumer drivers are actually more efficient (they dont skip frames...) and you wont miss out on anything (except slower game performance) in current software suites.

As for your particular choice, I'd have gone for the 275 unless it was at least 20% more expensive than the 260. The 250 would have been a bad choice performance-wise.

sammuelsama 08-10-2010 05:46 PM

Fake reflections versus lightmap shader fx
 
Hello guys,

I have a question about an issue I am having right now with my 3ds max lowpoly environment.
I am not able to get anymore my fake reflections since I added my lightmap shader, because I need to fake the light too through vertex paint lighting and lightmaps.

Do you know a useful shader that can do my reflections and preserving my lightmap, any ideas? :wall:

http://sammabreu.files.wordpress.com...flections1.jpg

Thanks,
Sam

sammuelsama 08-10-2010 05:48 PM

I forgot to mention that I duplicate some objects to get that fake reflections under the ground... The render has to be in the viewport of 3ds max...


All times are GMT. The time now is 06:43 PM.

Powered by vBulletin®
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
all images displayed on this site are copyright the original artists and may not be reproduced, copied or published elsewhere without their express permission