POV-Ray : Newsgroups : povray.newusers : 'contour lines' Server Time
23 Nov 2024 12:23:44 EST (-0500)
  'contour lines' (Message 1 to 5 of 5)  
From: Tops
Subject: 'contour lines'
Date: 10 Jan 2014 22:25:01
Message: <web.52d0b932f649b333171348a80@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?



union {

union {

#local Nr = 0;     // start
 #local EndNr = 5; // end
 #while (Nr< EndNr)


box {<4.5,0,-0.9> < 4.4,0.01, 0.7>
 translate   x*Nr*-0.4

}


#local Nr = Nr + 1;    // next Nr
 #end // ---------------  end of loop


#local Nr = 0;     // start
 #local EndNr = 5; // end
 #while (Nr< EndNr)


box {<4.3,0,-0.7> < 4.2,0.01, 0.9>
 translate   x*Nr*-0.4
}


#local Nr = Nr + 1;    // next Nr
 #end // ---------------  end of loop


 box {<2.8, 0,-0.9> < 5,0.01, -0.8>


}




 box {<2.6, 0,0.8> < 5,0.01, 0.9>

}



#local Nr = 0;     // start
 #local EndNr = 5; // end
 #while (Nr< EndNr)


box {<-4.5,0,-0.9> < -4.4,0.01, 0.7>

 translate   x*Nr*0.4
}


#local Nr = Nr + 1;    // next Nr
 #end // ---------------  end of loop


#local Nr = 0;     // start
 #local EndNr = 5; // end
 #while (Nr< EndNr)

box {<-4.3,0,-0.7> < -4.2,0.01, 0.9>

 translate   x*Nr*0.4

}


#local Nr = Nr + 1;    // next Nr
 #end // ---------------  end of loop

 box {<-2.8, 0,-0.9> < -5,0.01, -0.8>
}
 box {<-2.6, 0,0.8> < -5,0.01, 0.9>
}

 texture { T_Silver_4C finish { ambient 0.15 diffuse 0.85 phong 0.5 reflection
0.05} } // pigment {Black}

}








union {


 box {<4.7, 0, -1.1> <5, 0.01, -0.5>}
 box {<4.7, 0, 0.5> <5, 0.01, 1.1>}
box {<-4.7, 0, -1.1> <-5, 0.01, -0.5>}
  box {<-4.7, 0, 0.5> <-5, 0.01, 1.1>}
 texture { T_Silver_4C finish { ambient 0.15 diffuse 0.85 phong 0.5 reflection
0.05} }
}

translate y*-0.25
}


