Porting to Ogre 2.1 - materials
Posted: Tue Nov 01, 2016 2:56 pm
Hi
I'm porting a couple of applications to Ogre 2.1. They are not games.
I've finally got the simpler one of the two compiling and initializing but having / had major issues with materials.
One issue is that some functions have been dropped from the Material class and it is not clear what replaces them (in fact this is a general pattern I have observed here).
It would be great if the legacy function prototypes could be left in commented out - either in the header files or maybe the cpp files to reduce header bloat. Along with a comment about why it was removed and if there is any replacement...
That way, searching the source code for the missing function would reveal some pointers as to how to deal with its loss. When your main goal is just to get the application to compile before dealing with all the semantic/assertion/exception/visual breakages, this would have been extremely useful and saved me (and probably others) hours.
I think looking at the porting guide I need to use blend blocks to set up scene blending etc and other blocks for culling.
But that is not initially easy to find if you do not have a fuller understanding of Hlms first. I take it that the old materials somehow actually use Hlms under the hood? Why do they only work in V1_LEGACY RenderQueue if they must use macroblocks etc for blending modes? Or is th eporting guide out of date in this area?
The other issue is existing materials that are not under my control. Existing users of the application have imported models (boats / ROVs / Wind Turbines etc) themselves that are persisted on disk and will have legacy style material scripts and mesh files. This results in Ogre throwing an exception when loading as the materials end up being FFP based.
Subsequently it will crash due to Is there any way to get these to either automatically use the new Hlms material system? Looking around I see there is RTSS which I have not used yet. But it is not clear if this can act automatically?
Really not sure how to deal with that.
Is there any reason that old style materials can't be converted to Hlms?
I also see that cg support was dropped? All of my scripts use cg... It is kind of nice only having to write the shader once instead of separate GLSL and HLSL scripts.. But I do see that there is hlsl2glsl which may reduce the pain of this.
Would be lovely if there were an example of how to move a material from old to new.
I also can't find any docs on the syntax of hlms material scripts? Is it possible just to generate them in code?
I'm porting a couple of applications to Ogre 2.1. They are not games.
I've finally got the simpler one of the two compiling and initializing but having / had major issues with materials.
One issue is that some functions have been dropped from the Material class and it is not clear what replaces them (in fact this is a general pattern I have observed here).
It would be great if the legacy function prototypes could be left in commented out - either in the header files or maybe the cpp files to reduce header bloat. Along with a comment about why it was removed and if there is any replacement...
That way, searching the source code for the missing function would reveal some pointers as to how to deal with its loss. When your main goal is just to get the application to compile before dealing with all the semantic/assertion/exception/visual breakages, this would have been extremely useful and saved me (and probably others) hours.
I think looking at the porting guide I need to use blend blocks to set up scene blending etc and other blocks for culling.
But that is not initially easy to find if you do not have a fuller understanding of Hlms first. I take it that the old materials somehow actually use Hlms under the hood? Why do they only work in V1_LEGACY RenderQueue if they must use macroblocks etc for blending modes? Or is th eporting guide out of date in this area?
The other issue is existing materials that are not under my control. Existing users of the application have imported models (boats / ROVs / Wind Turbines etc) themselves that are persisted on disk and will have legacy style material scripts and mesh files. This results in Ogre throwing an exception when loading as the materials end up being FFP based.
Subsequently it will crash due to Is there any way to get these to either automatically use the new Hlms material system? Looking around I see there is RTSS which I have not used yet. But it is not clear if this can act automatically?
Really not sure how to deal with that.
Is there any reason that old style materials can't be converted to Hlms?
I also see that cg support was dropped? All of my scripts use cg... It is kind of nice only having to write the shader once instead of separate GLSL and HLSL scripts.. But I do see that there is hlsl2glsl which may reduce the pain of this.
Would be lovely if there were an example of how to move a material from old to new.
I also can't find any docs on the syntax of hlms material scripts? Is it possible just to generate them in code?