CGTalk > Software > Autodesk 3ds max
Login register
Thread Closed share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 05-27-2005, 03:45 AM   #1
bcloward
Frequenter
 
bcloward's Avatar
portfolio
Ben Cloward
Technical Artist
Bioware
Austin, USA
 
Join Date: Mar 2004
Posts: 193
Send a message via MSN to bcloward
DirectX FX Shader Demo

I created a simple demo that shows off some of the effects that can be achieved in real-time using the DirectX 9 material combined with an HLSL shader. Here's a screen shot from the Max viewport:



This is a single polygon.

Some of the effects used in this demo are:

- Normal Mapping
- Swizzled Texture Compression
- Per-pixel Light Attenuation
- Offset Mapping
- Global Illumination

You can download the 1.9 MB zip file here:
http://www.bencloward.com/FXshaderInMax.zip

EDIT: I just updated this shader so that it will now work with ATi cards.

The zip file includes the max file, the textures, and the FX shader - as well as a readme doc that explains the shader a bit better. To run the demo you'll need a graphics card that supports DirectX 9 and Pixel Shader version 2.a

What do you think? I'd love to get some feedback on this. I feel like FX shaders in Max are a very powerful tool that most people aren't using. Does anyone else use them?
__________________
Ben Cloward
Technical Artist

HLSL Training DVDs
| ShaderFX | HLSL Shader Thread | My Shaders | Free Textures | Tutorials



Last edited by bcloward : 06-24-2006 at 05:12 AM. Reason: Updated the shader so it works with ATi cards now.
 
Old 05-27-2005, 08:14 AM   #2
Rockin
Appearances may deceive
 
Rockin's Avatar
portfolio
Horea Ioan Trinca
Tractor Media
Cluj-Napoca, Romania
 
Join Date: Sep 2004
Posts: 831
Hi,
I worki in the gaming industry so I'm very interested in this shader stuff.

