FxComposer 2 -> .material Exporter

What it says on the tin: a place to discuss proposed new features.
kcbanner
Goblin
Posts: 208
Joined: Sat May 05, 2007 4:49 pm

FxComposer 2 -> .material Exporter

Post by kcbanner »

FxComposer 2 Beta has just been released...its got a whole whack of new features including CgFx and OpenGL, COLLADA support, among some other awesome things, read here:
http://developer.nvidia.com/object/fx_c ... _home.html

Now, one of the features is full python scripting support...so I propose a FxComposer2 -> .material exporter.

This would open so many doors and help us programmer types make some nice looking shaders :P

Is anyone interested in doing this?

-kcbanner
User avatar
AlphaWolf
Halfling
Posts: 70
Joined: Wed Jun 13, 2007 11:12 pm

Post by AlphaWolf »

That would be great!

Is there at least a converter for FXComposer 1.xx ?
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: FxComposer 2 -> .material Exporter

Post by xavier »

kcbanner wrote: Now, one of the features is full python scripting support...so I propose a FxComposer2 -> .material exporter.

...

Is anyone interested in doing this?
Go for it, let us know when you are done and it's available.

BTW, I don't recall seeing a Linux version of FX Composer on nVidia's site -- did I just miss it somewhere? ;) (Those not on IRC last night won't understand this last bit).
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
kcbanner
Goblin
Posts: 208
Joined: Sat May 05, 2007 4:49 pm

Post by kcbanner »

@xavier I have a VM that supports 3D accel :P. I know the last fxcomposer didn't run under wine (hlsl only), I plan on trying this under wine soon.

I dont know if I can do this myself, I was more suggesting it :P
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

/me is going to have to look into virtualization soon

You could actually look at the source for the RenderMonkey exporter -- it's done in Python. I plan on redoing that one in C++ because, well, trying to use it when you don't want the pain of assembling a working Python install (and the right version, of course) is more than its worth for that. However, it could be useful if you wanted to work up a FXC exporter, since at least the backend code would already be done more or less...
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
Evak
Orc Shaman
Posts: 707
Joined: Sun Apr 02, 2006 7:51 pm
Location: Sacramento, CA
x 1

Post by Evak »

this would be awesome as most artist friendly tools export to .FX and so far I've had very good results loading them into FX composer 2 and having them compile correctly.

Something like RMogre for fxcomposer would make things MUCH easier.

Rendermonkey doesn't import shaders at all making it almost useless if you use other tools to make your shaders. You can't even paste the .fx source straight into render monkey because everything is compartmentalized into seperate sections of the material tree. So you never see all the source at once.

Not sure what ATI were thinking when they made rendermonkey to be honest.

A decent .FX exporter for FX composer 2 would provide an easy path to getting shaders out of shaderFX and Mental mill and straight into ogre :)

Hope someone can do it ;)
Geryon
Gnoblar
Posts: 22
Joined: Tue May 02, 2006 8:50 pm

Post by Geryon »

The tool itself seems damn good - a lot nicer than Rendermonkey now. However, the SDK docs are spotty - I can't find any way to even access the guts of an effect through their code currently (at least in Python). The samples all appear to be basic GUI control things.

I'm sure it's doable, just one of those things where they're still in beta and the docs are still pretty shakey.

Update: I played with the Python console a bit after I posted this and got a list of values from the material, but they're unlabeled. It's been a long time since I've used Python, so I'm not sure how to get much more out of it without some more study. I personally would like to get this exporter going myself, I could use it for my own artists.
User avatar
bjorke
Gnoblar
Posts: 22
Joined: Tue Jul 10, 2007 8:33 pm

Post by bjorke »

If anyone needs a hand working this out, please let me know -- I'm at NVIDIA and have written most of the sample shaders and have been delving deeper into the Python scripting now that the stable release version is here. A nice advantage is that I can ring up the programmers and pester them when I don't understand something....

KB
User avatar
bjorke
Gnoblar
Posts: 22
Joined: Tue Jul 10, 2007 8:33 pm

Post by bjorke »

Geryon wrote:...got a list of values from the material, but they're unlabeled. It's been a long time since I've used Python, so I'm not sure how to get much more out of it without some more study. I personally would like to get this exporter going myself, I could use it for my own artists.
Check out the latest beta, I've started including extra query/probe scripts for Effects, Materials, Material Parameters, Images, etc.... look for scripts labelled simply "Effects.py" etc

