Page 2 of 6

Posted: Sun Sep 21, 2008 8:51 pm
by Brocan
Assaf Raman wrote:This doesn't work yet.
I hope I will post something working soon.
I am almost there in getting some basic samples working.
Waiting then :D

Posted: Mon Sep 22, 2008 2:37 pm
by Assaf Raman
Got the basic to work, here is the glass demo from mental mill Artist Edition:
Image

I just used the exported cgfx file from mental mill Artist Edition without any change to the cgfx file and without creating any new file.

I will post commit really soon.

Posted: Mon Sep 22, 2008 5:55 pm
by Wolfmanfx
Nice work

Posted: Mon Sep 22, 2008 6:47 pm
by Vectrex
oh cool. Didn't know about this

Posted: Mon Sep 22, 2008 7:06 pm
by Brocan
Very very very nice.

My mental mill shaders are waiting :D

Good work :D

Posted: Mon Sep 22, 2008 7:33 pm
by Assaf Raman
If you will post some cgfx shaders and the textures they need - I will be able to test them and make sure they work.

Posted: Mon Sep 22, 2008 7:48 pm
by Brocan
Assaf Raman wrote:If you will post some cgfx shaders and the textures they need - I will be able to test them and make sure they work.
Sorry, but my shaders are very basic, based on the examples. I'm learning mental mill now :(

BTW if I make a good shader be sure that I will post it :D

Posted: Mon Sep 22, 2008 7:51 pm
by Assaf Raman
That is fine. I will check the samples that come with it.

Posted: Tue Sep 23, 2008 8:31 am
by SiENcE
You can try the samples from the NVIDIA Shader Library - CgFX.

Posted: Tue Sep 23, 2008 3:00 pm
by Assaf Raman
I just commited to 1.8 the CgFx script loader as part of the Cg program manager plugin.
This loader loads files with the extension cgfx from the OGRE resource pool and creates ogre material and cg programs as according to what exists in the cgfx file.
The name of the material that is created is similar to the name of the cgfx file - so for a file named "glass.cgfx" it will be "glass.cgfx".
I tested this code with exporting some of the samples that come with "mental mill (R) Artist Edition" (you get it free with FX Composer 2.5).
Most of the hard code is written - the main feature that is missing are:
1. All sort of pass state translations - like alpha blend and such.
2. More standard documentation.
3. Error logging and exception handling.

I really worked hard on this feature; I guess about 7 full days.
I will be really happy if the community will share nice cgfx shaders by posting the shaders and textures (and possibly the relevant source code).

This code is my gift to the community for the Jewish holyday season.

Posted: Tue Sep 23, 2008 3:41 pm
by Brocan
Downloading ;)

Thanks :D

Posted: Tue Sep 23, 2008 4:48 pm
by Praetor
I'm checking it out now. Welcome gift indeed. Can you explain a little bit about item #1? What needs to be done. I might be poking around at it this week.

Posted: Tue Sep 23, 2008 5:12 pm
by Assaf Raman
@Praetor: I created most of what it needed to convert cgfx states to ogre states - there are switch case statements for everything – and also “getValueâ€

Posted: Tue Sep 23, 2008 5:44 pm
by syedhs
This is one of the best gift to community - thanks Assaf. I am downloading 1.7 just to test this out.

Posted: Tue Sep 23, 2008 5:48 pm
by Praetor
Ok, I see what's going on. Lots to fill in. I'm not sure how some of those options will map to materials. But, might as well just get started filling in what can be filled in. I imagine the most common options will be trivial to link up and should give us pretty decent coverage.

Posted: Wed Sep 24, 2008 2:43 pm
by Brocan
I have a question, how are the lights mapped to ogre?

Because i have loaded the examples provided by MentalMill (I have just exported it to cgfx) but the examples that have a light, don't run well in ogre.

I have created a point light and nothing.

Paralax example of mental mill into ogre:

ImageImage


With a simple phong shader:

ImageImage

The phong shader
[EDIT by AssafRaman]I changed the long code quote to a file link - I don't allow such long code pastes in my threads, upload to google pages and give a link to such code[/EDIT]

Note: the ogrehead is where i have the point light

Posted: Wed Sep 24, 2008 2:54 pm
by Praetor
I've been looking at the mappings and implementing a few (without really testing these mappings yet...)

The lights I don't think can be mapped to Ogre in any way. Basically CgFx is stepping into the scene management arena with lights being bound to shaders.

In your parallax example, can you try manually creating an Ogre light in the scene? It's guaranteed that some options and settings in CgFx simply won't have natural mappings into Ogre.

Posted: Wed Sep 24, 2008 2:56 pm
by Assaf Raman
I know about this issue, I didn't have time to look at it yet.

