Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How do I create a shaded manual object with colours for each vertex? Eg if ogreObj is the Ogre::ManualObject :

ogreObj->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST);

will allow me to select each vertex's colour with ogreObj->colour(r, g, b) after each ogreObj->position(x, y, z) and ogreObj->normal(x, y, z) call.

However, if I change the material to BaseWhite, color() instructions are ignored. I read that you must disable lighting int the .material script, but I need it active... Any advice?

ANSWER: This Ogre forum's thread has a simple .material script that works for this purpose:

material Voxel/Default
{
   technique
   {
      pass
      {
         diffuse vertexcolour
         specular vertexcolour
         ambient vertexcolour
         lighting on

      }
   }
}
share|improve this question
1  
have you tried using a custom material, similar to the base one, but with your own vertex and pixel shaders? –  teodron Aug 27 '13 at 8:14
1  
    
Thank you both! But the thread teodron linked at worked for me. Specifically, I just made a .material script with this content: material Voxel/Default { technique { pass { diffuse vertexcolour specular vertexcolour ambient vertexcolour lighting on } } } –  TM3P Aug 27 '13 at 8:40
1  
Put your update in the question, as an edit. I can't answer it either because I just did that in a comment by supplying a link. There's an "ethical" rule: if you supply a link and not an explanation, you should comment and not answer. When you get the reputation, you'll answer it yourself :). –  teodron Aug 27 '13 at 8:53
1  
You can answer your own question, you just have to wait a while. Please don't "answer" the question by placing the answer text in the question itself. I've reposted your answer as an actual answer; feel free to post your version if you like and I will delete mine. –  Josh Petrie Jan 4 at 18:30

1 Answer 1

As you discovered, a material script can be used for this purpose.

material Voxel/Default
{
   technique
   {
      pass
      {
         diffuse vertexcolour
         specular vertexcolour
         ambient vertexcolour
         lighting on

      }
   }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.