difference {


union {


#local Nr = 0;     // start
 #local EndNr = 9; // end
 #while (Nr< EndNr)



torus {
    4+Nr, 0.25              // major and minor radius

  }





#local Nr = Nr + 1;    // next Nr
 #end // ---------------  end of loop


   scale y*1.0
    translate <8,-0,0>

    }



     box {<5, -1, -5> <20, 5,5>  }



 box {<-20, -5, -40> <-5, 5, 15> }

 box {<-20, -5, -40> <50, 10, -2>}

 box {<-20, -5, 2> <60, 5, 15>}

 box {<-5,-1.5,-2> <5,0,2>}



pigment {Col_Glass_General}


difference {


box {<-5.1,-1.9,-2.1> <5.1,0,2.1>


pigment {Col_Glass_General}

}



 //------------bottom ripples---------------------


union {


#local Nr = 0;     // start
 #local EndNr = 9; // end
 #while (Nr< EndNr)


torus {
    4.5+Nr, 0.25              // major and minor radius

  }



#local Nr = Nr + 1;    // next Nr
 #end // ---------------  end of loop







    scale y*1.0
    translate <8,-0,0>

    }

     box {<5, -20, -5> <20, 5,5>  }

 box {<-20, -5, -40> <-5, 5, 15> }

 box {<-20, -5, -40> <50, 10, -2>}

 box {<-20, -5, 2> <60, 5, 15>}
pigment {Col_Glass_General}
 }


Post a reply to this message

From: MichaelJF
Subject: Re: 'contour lines'
Date: 11 Jan 2014 13:20:01
Message: <web.52d18a82cebc0e7cdf648c9e0@news.povray.org>
"Tops" <nomail@nomail> wrote:
> 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?

In fact I have no idea what you have in your mind. After adding a missing brace
I found three objects (see image at p.b.i.(=povray.binary.images)
http://news.povray.org/povray.binaries.images/thread/%3Cweb.52d185b2525976c8df648c9e0%40news.povray.org%3E/
 - I have changed your textures to see the shapes better). Most likely the red
and the blue should be united. Will you have a grid-like texture layered above
your silver and glass?

I assume your electrodes are the yellow object. What do you mean with undulating
it?

BTW: It would be more convenient to have a complete scene (with cam and lights
and so on) to judge and not only a fragment.

BTW2: I just played with Kurtz le pirates lighting issues here
(http://news.povray.org/povray.binaries.images/message/%3Ckurtzlepirate-AF1476.17102311012014%40news.povray.org%3E/#%3C
kurtzlepirate-AF1476.17102311012014%40news.povray.org%3E).

Best regards,
Michael


Post a reply to this message

From: William F Pokorny
Subject: Re: 'contour lines'
Date: 11 Jan 2014 14:54:23
Message: <52d1a16f$1@news.povray.org>
On 01/10/2014 10:23 PM, Tops wrote:
>
> 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.
>
>...
>
> Ps. Is it also possible to do #1 for a height_field?
>
Like Michael, not complete sure what you are after, but here is some 
code to project an X/Y grid onto an isosurface "undulating" in Z. You 
could get to a heightfield like isosurface by using an image pigment in 
place of the built in f_ripples() function below.
Bill P.

//---- Example ----
  global_settings {
     assumed_gamma 1.0
     ambient_light srgb <1.0,1.0,1.0>
}
#declare Grey85 = srgbft <0.85,0.85,0.85,0.0,0.0>;
background { color Grey85 }
#declare Camera00 = camera {
     perspective
     location <1.4,1.4,-3.001>
     sky <0.0,1.0,0.0>
     angle 35.0
     right x*(image_width/image_height)
     look_at <0.0,0.0,0.0>
}
#declare White = srgbft <1.0,1.0,1.0,0.0,0.0>;
#declare Light00 = light_source { <50.0,50.0,-30.0>, White }
#declare Red = srgbft <1.0,0.0,0.0,0.0,0.0>;
#declare CylinderX = cylinder {
     <-1.1,0.0,0.0>, <1.1,0.0,0.0>, 0.01
     pigment { color Red }
}
#declare Green = srgbft <0.0,1.0,0.0,0.0,0.0>;
#declare CylinderY = cylinder {
     <0.0,-1.1,0.0>, <0.0,1.1,0.0>, 0.01
     pigment { color Green }
}
#declare Blue = srgbft <0.0,0.0,1.0,0.0,0.0>;
#declare CylinderZ = cylinder {
     <0.0,0.0,-1.1>, <0.0,0.0,1.1>, 0.01
     pigment { color Blue }
}
#include "functions.inc"
#declare Fnct00 = function (x,y,z) {
       z-(f_ripples(x*5.0,z*5.0,y*5.0)*0.1)
}
#declare Fnct00_inv = function (x,y,z) {
     -(z-(f_ripples(x*5.0,z*5.0,y*5.0)*0.1))
}
#declare Fnct01 = function (x,y,z) {
     max((Fnct00(x,y,z)-0.01),(Fnct00_inv(x,y,z)-0.01))
}#declare Iso00 = isosurface {
     function { Fnct01(x,y,z) }
     contained_by { box { <-0.98,-0.98,-0.2>,<0.98,0.98,0.2> } }
     threshold 0.0
     accuracy 0.0005
     max_gradient 1.8
     max_trace 1
}
#declare GridMult = 10.0;
#declare Fpig00 = function (x,y,z) { f_gradientX(x,y,z) }
#declare Fpig01 = function (x,y,z) { f_gradientY(x,y,z) }
#declare Fpig03 = function (x,y,z) { min(Fpig00(x,y,z),Fpig01(x,y,z)) }
#declare Fpig04 = function (x,y,z) { Fpig03(x*GridMult,y*GridMult,z) }
#declare Black = srgbft <0.0,0.0,0.0,0.0,0.0>;
#declare Grey55 = srgbft <0.55,0.55,0.55,0.0,0.0>;
#declare ColorMap00 = color_map {
     [ 0.000 Black ]
     [ 0.050 Black ]
     [ 0.051 Grey55 ]
     [ 1.000 Grey55 ]
}
#declare Pigm00 = pigment {
     function  { Fpig04(x,y,z) }
     color_map { ColorMap00 }
}
#declare Texture00 = texture { pigment { Pigm00 } }
#declare Obj00 = object {
     object { Iso00 }
     texture { Texture00 }
}
//---------------------------
camera { Camera00 }
light_source { Light00 }
object { CylinderX }
object { CylinderY }
object { CylinderZ }
object { Obj00 }
//----------------------


Post a reply to this message

From: Alain
Subject: Re: 'contour lines'
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

From: Tops
Subject: Re: 'contour lines'
Date: 26 Jan 2014 14:45:01
Message: <web.52e565a4cebc0e7c7f7da30c0@news.povray.org>
Thanks all

Sorry for the late reply, but I've been away.

Much appreciate all of your help here.

Many thanks again

Tops


Post a reply to this message

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