Posted: Wed Sep 24, 2008 2:58 pm
by Brocan
Praetor wrote:The lights I don't think can be mapped to Ogre in any way. Basically CgFx is stepping into the scene management arena with lights being bound to shaders.
Yeah, i'm sure of that.

In my photos i have a ogre light point created where the ogrehead is. :wink:

Edit: Ah, ok Assaf, i thought that was a problem in my computer :D
Edit2: I don't remember googlepages :oops: to upload the code, sorry :D

Posted: Thu Sep 25, 2008 1:47 pm
by Assaf Raman
Here is the model I am using for testing (if anyone needs this kind of test mesh...)
Image

Posted: Thu Sep 25, 2008 4:41 pm
by SunSailor
Btw., the last commit regarding this feature broke compilation under linux:

Code: Select all

../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1472: error: expected ‘,’ or ‘...’ before ‘ogreProgramType’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1472: error: ISO C++ forbids declaration of ‘GpuProgramType’ with no type
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1473: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1474: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1477: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1478: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1479: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1480: error: ‘GpuProgramParameters’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1480: error: expected ‘,’ or ‘...’ before ‘&’ token
OgreCgFxScriptLoader.cpp:2784: error: prototype for ‘void Ogre::CgFxScriptLoader::parseCgProgram(_CGpass*, Ogre::Pass*, Ogre::GpuProgramType)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1472: error: candidate is: void Ogre::CgFxScriptLoader::parseCgProgram(_CGpass*, Ogre::Pass*, int)
OgreCgFxScriptLoader.cpp:2881: error: prototype for ‘void Ogre::CgFxScriptLoader::parseCgProgramParameters(_CGpass*, Ogre::GpuProgramParametersSharedPtr)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1473: error: candidate is: void Ogre::CgFxScriptLoader::parseCgProgramParameters(_CGpass*, int)
OgreCgFxScriptLoader.cpp:2927: error: prototype for ‘void Ogre::CgFxScriptLoader::parseCgProgramParameter(_CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1474: error: candidate is: void Ogre::CgFxScriptLoader::parseCgProgramParameter(_CGparameter*, int, const Ogre::String&)
OgreCgFxScriptLoader.cpp:3360: error: prototype for ‘const bool Ogre::CgFxScriptLoader::cgSemanticToOgreAutoConstantType(const char*, Ogre::GpuProgramParameters::AutoConstantType&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1480: error: candidate is: const bool Ogre::CgFxScriptLoader::cgSemanticToOgreAutoConstantType(const char*, int)
OgreCgFxScriptLoader.cpp:3576: error: prototype for ‘bool Ogre::CgFxScriptLoader::parseAutoConstantParam(_CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1479: error: candidate is: bool Ogre::CgFxScriptLoader::parseAutoConstantParam(_CGparameter*, int, const Ogre::String&)
OgreCgFxScriptLoader.cpp:3601: error: prototype for ‘void Ogre::CgFxScriptLoader::parseFloatCgProgramParameter(CGtype, _CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1477: error: candidate is: void Ogre::CgFxScriptLoader::parseFloatCgProgramParameter(CGtype, _CGparameter*, int, const Ogre::String&)
OgreCgFxScriptLoader.cpp:3677: error: prototype for ‘void Ogre::CgFxScriptLoader::parseIntCgProgramParameter(CGtype, _CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1478: error: candidate is: void Ogre::CgFxScriptLoader::parseIntCgProgramParameter(CGtype, _CGparameter*, int, const Ogre::String&)
Maybe someone can fix this, as I don't feel very home in that region of OGRE ;).

Posted: Thu Sep 25, 2008 5:33 pm
by Assaf Raman
How can I compile and get this type of errors on windows?

Posted: Thu Sep 25, 2008 6:00 pm
by captnoord
maybe cygwin?

Posted: Thu Sep 25, 2008 10:34 pm
by sparkprime
Last time I tried to compile ogre under cygwin g++, the linker segfaulted. After some manual hackery, I got it to link but there were subtle bugs that I was tied up with for days before realising it was the compiler's fault. I definitely don't recommend using cygwin's g++ for serious dev work.

Posted: Fri Sep 26, 2008 9:00 am
by SunSailor
Assaf Raman wrote:How can I compile and get this type of errors on windows?
I can't tell you, as I'm currently compiling the HEAD under linux only, maxbe the error doesn't even occure under windows. My recommendation would be to set up a VM with OpenSuSE (The distribution I'm enforced to use on the computer I compiled it on) and try it there. That's the most easy way to reproduce it I can think of (beside the download, but I guess, you're well connected).