Jump to content
  • Advertisement

Archived

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

cmcginnis

Determining the vertex normals of a line strip

This topic is 5716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is a good way to determine the vertex normals for a line strip? Should it just be the direction vector in which each segement of the line strip is heading?

Share this post


Link to post
Share on other sites
Advertisement
why do u need lighting for a line strip ?

if u really do then the vertex normal is the average of the line normals that share the vertex

if v is the vertex, vl is the last one and vn is the next
vNormal = Normalize( Normalize(CrossProd(v - v1), Normalize(CrossProd(vn - v));

(maybe u have to make vNormal = -vNormal if is points in the wrong way )

Share this post


Link to post
Share on other sites
shouldnt it just be:

vNormal = Normalize( CrossProduct( v-vl, vn-v) );

i just didnt quite understand ur notation for the cross product anyway, the question stands: y would u want normals for a line strip?

Share this post


Link to post
Share on other sites
You guys do realize that there are an infinite number of normals for a vertex on a line segment, right?

i.e. a line is a 1-dimensional entity, therefore a normal for that line is ANY vector which is perpendicular to it.

I third the question: why do you need normals for a line strip?

Regards,
Jeff

Share this post


Link to post
Share on other sites
The main reason for asking is so lighting calculcations can be performed in DirectX. The line does get lit when I add ambient light, but I thought it would be better if it included normal information.

Share this post


Link to post
Share on other sites
rypyr is kinda right

but we could look at the lines like in 2D so there would''n be an infinte num of normals

and again why would u nicely light a line strip ?? i dont get it
there isnt much difference between a light and an unlight line is it?

Share this post


Link to post
Share on other sites
In Direct3D a line does not get lit with a material''s color unless it has a vertex normal or the ambient color is set.

Share this post


Link to post
Share on other sites
quote:
Original post by Ilici
but we could look at the lines like in 2D so there would''n be an infinte num of normals



If you did this, then all the normals would point out of the screen, and all would be lit the same. Does this make sense to do?

Regards,
Jeff

Share this post


Link to post
Share on other sites
Couldn''t you just turn lighting off, draw the line using whatever color you want it and then turn lighting back on? I''m not sure if this is what you''re looking for though.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!