I was just wondering ('just' because right now I'm using just a GeForce2), does HDRI work on GeForce FX 5xxx series? Or do you need GeForce 6xxx?

Oh, and many thanks for sharing this! (and the links in the readme are cool too)
__________________
Check out my work: www.TractorMedia.ro
 
Old 05-27-2005, 11:48 AM   #3
bcloward
Frequenter
 
bcloward's Avatar
portfolio
Ben Cloward
Technical Artist
Bioware
Austin, USA
 
Join Date: Mar 2004
Posts: 193
Send a message via MSN to bcloward
You're welcome! I'm glad that you like it.

The demo uses a "diffusely convolved cube map" to create the effect of global illumination. To create the cube map, I started out with a high dynamic range light probe. Once it was convolved, I converted it to standard low dynamic range image. I had to do this because I haven't figured out how to get Max to use HDR images with FX shaders. If anyone knows how to do this, please let me know!

So the demo doesn't actually use a HDR image directly - just a cube map that was derived from an HDR image. The reason that it requires a high end graphics card is because of the number of instructions in the pixel shader.

The demo will work on any graphics card that supports DirectX 9 and pixel shader 2.a. I think that all GeForceFX cards can run it as well as all Radeon 9700 and above.

By the way, if you haven't seen the offset mapping/parrallax mapping effect in action, you really need to take a look at this. When I got it working for this demo, I was blown away by how real it made the surface of my model look. Offset mapping is the effect that's used in the Unreal 3 engine to create the amazing detail on the walls - without using any extra polygons - and we can use it right in the Max vieport!
__________________
Ben Cloward
Technical Artist

HLSL Training DVDs
| ShaderFX | HLSL Shader Thread | My Shaders | Free Textures | Tutorials


 
Old 05-27-2005, 12:59 PM   #4
CG-Gordon
Frequenter
 
CG-Gordon's Avatar
portfolio
Gordon Brown
Artist
Canada
 
Join Date: May 2003
Posts: 211
Just tried this on my FX card at work and the shaders didnt work, i'll have a look tonight at home on my 9800. Thanks so much for posting this ben I can hardly wait to see what it looks like in the viewport, especially the parallax mapping. Im extremely interesting in the fx shaders, but ive been finding it difficult to get decent documentation on them (cept your website ofcourse), plus it seems you really need to write a shader to get it to do exactly what you need. An artist friendly UI for making shaders would be very welcome
 
Old 05-27-2005, 05:18 PM   #5
bcloward
Frequenter
 
bcloward's Avatar
portfolio
Ben Cloward
Technical Artist
Bioware
Austin, USA
 
Join Date: Mar 2004
Posts: 193
Send a message via MSN to bcloward
Hmm, what type of GeForce FX card do you have at work? It's possible that some of them (the 5200 for example) don't support pixel shader 2.a. I thought they all did but I guess I was wrong. I've only tested it on a 6800 and a 5900. I really hope it works on your Radeon. If not, I may need to remove some of the features to make it more compatible with less-than-top-of-the-line hardware so more people can see it.

There is almost no documentation on FX shaders. All that I learned about them comes from the Cg Tutorial book and from messing around with the shaders that come included with Max and with FXComposer. Since HLSL and the FX format are parts of DirectX, Discreet probably doesn't think that they need to put much effort explaining concepts that Microsoft should be explaining. Now that I think of it, we should probably go looking on Microsoft's MSDN for information on creating FX shaders - although that info will probably all be written with a programmer audience in mind.

A UI for making shaders would be very cool. They've already done that to a small degree with the "DX Display of Standard Material" feature - but that's really limiting and I've found that the shaders it creates have lots of bugs in them. If you want a really good UI for building shaders, you need to use something like RTZen or the Unreal 3 engine - although the high price on those is a bit of a barrier. However, since those do it so well, I doubt that Discreet will feel that it's necessary for them to add more features to Max to do it - but it would be really nice.
__________________
Ben Cloward
Technical Artist

HLSL Training DVDs
| ShaderFX | HLSL Shader Thread | My Shaders | Free Textures | Tutorials


 
Old 05-27-2005, 05:28 PM   #6
Schwinnz
Beware, Kitozilla!
 
Schwinnz's Avatar
Pierre-Luc Auclair
Web/Graphic Designer
Seeking employment in Toronto
Canada
 
Join Date: Nov 2002
Posts: 984
Send a message via MSN to Schwinnz
Quote:
Originally Posted by bcloward
A UI for making shaders would be very cool. They've already done that to a small degree with the "DX Display of Standard Material" feature - but that's really limiting and I've found that the shaders it creates have lots of bugs in them. If you want a really good UI for building shaders, you need to use something like RTZen or the Unreal 3 engine - although the high price on those is a bit of a barrier. However, since those do it so well, I doubt that Discreet will feel that it's necessary for them to add more features to Max to do it - but it would be really nice.


I'd very much prefer XSI's way of dealing with this in the render tree, it's just perfect. Max devs should fear XSI, if I didn't have to stick with it, I'd probably switch.
__________________
Take a look at my websites :
http://heliosmulti.com/plaplo my blogfolio
 
Old 05-28-2005, 01:29 PM   #7
bcloward
Frequenter
 
bcloward's Avatar
portfolio
Ben Cloward
Technical Artist
Bioware
Austin, USA
 
Join Date: Mar 2004
Posts: 193
Send a message via MSN to bcloward
I've never seen how the shader interface in XSI works. Is there a video example on the web somewhere that I could take a look at? I'm interested to see how they handle the issue.

So has anyone gotten this to work in their viewport yet? I'm beginning to think that I may have created something too complex. A demo is no good if nobody has the hardware to run it. If you try to run this and it didn't work for you, let me know what hardware you have and I'll try to make a more simple version that will run on the graphics cards that you guys have.

I'm also interested to know if any of you are actually using this feature in Max - running HLSL shaders with the DirectX 9 Shader material.
__________________
Ben Cloward
Technical Artist

HLSL Training DVDs
| ShaderFX | HLSL Shader Thread | My Shaders | Free Textures | Tutorials


 
Old 05-28-2005, 07:50 PM   #8
EricBartlett
Maker of Thingies
 
EricBartlett's Avatar
portfolio
Eric Bartlett
Littleton, USA
 
Join Date: May 2005
Posts: 133
I just loaded up the file and it runs just fine on my 6800gt, I'll see how it does on my bro's rig with his 9800 after he gets his seat of max installed(picked up both copies yesterday).

Only thing that seems a bit odd is that when the plane is viewed at more of an extreme angle there is corruption of a sort in the texture, it sort of smears a bit. Other than that it works nicely, a lot like a virtual hologram.
 
Old 05-29-2005, 10:35 PM   #9
CG-Gordon
Frequenter
 
CG-Gordon's Avatar
portfolio
Gordon Brown
Artist
Canada
 
Join Date: May 2003
Posts: 211
Hi Ben sorry for the delay, the FX card in work is indeed a 5800. Unfortunately when opening the file at home max crashes before the file is opened. Not sure what might be causing that, most likely a problem at my end tho. I'll try a driver update to see if it has any effects, I was really looking forward to seeing this in the viewport!

Yeah I would love to see the unreal3 editor, but it would be more ideal to have that kind of functionality built into max from the start - cant have everything I suppose.

I for one appreciate all your efforts with these shaders, keep up the good work! A model im working on at the moment uses some of the very simple default ones supplied with max, but even they look great in the viewport. Out of interset have you managed to get an opacity map woriking with these shaders? For some reason I failed to get one to display.
 
Old 05-30-2005, 11:27 AM   #10
s-rajesh78
anm8r
 
s-rajesh78's Avatar
portfolio
Rajesh
Tech Manager
Tata Interactive Systems
Mumbai, India
 
Join Date: Apr 2003
Posts: 194
Send a message via MSN to s-rajesh78 Send a message via Yahoo to s-rajesh78
Interesting to see what can be acheived with DX shaders. WOOW.

For me the file worked perfectly in my homePC with 6800GT-256.

But not in Office with Ti4200.
 
Old 05-30-2005, 04:18 PM   #11
SOuLjA`-
Veteran
Adrian
USA
 
Join Date: Nov 2004
Posts: 86
Hi...

doesn't work for me
i have ASUS ATI Radeon 9800XT 256MB and newest catalyst 5.5 + DirectX 9.0c

if i try to load the file in 3dsmax7, max crashes... i also have Direct3D dx9 activated
here a shot:



i checked dxdiag and tested DirectDraw and Direct3D and everything worked fine, dx9 games like hl2, doom3 are ok @ max details...
i also have trouble displaying normal-mapped objects in the viewport (but i can render them)...strange


sorry for using your thread but i thought i could post here...
any suggestions?thanks ...
__________________

 
Old 05-31-2005, 03:36 AM   #12
bcloward
Frequenter
 
bcloward's Avatar
portfolio
Ben Cloward
Technical Artist
Bioware
Austin, USA
 
Join Date: Mar 2004
Posts: 193
Send a message via MSN to bcloward
Thanks for the feedback, guys. I think I'm beginning to see why more people don't use this feature! :(

Eric-
The smearing that you're seeing is the main drawback of parrallax mapping. You can create normal/height maps that smear less, but if the angle is extreme enough - all of them will smear. There are other shaders that are more complex that do a better job, but they're also much slower. I'm glad that it worked for you.

Based on the experience of SOuLjA`- and CG_Gordon, I'm predicting that Max will crash when you try to open it on your brother's machine. :(

CG_Gordon-
That's bad - that Max crashes like that. From what SOuLjA`- said, it looks like it may just be a big fat bug in Max - not a driver thing. Try opening a new scene in Max and importing all the objects from my Max file - instead of opening it directly. Tell me what happens when you do that.

Based on what Schwinnz said, it sounds like XSI already has a system like that for building shaders with a GUI. That's sounds really cool, although I'm still waiting for him to post a video example of it.

The shaders that I've put up on my web site don't have opacity functionality build into them, but I have been working on a couple of shaders that do. If you'd like I can post one here for you to try out. Just let me know.

s_rajesh78 -
Glad that it worked for you! You seem to be in the minority unfortunatly. :( Anyway, you can see why I'm so excited about this stuff. It allows you to get results that look like they're software rendered - but in real-time!

The Ti4200 will only run DirectX 8 shaders. That means that none of the example shaders that ship with Max will work on it - and since they call the material a DirectX 9 material it kinda seems like they think only DirectX 9 shaders will work - but they're wrong. I wrote a normal mapping shader that only requires DirectX 8 and it works great on the Ti4200. You can grab it here:
http://www.bencloward.com/shaders_simpleNormalMap.shtml

SOuLjA`-
Thanks for your details on your settings. It looks like I thought of something that the Max beta testers didn't test. I just looked it up and learned that pixel shader 2.a is only supported by GeForceFX 5900 and above. So the shader won't work on a Radeon 9800 after all. But it shouldn't crash. That's a bug in Max. I wonder if it would work on a X800. Anyone have one of those they want to try it on? I think I'm going to need to create a new version of this demo for the ATi crowd. Sorry about that guys.

What method are you using for displaying normal maps in the viewport? There are about 5 different ways to do it. Maybe describe the steps you took to get it to give you that red wireframe? Max draws a red wireframe when it thinks your graphics hardware can't handle the shaders that it's trying to use. It's obviously wrong in this case. Try using my DirectX 8 normal mapping shader that I linked to above and tell me if that works.
__________________
Ben Cloward
Technical Artist

HLSL Training DVDs
| ShaderFX | HLSL Shader Thread | My Shaders | Free Textures | Tutorials



Last edited by bcloward : 06-24-2006 at 05:16 AM. Reason: Updated link
 
Old 05-31-2005, 10:44 AM   #13
CG-Gordon
Frequenter
 
CG-Gordon's Avatar
portfolio
Gordon Brown
Artist
Canada
 
Join Date: May 2003
Posts: 211
Thanks for the reply Ben, I'd love to check out one of your opacity map shaders Im at work at the moment but when i get home later i'll try merging your file, i really should have tried that already doh. Yeah im hearing a lot of good things about XSI sounds like they are doing something right. I downloaded the mod copy with HL2 i really must get round to trying it out. God i cant believe my trusty 9800 is incapable of displaying this stuff already, I only got a short while back. Thanks for your efforts Ben keep it up.

Cheers

Gordon.
 
Old 05-31-2005, 02:08 PM   #14
SOuLjA`-
Veteran
Adrian
USA
 
Join Date: Nov 2004
Posts: 86
Hi Ben, thx for your reply

i actualy use this method for normal-mapping in max:
http://www.cgchat.com/forum/showthr...&threadid=20424

and when i enable the "Show Map in Viewport" at the end, i get the red wireframe...
but why? it should work with my 9800XT...

"Try using my DirectX 8 normal mapping shader that I linked to above and tell me if that works."

i'll try later thanks!

maybe somebody can give me a simple normal mapped max scene for testing?
__________________


Last edited by SOuLjA`- : 05-31-2005 at 02:38 PM.
 
Old 05-31-2005, 02:56 PM   #15
theotheo
Know-it-All
 
theotheo's Avatar
portfolio
Theodor Groeneboom
Framestore CFC
London, United Kingdom
 
Join Date: Jun 2003
Posts: 368
Send a message via MSN to theotheo
Hey Ben! Everything works just fine here! Looks great, using a fx 6800 ultra.

Keep up the good work!

-theo
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:48 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.