2
\$\begingroup\$

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

      }
   }
}
\$\endgroup\$
6
  • 1
    \$\begingroup\$ have you tried using a custom material, similar to the base one, but with your own vertex and pixel shaders? \$\endgroup\$
    – teodron
    Commented Aug 27, 2013 at 8:14
  • 1
    \$\begingroup\$ Like this ogre3d.org/forums/viewtopic.php?f=2&t=35383&start=0 \$\endgroup\$
    – teodron
    Commented Aug 27, 2013 at 8:15
  • \$\begingroup\$ 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 } } } \$\endgroup\$
    – UberLambda
    Commented Aug 27, 2013 at 8:40
  • 1
    \$\begingroup\$ 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 :). \$\endgroup\$
    – teodron
    Commented Aug 27, 2013 at 8:53
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – user1430
    Commented Jan 4, 2014 at 18:30

1 Answer 1

1
\$\begingroup\$

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

      }
   }
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .