View Full Version : Pixel shaders in Max
12-23-2004, 01:45 PM
I finally have a DX9 card and have been looking at using pixel shaders on my models. I found a great link for it.
12-23-2004, 01:50 PM
Looks like a nice read. I'll have to check it out when I get some time.
I've been wondering though, since DX9 and Max 7 came out, does anyone actually use Max viewports to see how their models are going to look in-game? That's one of the benefits Discreet talks about, but I don't know that anyone uses it in a production pipeline.
Thanks for the link. I was looking to experiment with Cg and 3dsmax earlier this year, but Cg wasn't compatible with my ATI Radeon 9800 at all. I wonder if they fixed that now? They hint at "compatibility issues" at one point in that article...
12-23-2004, 02:23 PM
no sadly CgFx plugin is based on the old Cg version, not the latest runtime, and afaik also the plugin is hardcoded to be nvidia exclusive, at least I know noone having it working on ATI :/
since I am interested in getting max "preview" using a material system for our engine, I looked into things but it doesnt look rosy hehe. well mostly as I'd need OpenGL and gl support has fallen behind dx in max a lot (no shaders, no viewport managers..) kinda sad. the only solution I think would be opening a new window out of max and sending the renderdata there yourself, which sounds a bit ugly.
anyway while we are at it, if someone can have a look at this:
and check out how "artist/tech friendly" you think it is, would be very cool, it's for a engine I do with friends in the freetime. it's similar to .fx yet not the same as .fx is a bit too codeish and mostly this is more for q3 style shading, since the engine is graphically meant to be geforce3ish
12-23-2004, 02:46 PM
[ QUOTE ]
I was looking to experiment with Cg and 3dsmax earlier this year, but Cg wasn't compatible with my ATI Radeon 9800 at all.
[/ QUOTE ]
CG (http://developer.nvidia.com/page/cg_main.html) is a shader language developed by Nvdia, so I don't think it's going to be compatible with ATI cards any time soon. /images/graemlins/smile.gif
ATI has it's own shader developement environment called Render Monkey (http://www.ati.com/developer/rendermonkey/index.html)
12-24-2004, 04:45 AM
this aint correct, while Cg is a language by Nvidia it works (when compiled to proper profiles) on ATI as well. It's eventually the same as HLSL for directx, while I cant speak for DirectX, under OpenGL Cg will work on ATI's newer cards 9500+ or any card that supports ARB fragment/vertex programs just fine, and with a little hacking on older ATI cards (8500) too. I think the CgFX plugin for max itself is "nvidia only" not the language nor the latest runtime, while the runtime is more supportive for Nvidia (especially to support latest nvidia tech, and "oldest" nvidia cards) it is not exclusive. FarCry used a lot Cg afaik, and works just fine.
RenderMonkey is a IDE to developer shaders, just like MSDEV for c/c++, it is not a language, and therefore cannot be compared to Cg.
The Nvidia equivalent to RenderMonkey is the FxComposer. At least the FxComposer ran on ATI so.
12-24-2004, 10:52 AM
Ah, this stuff is a bit over my head. Thanks for clearing that up.
12-28-2004, 11:05 AM
I use max 7 viewports to preview models for one of our prototypes. We use the cgfx plugin above, and have not had any problems compiling to ati compatible code. We convert everything to .fx or fx composer compatible shader language, and those are just text files that are compiled in real-time on the engine.
It's kind of impressive, they've written a full c# engine that can actually run c# as a text based scripting language, so no need to compile untill your happy with the results. And you get all the nice low level functionality.
You've got to understand though, that a full directx 9 game wont even be seen until 2006-2007. You'll see little features here and there like UT2k4, but UT2k4 is mostly a dx7 engine. Most companies worry about backwards compatibility. So I would'nt be too worried about how dx9 shaders are used just yet, but still keep researching them. I have a feeling the art pipeline will be greatly improved in the next year, so much you wont have to code anything.
01-05-2005, 07:51 AM
Ok, I have a silly question for you guys. I downloaded a fur shader from here (http://www.shadertech.com/cgi-bin/shaders.cgi?filter=1&page=3) it's near the bottom of the page. I opened the file and it contains multiple .cg files. How do I load all these at once on a model? Multi-subobject maybe?
01-05-2005, 10:00 AM
the fur effect is not trivial.
it involves building extra geometry (fins and shells) in code, and set up texcoords for them ...
you will not be able to just put the shaders on any surface, very often those surfaces need to be a bit special and have extra info. this special stuff however is very unique to the effect and will not be part of the cg plugin
in short: no luck, too complex effect
01-05-2005, 10:20 AM
All I can say is dang! I really wanted to make cute catgirl with a fluffy tail /images/graemlins/frown.gif
I also grabbed this shader a while back when trying my hand at Cg, and I actually emailed the fur shader author about the effect and its max portability. Here is some info :
1. I have the whole toolkit installed : toolkit, browser, CGfx viewer, Max Plugin and DX90c. I can browse all the CG shaders in the CGbrowser, but I've been unable to launch your own Fur shader from there, even if I add a custom path pointing to your Fur folder. Any ideas?
This is because my shader is compiled with very old Cg release (1.0 beta, I think). There was a lot of changes from that time in API). It is possible to port this shader to 1.3 Cg and DirectX9, but this requires some knowledge of C++ programming. I don't have a time to do it right now....:( But maybe in october I will do it...
2. I've seen CG shaders working great, and I also had the chance to see some CGfx variable shaders running in Max. Hence my question is, how is it possible to convert a CG shader into a tweakable CGfx material ? I'd obviously be more than interested in a CGfx version of your Fur effect, but I'm affraid I don't master the required voodoo to perform such an operation.
CGfx is some kind of extension.... It is composed of CG shaders... It is possible to put some CG shaders into CGfx and it will work.... But there are some shaders, that require switching render-targets, render-to-texture things and other advanced techniques (e.g. my fur shader). Such shaders would require some major help from 3D Studio Max and as far I know, it is impossible to put them in Max without writing some plug-in...
But there is a hope! Microsoft extended their .fx spec. and if Nvidia will extend his CGfx in a simillar way (and Max tools) it will be possible to run some advanced shaders in Max...
So basically, its doable, but requires hard work. BUT! I think it'd be easier to go the other way round, like writing a demo based on Arek's, except that it'd allow to load a custom mesh instead of a torus, with alphas controlling fur density and lenght for example...
Hmmm realtime fur is tasty /images/graemlins/smile.gif
01-06-2005, 06:02 AM
yeah, indeed, it is somewhat easier to make some cool fx in realtime graphics code than teaching max scanline renderer to do the same. I guess we will see more gpu-based renderers soon, things tend to become more flexible and easier to use...
then again its one thing for a single object, and totally different if a full scene is involved...
ati had some papers and tools about furgen, unfortunately the tool isnt public, at least couldnt find it, but it looked very nice, like custom fur shapes...
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.