|
![](/i/fill.gif) |
"New2Povray" <nomail@nomail> wrote in message
news:web.48f4e301fc37f40429569840@news.povray.org...
> Hi all
>
> I am new to povray and have been trying to render a surface without much
> success,
Hi and Welcome.
> the surface could not be mathematically represented (will at least not
> in one piece) as a function,
I'll take your word for it :o)
The example pasted in below my signature illustrates one approach that you
could quite easily use. I transformed your data into POV-Ray arrays, then
used those arrays to build a POV-Ray mesh2 object. Transforming your data in
this way is quite simple using an editor that supports columnar editing,
such as the POV-Ray Windows editor. ie. to insert the commas you can click
in the gap between two numbers in the top line, ctrl-shift-click in the
corresponding position on the bottom line and type a comma. (repeat 7 times,
once for each gap).
This example isn't smoothed and smoothing would require an extra chunk of
code to calculate the mesh normals.
Alternatively you may wish to take a look at Mike Williams' excellent
isosurface tutorial which provides a number of ways of combining functions
(see http://www.econym.demon.co.uk/isotut/). You may find that you can
programmatically 'chop' your different functions together.
If your full dataset follows a grid in the way this data does, you might
want to consider writing the z values as a bitmap then using the image as a
height field.
Regards,
Chris B.
// Example...
camera {location <0,0,-5> look_at 0}
light_source {<-10,20,-50>, rgb 1}
#declare GridSize = 7;
#declare PointCount = pow(GridSize,2);
#declare NumberOfFaces = 2*pow(GridSize-1,2);
#declare XCoord = array[PointCount] {
-1.5000 , -1.0000 , -0.5000 , 0 , 0.5000 , 1.0000 , 1.5000 ,
-1.5000 , -1.0000 , -0.5000 , 0 , 0.5000 , 1.0000 , 1.5000 ,
-1.5000 , -1.0000 , -0.5000 , 0 , 0.5000 , 1.0000 , 1.5000 ,
-1.5000 , -1.0000 , -0.5000 , 0 , 0.5000 , 1.0000 , 1.5000 ,
-1.5000 , -1.0000 , -0.5000 , 0 , 0.5000 , 1.0000 , 1.5000 ,
-1.5000 , -1.0000 , -0.5000 , 0 , 0.5000 , 1.0000 , 1.5000 ,
-1.5000 , -1.0000 , -0.5000 , 0 , 0.5000 , 1.0000 , 1.5000 }
#declare YCoord = array[PointCount] {
-1.5000 , -1.5000 , -1.5000 , -1.5000 , -1.5000 , -1.5000 , -1.5000 ,
-1.0000 , -1.0000 , -1.0000 , -1.0000 , -1.0000 , -1.0000 , -1.0000 ,
-0.5000 , -0.5000 , -0.5000 , -0.5000 , -0.5000 , -0.5000 , -0.5000 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0.5000 , 0.5000 , 0.5000 , 0.5000 , 0.5000 , 0.5000 , 0.5000 ,
1.0000 , 1.0000 , 1.0000 , 1.0000 , 1.0000 , 1.0000 , 1.0000 ,
1.5000 , 1.5000 , 1.5000 , 1.5000 , 1.5000 , 1.5000 , 1.5000 }
#declare ZCoord = array[PointCount] {
0.7781 , 0.9975 , 0.6816 , 0 , -0.6816 , -0.9975 , -0.7781 ,
0.9975 , 0.8415 , 0.4794 , 0 , -0.4794 , -0.8415 , -0.9975 ,
0.6816 , 0.4794 , 0.2474 , 0 , -0.2474 , -0.4794 , -0.6816 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 ,
-0.6816 , -0.4794 , -0.2474 , 0 , 0.2474 , 0.4794 , 0.6816 ,
-0.9975 , -0.8415 , -0.4794 , 0 , 0.4794 , 0.8415 , 0.9975 ,
-0.7781 , -0.9975 , -0.6816 , 0 , 0.6816 , 0.9975 , 0.7781 }
mesh2 {
vertex_vectors {
PointCount,
#local I = 0;
#while (I<PointCount)
#if (I!=PointCount-1)
<XCoord[I],YCoord[I],ZCoord[I]>,
#else
<XCoord[I],YCoord[I],ZCoord[I]>
#end
#local I = I + 1;
#end
}
face_indices {
NumberOfFaces
#local I = 0;
#while (I<GridSize-1)
#local J = 0;
#while (J<GridSize-1)
#local K = I*(GridSize)+J;
<K,K+1,K+GridSize>,
#if (K!=NumberOfFaces-1)
<K+1,K+GridSize+1,K+GridSize>,
#else
<K+1,K+GridSize+1,K+GridSize>
#end
#local J = J + 1;
#end
#local I = I + 1;
#end
}
pigment {rgb 1}
}
Post a reply to this message
|
![](/i/fill.gif) |