Original Post
[font="Arial"]Hello![/font]
[font="Arial"]I have a spline with a bunch of points...... I am calculating tangent and normal data for each point / vertex. Right now the tangents seem fine, but I just can't quite get the normal data right.[/font]
[font="Arial"]Check out this picture:[/font]
[font="Arial"]
[/font]
[font="Arial"]Red is geometry, green is tangent data and yellow is normal data. In the above image the tangents and the normal seem fine![/font]
[font="Arial"]But here:[/font]
[font="Arial"]
[/font]
[font="Arial"]the normals should[/font][font="Arial"] be tilted back more so they are perpendicular to the slope, but they are not.[/font]
[font="Arial"]How I am calculating the normals right now is the cross product of the tangent and the geometric line for each vertex.[/font][font="Arial"]In pseudo-code:[/font]
[font="Arial"][source lang="csharp"][/font]
// I have a List of points
// and a List of tangents....
// This is in a for loop...
Vector3 currentLine = points.ElementAt(i + 1) - points.ElementAt(i);
currentLine.Normalize();
Vector3 tangent = tangents.ElementAt(i);
tangent.Normalize();
Vector3 normal = Vector3.Cross(currentLine, tangent);
[/source]
[font="Arial"]Some help would really be appreciated.[/font][font="Arial"]Thanks![/font]
[font="Arial"]I have a spline with a bunch of points...... I am calculating tangent and normal data for each point / vertex. Right now the tangents seem fine, but I just can't quite get the normal data right.[/font]
[font="Arial"]Check out this picture:[/font]
[font="Arial"]
[/font]
[font="Arial"]Red is geometry, green is tangent data and yellow is normal data. In the above image the tangents and the normal seem fine![/font]
[font="Arial"]But here:[/font]
[font="Arial"]
[/font]
[font="Arial"]the normals should[/font][font="Arial"] be tilted back more so they are perpendicular to the slope, but they are not.[/font]
[font="Arial"]How I am calculating the normals right now is the cross product of the tangent and the geometric line for each vertex.[/font][font="Arial"]In pseudo-code:[/font]
[font="Arial"][source lang="csharp"][/font]
// I have a List of points
// and a List of tangents....
// This is in a for loop...
Vector3 currentLine = points.ElementAt(i + 1) - points.ElementAt(i);
currentLine.Normalize();
Vector3 tangent = tangents.ElementAt(i);
tangent.Normalize();
Vector3 normal = Vector3.Cross(currentLine, tangent);
[/source]
[font="Arial"]Some help would really be appreciated.[/font][font="Arial"]Thanks![/font]