They're in ....\FX Composer 2\MEDIA\scripts\
User avatar
Lee04
Minaton
Posts: 945
Joined: Mon Jul 05, 2004 4:06 pm
Location: Sweden
x 1

Grrrrrrrreat!

Post by Lee04 »

If anyone needs a hand working this out, please let me know -- I'm at NVIDIA and have written most of the sample shaders and have been delving deeper into the Python scripting now that the stable release version is here. A nice advantage is that I can ring up the programmers and pester them when I don't understand something....
Great to see that someone like yourself at Nvidia understands Ogres importance...

Lee
Ph.D. student in game development
Backov
Halfling
Posts: 56
Joined: Tue May 10, 2005 1:01 am

Post by Backov »

bjorke wrote:
Geryon wrote:...got a list of values from the material, but they're unlabeled. It's been a long time since I've used Python, so I'm not sure how to get much more out of it without some more study. I personally would like to get this exporter going myself, I could use it for my own artists.
Check out the latest beta, I've started including extra query/probe scripts for Effects, Materials, Material Parameters, Images, etc.... look for scripts labelled simply "Effects.py" etc

They're in ....\FX Composer 2\MEDIA\scripts\
Beauty! I will do that. Is that beta 4 they're in?

I'm planning on putting my new junior hire here on an exporter. We'll see whether the higher ups let me release it or not.

EDIT: They don't appear to be in the beta I have (beta 4). I take it there's probably a more recent beta for registered developers. Speaking of which, that process seems ridiculously hard, since the form is broken and asks for a lot of information I really don't have the clearance to give out.
Last edited by Backov on Mon Jul 16, 2007 10:30 pm, edited 1 time in total.
User avatar
Evak
Orc Shaman
Posts: 707
Joined: Sun Apr 02, 2006 7:51 pm
Location: Sacramento, CA
x 1

Post by Evak »

I hope someone picks up on the offer of help. FX composer is a marked improvement over rendermonkey and the first FX composer. Seems like exactly what we need to make shaders more accessible.

Every time I make some progress converting FX files, I end up needing to tweak something and find another layer of complexity that makes the methodic conversion I was trying for that much more complicated.
Backov
Halfling
Posts: 56
Joined: Tue May 10, 2005 1:01 am

Post by Backov »

Like I said, I fully plan to. How can I contact you bjorke?
User avatar
bjorke
Gnoblar
Posts: 22
Joined: Tue Jul 10, 2007 8:33 pm

Post by bjorke »

Backov wrote:Like I said, I fully plan to. How can I contact you bjorke?
Push the "PM" button? :wink:

I also sent you a direct e-mail address.
User avatar
axon
Halfling
Posts: 41
Joined: Sun Jul 11, 2004 3:28 am
Location: Adelaide, Australia
x 1

Post by axon »

What's the latest on support of the latest FX features (in the FX --> .material converter.. if there is one)?

Being able to trivially load in Ogre any FX file would be REALLY great.

I'll grab the latest code from CVS and see what the comments in the code reveal. (If I can find anything at all)... if anyone can offer any insight please do! :)
marshmonkey
Goblin
Posts: 251
Joined: Thu May 31, 2007 5:41 am

Post by marshmonkey »

wondering about this as well, I'm an artist having a hell of a hard time getting a shader created in mental mill into ogre.
mr_burns
Kobold
Posts: 33
Joined: Mon Dec 11, 2006 8:53 pm
x 1

Post by mr_burns »

Any updates on the FX Composer 2.x to Ogre exporter? Is there a repository, or anything that the group can contribute to?
Backov
Halfling
Posts: 56
Joined: Tue May 10, 2005 1:01 am

Post by Backov »

mr_burns wrote:Any updates on the FX Composer 2.x to Ogre exporter? Is there a repository, or anything that the group can contribute to?
I just looked the problem over. It's a big job, and the junior I was going to assign the task to is already too busy.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

Like I said in the other thread, I've taken over the RM exporter with the intent of making a C++ version that does not rely (artifically, that I can tell, in terms of the current one) on Python. I haven't done it yet for the reasons I stated over there -- RM is simply inferior to FXComposer.

