Archived

This topic is now archived and is closed to further replies.

MIKI_hack

light, light, light

Recommended Posts

Hi, i have a little questions.... 1) In my engine for omnilight illumination i''m usign the following algho : angle = vec_dot(plane normal, light); if (angle>0) vert1.a = vert2.a = vert3.a = 255*angle+AMBIENT; else vert1.a = vert2.a = vert3.a = AMBIENT; ok, it works well (well it''s a bit different) but if i have an object like sphere or cone, this algo doesnt make a very good effect (you see every triangle of the object !!). How can i produce a right interpolation of vertex alpha value? I have an idea but i have to use the center of the object and its ray (if the object is a cone). 2) have anybody a any tricks about lightmaps? i dont know how can i produce a good lightmap, shadowmap alghoritm? Please help me !!!!!!!!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Just a couple of comments.

First of all you''re using the plane normal to generate vertex lighting. This will cause discontinuities in the lighting like you''ve seen. It''s better to generate vertex normals (by averaging all of the plane normals for polygons that use a vertex) and to use that.

Also you may need to duplicate a vertex when it is shared by more than one triangle if the angle between the 2 tris is greater than, say, 90 degrees. Otherwise you''ll get lighting rapping around sharp edges in the model (think about what would happen if you were lighting a cube).

Hope this helps.

Share this post


Link to post
Share on other sites