Graphics Reference
In-Depth Information
Norm[0] = vNormal[0];
Norm[1] = vNormal[1];
Norm[2] = vNormal[2];
if( dot( Norm[0], Norm[1] ) < 0. )
Norm[1] = -Norm[1];
if( dot( Norm[0], Norm[2] ) < 0. )
Norm[2] = -Norm[2];
N0 = normalize( Norm[0] );
N01 = normalize( Norm[1] - Norm[0] );
N02 = normalize( Norm[2] - Norm[0] );
int numLayers = 1 << uDetail;
float dt = 1. / float( numLayers );
float t = 1.;
for( int it = 0; it <= numLayers; it++ )
{
float smax = 1. - t;
int nums = it + 1;
float ds = smax / float( nums - 1 );
float s = 0.;
for( int is = 0; is < nums; is++ )
{
ProduceVertices( s, t );
s += ds;
}
t -= dt;
}
}
In Figure 15.38 we see the hedgehog shader applied to the cow dataset,
which has normals at each vertex. You can see that indeed, when the spikes
are short, they do give insight into the shape variations (for example, look at
the cow's nose). Note also that each vertex has multiple spikes, corresponding
to different triangles in the modeling. However, you can also see that when
the normals are too long, the image turns from something insightful into a
frightening Chia Pet.
Search WWH ::




Custom Search