Sunday, February 13, 2005

DX9 Shader Material Bug in 3DS Max

I've recently been building a scene in 3DS Max that uses the HLSL shaders that I've written. I apply the shaders with Max's DX9 Shader material. (I've written a tutorial on using HLSL shaders in Max here.) After working on the scene for a few weeks the viewport performance became very slow and I was no longer able to work in shaded mode. I was discouraged thinking that I would no longer be able to use Max for my HLSL shader platform because it was just too slow.

Instead of giving up I decided to do some performacne experiments. After testing a few different theories I discovered that the frame rate in the viewport was related directly to the number of DX9 materials I was using in a multi-subobject material. If my model only had one multi-subobject material, my frame rate was more than 100 fps. If I had two subobject materials the frame rate dropped to 50 fps. At 4 subobject materials the frame rate went down to 25, and at 8 the frame rate was around 12. See the pattern?

I decided that this must be a bug in the way max handles DX9 shader materials as subobject materials so I chopped up my scene so each object only had one material assigned. Now the frame rate is great and I can work again. This is kind of annoying since multi-subobject materials are part of my work flow, but I can live with this work around for now.

If anyone else has had this problem or knows more about it, I'd love to hear from you.

6 Comments:

Anonymous Anonymous said...

You asked - the backgrounds are great -I'm an ameatuer so your work will definately not be seen by anyone else than my family or friends. I'll use it to make a cool DVD menu for my secret agent movie.

April 23, 2005 3:16 PM  
Anonymous Anonymous said...

hi ben, i have problem with hlsl shaders too, but only with someones /glow,hemisphere.../ they work in composer 1.8 fine but not in viewport in max 7.5.

February 14, 2006 8:15 PM  
Blogger Ben Cloward said...

This is probably a problem with syntax. I bet I could fix it for you so it would work in the Max viewport if you emailed the shader to me. My email address is in lots of places on my web site.

February 14, 2006 10:40 PM  
Anonymous martincg said...

that was really fast answer :-),but that shaders which are not working in max viewport are distributed like samples with 3d max - i have last versions of n-vidia drivers on GeForce fx5900xt - do you think there is problem in syntax? btw - you have great Blog, i am doing arch. vizs and lots of your shaders are very inspirative.

February 15, 2006 5:05 AM  
Anonymous martincg said...

hallo Ben, i install trial max 8 and there is no problem with distributed FX shaders. /viewport of max 7 still not working - crash max if i can load some dx9 shaders/ But still have problems with some shaders from composer - that could be problem with syntax like you said. /if i could, i will send mail with that shader to you/ my next question is: is there for max 7 or above HLSL connection editor for composer like for max 5 ? on nvidia pages is just version for max 5 and is not working with 7. thank you

February 15, 2006 7:06 AM  
Anonymous Anonymous said...

Talking about performance of DX mat using multisub : If you assign a Dx multisub to several primitives (like teapots), It's incredibly fast (even with modifiers added) ! But as soon as you convert them to poly/mesh, the framerate drops down to hell... It's a shame autodesk can't fix this issue...

March 15, 2006 4:40 AM  

Post a Comment

<< Home