hi, im writing a terrain algorithm, and now im trying to assing a color to the vertices according to their relative height.
i've put the VES_DIFFUSE information in my vertexbuffers.
the vertexcolours didnt get activated however.
so i began searching the forums for this issue.
i've found that you need to disable lighting for your material.
i do this with
mMaterial->setLightingEnabled(false);
and then i use eg. phong shading.
mMaterial->setShadingMode(SO_PHONG);
now the vertexcolours get activated, but the mesh isnt shaded.
(it's one big blob of the same colour)
is there anyway to make this work?
(is it because i disabled the lighting in my code, and not in a material script?)
help greatly appreciated.
Jelle
thx!
vertex colours again
- DWORD
- OGRE Retired Moderator

- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
- Contact:
If you are using 1.0.0, where vertex colours has been fixed, you can modify your material to use them for diffsue, ambient etc. Use
Or in a material script you can define
Edit: Just to avoid confusion, using this there's no need to disable dynamic lighting; you can have both at the same time.
Code: Select all
mMaterial->getTechnique(0)->getPass(0)->setVertexColourTracking(TVC_AMBIENT | TVC_DIFFUSE);Code: Select all
(...)
ambient vertexcolour
diffuse vertexcolour
(...)- CombatWombat
- Greenskin
- Posts: 138
- Joined: Fri Feb 04, 2005 11:05 pm
- Location: Melbourne, Aus
Jelle, you might find this Wiki entry helpful:
http://www.ogre3d.org/wiki/index.php/GeneratingAMesh
Cheers,
Mark/CW
http://www.ogre3d.org/wiki/index.php/GeneratingAMesh
Cheers,
Mark/CW