Page 1 of 1

vertex colours again

Posted: Wed Feb 23, 2005 12:49 pm
by jelle
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!

Posted: Wed Feb 23, 2005 12:55 pm
by DWORD
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

Code: Select all

mMaterial->getTechnique(0)->getPass(0)->setVertexColourTracking(TVC_AMBIENT | TVC_DIFFUSE);
Or in a material script you can define

Code: Select all

(...)
    ambient vertexcolour
    diffuse vertexcolour
(...)
Edit: Just to avoid confusion, using this there's no need to disable dynamic lighting; you can have both at the same time.

Posted: Wed Feb 23, 2005 11:49 pm
by CombatWombat
Jelle, you might find this Wiki entry helpful:

http://www.ogre3d.org/wiki/index.php/GeneratingAMesh

Cheers,

Mark/CW

Posted: Sun Feb 27, 2005 4:44 pm
by jelle
thx you guys, ill look in to it