Jump to content
  • Advertisement
Sign in to follow this  
Andrew McDonald

Accessing DirectX 9 Shader parameters in MAXScript

This topic is 4800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I posted this in comp.graphics.packages.3dstudio but there's very little traffic there; hopefully someone can point me in the right direction here :-) I have a material which is of type DirectX 9 Shader, with an .fx file loaded and various parameters set. I need to export these parameters with the scene in some format, ideally ASCII. ASE would be perfect but the exporter seems to ignore all the parameters. It seems easy enough to write my own exporter in MAXScript, but I can't find out how to enumerate and access the parameters the artist has set for the export? Surely there must be a way to grab these? Thanks for any help; something that works for both max 6 and 7 would be best.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Andrew McDonald
I have a material which is of type DirectX 9 Shader, with an .fx file loaded and various parameters set. I need to export these parameters with the scene in some format, ideally ASCII. ASE would be perfect but the exporter seems to ignore all the parameters. It seems easy enough to write my own exporter in MAXScript, but I can't find out how to enumerate and access the parameters the artist has set for the export? Surely there must be a way to grab these?

Maxscript has a pretty limited feature set, especially when it comes to 3rd-party plugins. In my use of it (which was a couple of versions ago, so it could have expanded by now), the Maxscript API didn't extend beyond native 3ds Max functionality.

If you really want to do super-custom stuff like that, I recommend using the C/C++ API. It may be a little steeper on the learning curve, but it will be better in the end.

Share this post


Link to post
Share on other sites
Thanks for the advice; I found the answer with the help of a workmate.

You can use getPropNames on the material, then getProperty to retrieve its value. The effect's parameters are reported as properties along with the standard properties, but you can filter it to just the interesting ones like so:

for p in (getPropNames MyMaterial) where p != #effectFile and p != #technique and p != #renderEnabled and p != #renderMaterial do
(
Value = getProperty MyMaterial p
Type = classOf Value
...
)


I may end up going for a full C++ export plugin eventually anyway just so I can fit in with all the others, but I'll be sorry to lose the flexibility of MAXScript now I've got used to it!

Share this post


Link to post
Share on other sites
Sweet, I will remember that. Maxscript is kinda useful since you can write simple stuff so fast. It could be great if it had better documenation and a better development environment. Although, the docs for the C++ SDK is lacking too...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!