However, one of the devs on FXComposer at nVidia has offered assistance in these forums on making an FXC-->Ogre exporter (oddly enough, in Python, but since Python is supported directly in FXC it's not as big an issue as forcing the extra dependency is in the current RM exporter). No one as yet has taken him up on that, and since our project is not yet at the stage where we need that functionality, I've not looked further into it personally.

You may just be stuck with copy/pasting the shader code from the FXC or RM .fx export, and sticking it into an Ogre material. Hardly the ideal solution, but it works, and for now, since this is an open-source effort, you can either wait for someone else to get around to it, or create such an exporter yourself.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
kcbanner
Goblin
Posts: 208
Joined: Sat May 05, 2007 4:49 pm

Post by kcbanner »

So you can literally just use the auto generated code in either program in a shader?

I am often confused when it sets up some textures in memory and I don't know what I need to pass to the shaders from Ogre, that is really confusing.
User avatar
bjorke
Gnoblar
Posts: 22
Joined: Tue Jul 10, 2007 8:33 pm

Post by bjorke »

I started fiddling with this again -- all I need to do is work at night on the weekend :P

Getting simple output of material values from FX Composer to an Ogre material is not particularly difficult using the existing FX Composer Materials and Effects modules. In fact the code is pretty short! It's a typical stack of loops:

Code: Select all

for each material
   for each profile in the effect for that material:
        for each technique in the profile:
             for each pass in the technique:
                  for each shader in the pass:
                       for each shader parameter...
What's TOUGH is if the code inside a shader function depends on globally-scoped parameters -- that is, values that are not passed directly to the vertex or fragment shaders, but rather are inherited from the surrounding .*fx scope. Ogre doesn't seem to have such a surrounding scope, so digging down within the HLSL or CgFX structures is a bit harder.

One solution might be to simply ignore those global parameters, maybe printing a little cautionary message if the code thinks they may be present but otherwise just depend on the formal parameters of the shader functions. It makes for a much cleaner setup all 'round -- it might not hit 100% of the corner cases, but if something simple can tackle 90% of all shaders.....
User avatar
Alexander
Gremlin
Posts: 175
Joined: Sat Aug 05, 2006 3:55 am

Post by Alexander »

bjorke wrote:I started fiddling with this again -- all I need to do is work at night on the weekend :P
This is much appreciated.
kcbanner
Goblin
Posts: 208
Joined: Sat May 05, 2007 4:49 pm

Post by kcbanner »

Any progress on this?
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

bjorke wrote:I started fiddling with this again -- all I need to do is work at night on the weekend :P

Getting simple output of material values from FX Composer to an Ogre material is not particularly difficult using the existing FX Composer Materials and Effects modules. In fact the code is pretty short! It's a typical stack of loops:

Code: Select all

for each material
   for each profile in the effect for that material:
        for each technique in the profile:
             for each pass in the technique:
                  for each shader in the pass:
                       for each shader parameter...
What's TOUGH is if the code inside a shader function depends on globally-scoped parameters -- that is, values that are not passed directly to the vertex or fragment shaders, but rather are inherited from the surrounding .*fx scope. Ogre doesn't seem to have such a surrounding scope, so digging down within the HLSL or CgFX structures is a bit harder.

One solution might be to simply ignore those global parameters, maybe printing a little cautionary message if the code thinks they may be present but otherwise just depend on the formal parameters of the shader functions. It makes for a much cleaner setup all 'round -- it might not hit 100% of the corner cases, but if something simple can tackle 90% of all shaders.....
Actually, Ogre does have these global params; they mostly are the auto_params in the material/shader definitions. Standard Cg semantics such as WorldViewProjection can be mapped directly to Ogre auto-params.

The problem is that Ogre does not have the notion of "material instancing" that COLLADA has, so parameters assigned to fixed-function materials have no real meaning in Ogre unless you want to make a new material for each.

I am working on an Ogre <--> COLLADA importer/exporter right now and this is something I actually am working on at the moment (general support for material params via the instance_controller and instance_geometry elements in the COLLADA scene graph).

But ya what Kevin says is correct -- there is no real direct mapping for a lot of what is in COLLADA to how Ogre deals with stuff.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
bjorke
Gnoblar
Posts: 22
Joined: Tue Jul 10, 2007 8:33 pm

Post by bjorke »

Cool -- I *am* actually working on this some more, wedged-in among about 8 other things (and I even mentioned Ogre in the press this morning ). I know it seems slow -- to a degree it is, since I'm approaching it in part as an element of making our tools and shader library more-accesable to a variety of game engines and developers, and have been working on a massive editing task that re-writes most of our library to NOT use those problematic global variables, which can be a pain for any developer (not just Ogre developers) who want to be able to cut-n-paste shaders into their own games.

That said, I'm really hoping to have a version up and running before I head off in two weeks for a month's worth of Chinese food :)