POV-Ray : Newsgroups : povray.newusers : 'contour lines' : Re: 'contour lines' Server Time
14 May 2024 16:32:54 EDT (-0400)
  Re: 'contour lines'  
From: Alain
Date: 11 Jan 2014 15:58:17
Message: <52d1b069@news.povray.org>

> Hi all
>
> Can anybody help me please?
>
> I have two things that I wish to do to my picture (my very crude code (!) is
> pasted below the message)
>
> 1. I have an undulating surface and I wish to draw a sort of 'wire frame'
> pattern on the top of it so that you can clearly see the contours.
>
> 2. I have drawn some crude electrodes which I also wish to undulate. Is it
> possible to have the shape do this?
>
> Many thanks
>
> Ps. Is it also possible to do #1 for a height_field?
>
>
>

For the undulating surface, you can use a gradient pattern. Scale it to 
the hight of your surface. Next, use the frequency modifier to set the 
number of lines to show. Something like (for a surface extending 2 units 
along the Y axis):

pigment{gradient y
	color_map{[0.01 rgb 0][0.01 rgbt 1]}
	scale 2*y
	frequency 10}

This pattern is destined to be layered over some base texture.
You can have another, or two, along some other direction.


As for the crude electrodes, no basic primitives can be made to undulate.
You have two options:
1- Use a mesh representation of your electrodes.
Pro: Render fast. Con: you may need an exterior modeler or use a good 
deal of code to generate the mesh internaly.
2- Use an isosurface and manipulate the x, y, z values.
Pro: You can have LOT of controll, mahe bulges, twists and other 
interesting effects. Short code. Con: Can greatly increase the render time.

This sample use an isosurface to make a cylinder along the x axis that 
may show the effect you are after:

#declare Cylinder = function{sqrt(y*y+z*z)}
// general function for a cylinder along the X axis

isosurface{function{Cylinder(x,y+sin(x+clock)/2,z-cos((x+clock)/2)/2)}
// the sin() and cos() shift the shape around
threshold 1 // Makes the cylinder's radius 1 unit
contained_by{box{<-20,1.5,1.5><20,-1.5,-1.5>}
// Just whide enough to contain the undulations and 40 units long
max_gradient 2
pigment{rgb<1,0.4,0.1>}
}

The addition of "+clock" allow the undulations to travel along if you 
rander this in an animation. This is not needed and default to zero if 
the render is not an animation.


Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.