vertex colours again

Problems building or running the engine, queries about how to use features etc.
Post Reply
jelle
Halfling
Posts: 80
Joined: Wed Feb 23, 2005 12:42 pm

vertex colours again

Post 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!
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post 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.
User avatar
CombatWombat
Greenskin
Posts: 138
Joined: Fri Feb 04, 2005 11:05 pm
Location: Melbourne, Aus

Post by CombatWombat »

Jelle, you might find this Wiki entry helpful:

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

Cheers,

Mark/CW
jelle
Halfling
Posts: 80
Joined: Wed Feb 23, 2005 12:42 pm

Post by jelle »

thx you guys, ill look in to it
Post Reply