<!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.2800.1226" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dear vtk users,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Since this is my first post to this&nbsp; list, I 
would like to thank you for</FONT></DIV>
<DIV><FONT face=Arial size=2>making using vtk so much more 
rewarding.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Here's my question:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I have written a simple derived class from <FONT 
size=2><FONT size=2>vtkPolyDataSource, called <FONT size=2>vtkCSDTerrainSource, 
that creates a set of triangle strips that model a chunk of terrain data. I'm 
using this class to visualize terrain in a large simulation 
environment.</FONT></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>The result is "almost" correct, except for the 
following intermittent problem: When the "edges" of the terrain data are of 
higher elevation than data closer to the center of the terrain patch, the 
internal data is rendered "underneath" the terrain. So, instead of having a 
"valley" in the middle of the terrain, there is a "mountain" under the terrain 
model. The "valley" on the upper face is rendered as flat, with some 
straight-line patterns.</FONT></DIV>
<DIV><FONT face=Arial size=2>On the other hand, an island (where surrounding 
elevations are zero), renders correctly.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Any ideas as to what could be causing this would be 
greatly appreciated. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Please note: I have already tried adding a 
vtkPolyDataNormals layer and/or a <FONT 
size=2>vtkElevationFilter.</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2><FONT size=2>The specific problem 
</FONT></FONT><FONT face=Arial size=2>was not solved by those. </FONT></DIV>
<DIV><FONT face=Arial size=2>Also, I'm aware that one could use a 
vtkImageSource-derived source to render terrain,</FONT></DIV>
<DIV><FONT face=Arial size=2>but I'm concerned with this specific "mystery" in 
the use of a vtkPolyDataSource.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Here is a relevant part of the 
pipeline:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>// Create the terrain source and fill with 
data<BR>m_pMyTerrain = 
vtkMyTerrainSource::New();<BR>m_pMyTerrain-&gt;Update();</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>// Create the terrain 
mapper<BR>m_pTerrainMapper = vtkPolyDataMapper::New();</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>// Link mapper to terrain 
source<BR>m_pTerrainMapper-&gt;SetInput((vtkPolyData 
*)m_pMyTerrain-&gt;GetOutput());</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>// Create the terrain actor<BR>vtkLODActor 
*terrainActor = 
vtkLODActor::New();<BR>terrainActor-&gt;SetNumberOfCloudPoints(25000);<BR>terrainActor-&gt;SetMapper(m_pTerrainMapper);<BR>vtkProperty 
*prop = 
terrainActor-&gt;GetProperty();<BR>prop-&gt;SetRepresentationToSurface();<BR>prop-&gt;SetInterpolationToGouraud();</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR>Here is the triangle-strip creation part in the 
<BR>vtkMyTerrainSource::Execute() method. <BR>Another part has already created a 
vtkPoints array with <BR>(m_nYResolution X m_nXResolution) elements.</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR><FONT face="Courier New">// Create the triangle strips<BR>m_pTerrStrips 
= vtkCellArray::New();<BR>for (int nR = 1; nR &lt; m_nYResolution; 
nR++)<BR>{<BR>&nbsp;m_pTerrStrips-&gt;InsertNextCell(2*m_nXResolution);<BR>&nbsp;for 
(int nC = 0; nC &lt; m_nXResolution; 
nC++)<BR>&nbsp;{<BR>&nbsp;&nbsp;m_pTerrStrips-&gt;InsertCellPoint(nR*m_nXResolution 
+ nC);<BR>&nbsp;&nbsp;m_pTerrStrips-&gt;InsertCellPoint((nR-1)*m_nXResolution + 
nC);<BR>&nbsp;}<BR>&nbsp;UpdateProgress((double)nR/(double)(m_nYResolution-1));<BR>}</FONT></FONT><FONT 
size=2></DIV>
<P><FONT face=Arial>Thanks in advance,</FONT></P>
<P><FONT face=Arial>George.</FONT></P></FONT></BODY></HTML>