<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2716.2200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>hi all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I m trying to simulate bump mapping on a sphere by
changing the normals in a random manner. I actually make a vtkFloatArray with
random numbers and copy that array with the SetNormals to a vtkPointData of the
sphere. <BR>The methode doesnt work. What I m I doing wrong?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>kind regards</FONT></DIV>
<DIV><FONT face=Arial size=2>Stijn </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT size=1>
<P>#------------------------------ <BR># BUMP
MAPPING<BR>#------------------------------ </P>
<P><FONT face=Arial size=2># create the sphere<BR></FONT>vtkSphereSource
bump<BR> bump SetThetaResolution 20<BR> bump
SetPhiResolution 20<BR> bump SetRadius
1.8<BR> bump Update </P>
<P>vtkPolyDataNormals qqq <BR> qqq SetInput [bump GetOutput]
<BR> qqq ComputePointNormalsOn <BR> qqq
Update </P>
<P></P>
<P>vtkPolyData pDatat<BR> set pDatat [bump GetOutput]
<BR> puts [$pDatat GetNumberOfPoints]<BR>
pDatat Update</P>
<P></P>
<P>vtkPointData pData1 <BR> set pData1 [[[qqq GetOutput]
GetPointData] GetNormals] #get the normals data<BR> puts
[$pData1 GetNumberOfTuples ]<BR> pData1 Update</P>
<P>vtkFloatArray floatArrayNormals<BR> vtkMath rand
<BR> floatArrayNormals SetNumberOfComponents 3
<BR> floatArrayNormals SetNumberOfTuples 362 </P>
<P><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><BR>for {set i
0} {$i<362} {incr i} { <BR> floatArrayNormals
InsertNextValue [rand Random 0 1]<BR> # puts
[floatArrayNormals GetValue $i]<BR>} </P>
<P>puts [floatArrayNormals GetNumberOfTuples]<BR><BR> pData1
SetNormals floatArrayNormals <BR> pData1 Update
<BR> pDatat Update<BR> qqq
Update<BR> bump Update<BR><BR>vtkPolyDataMapper
bumpMapper<BR> bumpMapper SetInput [bump
GetOutput] <BR><BR>vtkActor bumpActor<BR> bumpActor
SetMapper bumpMapper<BR> [bumpActor GetProperty] SetColor 0.9
0.1 0.15 <BR> bumpActor SetPosition 2.5 1.6 2.55
<BR> eval [bumpActor GetProperty]
SetInterpolationToGouraud</P></FONT></DIV></BODY></HTML>