CgFx support in OGRE
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
CgFx support in OGRE
I have been working on a new nun-roadmap feature - support for CgFx.
First of all let me explain the need as I see it - every time I create a shader in a shader creation tool like Render Monkey or FXComposer or mental mill - it takes me a long time to translate it to files that will work with OGRE - material, program, *.cg and such. Moreover - my help is always needed when I work with my artist - I would love it - if my artist will be able to create the shader\ material with mental mill graphically - then export to CgFx - then simply use in the application. Moreover - he will be able to work with mental mill open on one window and my application on a different window and just save from mental mill and reload the resources.
I am writing the code as part of the cg plugin.
I need the other OGRE team members to approve before I will commit this code (to 1.8 ).
First of all let me explain the need as I see it - every time I create a shader in a shader creation tool like Render Monkey or FXComposer or mental mill - it takes me a long time to translate it to files that will work with OGRE - material, program, *.cg and such. Moreover - my help is always needed when I work with my artist - I would love it - if my artist will be able to create the shader\ material with mental mill graphically - then export to CgFx - then simply use in the application. Moreover - he will be able to work with mental mill open on one window and my application on a different window and just save from mental mill and reload the resources.
I am writing the code as part of the cg plugin.
I need the other OGRE team members to approve before I will commit this code (to 1.8 ).
Last edited by Assaf Raman on Tue Sep 23, 2008 6:57 pm, edited 6 times in total.
Watch out for my OGRE related tweets here.
-
- OGRE Retired Team Member
- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
My first reaction is that maybe this should be an addon project. But then thinking about it, CgFX is a big part of Cg now. It really is meant to go as a package, even if you can easily use Cg without it. Since the Cg support is already an optional plugin, I think CgFX is a great addition to that system.
-
- OGRE Retired Team Member
- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
I wonder if this would bring up the question of whether to directly support .fx files through the DirectX render systems. It would certainly be the case of one render system having features another doesn't, which I agree is not a good idea, but perhaps this is justifiable? Though I must say I'm rather partial to Ogre's material system. But then, I'm surely biased.
I think the main motivation here is tool support, correct?
I think the main motivation here is tool support, correct?
-
- Halfling
- Posts: 74
- Joined: Mon Dec 13, 2004 1:56 pm
I've been planning to implement cgfx support at some point if it's not done before that. Haven't written any code for it, but I did look into ways of implementing it.
I would definitely like to have it with Cg plugin, or as a separate plugin, not as addon. Because the .fx pipeline is very important on current generation applications and there are lots of applications that support cgfx authoring.
Other than that, the cgfx also does support features and concepts that are not possible with current material scripting.
I would definitely like to have it with Cg plugin, or as a separate plugin, not as addon. Because the .fx pipeline is very important on current generation applications and there are lots of applications that support cgfx authoring.
Other than that, the cgfx also does support features and concepts that are not possible with current material scripting.
-
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
-
- Greenskin
- Posts: 128
- Joined: Sat Jul 24, 2004 9:07 am
- Location: Tulsa, Oklahoma
-
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Needless to say, this is a very cool feature! Cg OGRE plugin IMO is the best place - plus the plugin is still very slim so adding a few features inside it make it 'more complete'.
You mean it has been completed?Assaf Raman wrote: I need the other OGRE team members to approve before I will commit this code (to 1.8 ).
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Near complete, I posted so I will have this approved by the time I will finish. I will post all the code in this thread as a patch later today (This is always a good stage before committing).syedhs wrote:You mean it has been completed?Assaf Raman wrote: I need the other OGRE team members to approve before I will commit this code (to 1.8 ).
Watch out for my OGRE related tweets here.
-
- Minaton
- Posts: 973
- Joined: Fri Dec 28, 2007 4:35 pm
- Location: Germany
- x 1
-
- Goblin
- Posts: 231
- Joined: Thu May 11, 2006 3:07 pm
- Location: Berlin
-
- Goblin
- Posts: 266
- Joined: Thu May 31, 2007 9:45 am
-
- Goblin
- Posts: 231
- Joined: Thu May 11, 2006 3:07 pm
- Location: Berlin
-
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
I guess the Ogre specific material stuff will not be applicable in this area which is fair enough for me. But probably in the future, you can combine cgfx with ogre material but that is for future, I guess 

A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
-
- Goblin
- Posts: 266
- Joined: Thu May 31, 2007 9:45 am
-
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Here is what I have so far, I wrote most of the code of this project, well, most of the hard code at least. I created all the major enums (about 40) and most of the translation tables between strings and enums. The code declares all the needed cg states so the cgfx loads without an error.
What mostly is missing are translation tables between ogre enums \ material states and cgfx state values.
I am posting the code; it has about 4000 new lines of code.
I hope I will have time soon to finish this. Feel free to pick up were I left or post any ideas\remarks.
Here it is: updated CgProgramManager.zip
[EDIT] Best to get the latest code from the SVN.[/EDIT]
What mostly is missing are translation tables between ogre enums \ material states and cgfx state values.
I am posting the code; it has about 4000 new lines of code.
I hope I will have time soon to finish this. Feel free to pick up were I left or post any ideas\remarks.
Here it is: updated CgProgramManager.zip
[EDIT] Best to get the latest code from the SVN.[/EDIT]
Last edited by Assaf Raman on Tue Sep 23, 2008 3:32 pm, edited 1 time in total.
Watch out for my OGRE related tweets here.
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
Cool - conversion support for .fx to .material is something I've wanted for a while just for convenience. Not a core thing, but putting it in the Cg plugin makes sense.
Good move on making it a ScriptLoader so you don't have to link to the plugin.
It's nice to support .fx, the only issue is that .fx doesn't support all the things that .material does, it might be nice to have a way to batch convert .fx instead, should you want to edit the results (without linking to the plugin so you can use the listener). But of course that would break the round-trip if the artist went back to FXComposer etc so it has its downsides.
Ideally I'd like to write a plugin for FXComposer or something sometime, I believe you can expose extra properties there.
Good move on making it a ScriptLoader so you don't have to link to the plugin.
It's nice to support .fx, the only issue is that .fx doesn't support all the things that .material does, it might be nice to have a way to batch convert .fx instead, should you want to edit the results (without linking to the plugin so you can use the listener). But of course that would break the round-trip if the artist went back to FXComposer etc so it has its downsides.
Ideally I'd like to write a plugin for FXComposer or something sometime, I believe you can expose extra properties there.
-
- Goblin
- Posts: 231
- Joined: Thu May 11, 2006 3:07 pm
- Location: Berlin
-
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8