A few months back I briefly looked into using Ogre 1.9 and was pleasantly surprised at the quality and depth of the tutorials and example projects. I was quickly able to get a basic scene up and working, so thanks!
I've begun a new project now using Ogre3D and decided to go straight into using version 2.1 but I've frequently become stuck and after 1.5 days of working on my project I'm still yet to render an object onto the screen (it isn't that bad, I've spent most of my time working on base classes etc.).
I'm stuck at the moment when trying to get a material to render on an object. I have taken the slightly weird route of working from a barebone project with none of the included example media/content etc. so that when I start adding custom assets it is easy to differentiate between what is mine and what came with Ogre.
However, I'm rather stuck getting a material to work on an object and was wondering if someone could give me an absolute idiots guide on how to get a material together and rendered on an object.
For some background context, I am manually building a mesh to use as a simple 3d background for my gameworld as the Terrain system was not working for me in 2.1.
My problems, in chronological order are:
1.
Code: Select all
Ogre::SubMesh* sub = mMesh->createSubMesh();
sub->mVao[Ogre::VpNormal].push_back(vao);
sub->mVao[Ogre::VpShadow].push_back(vao);
Ogre::Item *item = getSceneManager()->createItem(mMesh, Ogre::SCENE_DYNAMIC);
Ogre::SceneNode *sceneNode = getSceneManager()->getRootSceneNode(Ogre::SCENE_DYNAMIC)->createChildSceneNode(Ogre::SCENE_DYNAMIC);
sceneNode->attachObject(item);
Code: Select all
sub->mMaterialName = "Empty";
I then made a basic material as shown below and referenced it's fileSystem in my resources.cfg as to be expected.
Code: Select all
material Empty
{
technique
{
pass
{
ambient 0.8 0.8 0.8
}
}
}
I guess this means the old material types are incompatible, no worries, so I made this (Ensuring that the texture files were also correctly pathed):OGRE EXCEPTION(3:RenderingAPIException): Fixed Function pipeline is no longer allowed nor supported. The material Empty must use shaders in HlmsLowLevel::calculateHashFor at E:\Ogre_3D_2_1\OgreMain\src\OgreHlmsLowLevel.cpp (line 155)
Code: Select all
hlms Empty pbs
{
roughness 1.0
detail_map0 MRAMOR6X6.jpg
detail_offset_scale0 0 0 5 5
roughness_map MRAMOR-bump.jpg
}
Code: Select all
Can't assign material Empty because this Material does not exist. Have you forgotten to define it in a .material script?
I'm just really stuck when it comes to the new material system, please help!
Thanks
PontiusPirate