|
setting grass normals for recieving more uniform lighting
#433029
11/21/13 15:26
11/21/13 15:26
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
OP
Expert
|
OP
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
a little tip: setting vertex normals to point upwards makes lighting of grass models more uniform, and look much better when the camera moves around (I added this quick feature to MapBuilder a few minutes ago)
void Grass_SetNormals(ENTITY* ent)
{
int i;
for (i=1; i<=(var)(ent_status(ent, 0)); i++)
{
CONTACT* c = ent_getvertex(ent, NULL, i); // vertex number begins with 1 !
c.v.nx = (float)0;
c.v.nz = (float)0;
c.v.ny = (float)1; // upwards - uniform lighting
ent_setvertex(ent, c, i);
}
}
another tip: for tree leaves I use an modified central normalization. more exactly, normals got by lerping 2 values: the vector pointing out from entity middle to the actual vertex, and its original normal vector.
|
|
|
Re: setting grass normals for recieving more uniform lighting
[Re: sivan]
#433686
12/04/13 13:54
12/04/13 13:54
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
another tip: for tree leaves I use an modified central normalization. more exactly, normals got by lerping 2 values: the vector pointing out from entity middle to the actual vertex, and its original normal vector. I'm very bad with graphical stuff but your trees look awesome! Could you explain more in-depth what the above means?
|
|
|
|