|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello,
I have a problem by Povray, I am very new by Povray area
Maybe you can help me, It will be very nice.
My problem is as following,
I established a vehicle, which I would like on 8 form platform once racing in
Povray.
I used for it, the Spline_Trans macro from See Johansen.
My problem is, the vehicle does not tracking the path
That I already defined
The following is mine povray code
Could you tell me please where did I made mistake?
-----
#include "colors.inc" // Defintion der Farben
#include "math.inc"
#include "transforms.inc"
background {color rgb <1,1,1>}
camera
{
location < 0, 8, -20.0>
look_at <0, -0.8, 0>
angle 12
}
light_source { < -30, 30, 0 > color White }
//definition der Bahn
cylinder {
<0,-1.1,0>, <0,-1,0>, 2.1
texture { pigment { color Grey } }
}
cylinder
{
<0,-1.3,0>, <0,-1,0>, 0.77
texture { pigment { color Green }
}
}
cylinder {
<0,-1.1,2.6>, <0,-1,2.6>, 2.1
texture { pigment { color Grey } }
}
cylinder
{
<0,-1.3,2.6>, <0,-1,2.6>, 0.77
texture { pigment { color Green }
}
}
#declare FahrzeugKoerper=
box{<-0.3, -0.95, 1.0>, <0.2, -0.88, 1.3> texture { pigment {color rgb <2,
0, 0>}}} ;
#declare reifen=
union
{
torus{0.05,0.018
texture{pigment {color rgb <5, 5, 5>}}} // rim - Felge
torus{0.06,0.02
texture{pigment {color rgb <0, 0, 0>}}} // tire - Reifen
} ;
#declare Fahrzeug=
union
{
object {FahrzeugKoerper}
object {reifen translate <0.10, 0.985, 0.925> rotate<90,0,0>} //Vorne Rechts
object {reifen translate <-0.20, 0.985, 0.925> rotate<90,0,0>} //Hinten Rechts
object {reifen translate <0.10, 1.315, 0.925> rotate<90,0,0>} //Vorne Links
object {reifen translate <-0.20, 1.315, 0.925> rotate<90,0,0>} //Hinten Rechts
}
#declare MySpline =
spline {
cubic_spline
-1, <0, 0, 0>, // control point
0.00, <0.00,0.00,2.60>
1.00, <0.45,0.00,2.50>
2.00, <0.90,0.00,2.00>
3.00, <1.30,0.00,1.30>
4.00, <0.90,0.00,0.70>
5.00, <0.45,0.00,0.30>
6.00, <0.00,0.00,0.00>
7.00, <-0.45,0.00,-0.30>
8.00, <-0.90,0.00,-0.70>
9.00, <-1.30,0.00,-1.30>
10.00, <-0.90,0.00,-2.00>
11.00, <-0.45,0.00,-2.50>
12.00, <0.00,0.00,-2.60>
13.00, <0.45,0.00,-2.50>
14.00, <0.90,0.00,-2.00>
15.00, <1.30,0.00,-1.30>
16.00, <0.90,0.00,-0.70>
17.00, <0.45,0.00,-0.30>
18.00, <0.00,0.00,0.00>
19.00, <-0.45,0.00,0.30>
20.00, <-0.90,0.00,0.70>
21.00, <-1.30,0.00,1.30>
22.00, <-0.90,0.00,2.00>
23.00, <-0.45,0.00,2.50>
24.00, <0.00,0.00,2.60>
25.00, <0.00,0.00,2.60>
}
object { Fahrzeug Spline_Trans (MySpline, clock*25, <0,1,0>, 0.1, 0.00001) }
-------------------
My ini file is;
Antialias=On
Antialias_Threshold=0.2
Antialias_Depth=3
Input_File_Name=backup.pov
Initial_Frame=1
Final_Frame=25
Initial_Clock=0
Final_Clock=1
Pause_when_Done=off
Cyclic_Animation=off
Thanks a lot in advance
regards
Yetkin
(Sorry for my English)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 26.08.2011 17:28, schrieb yet### [at] gmailcom:
> Could you tell me please where did I made mistake?
The Spline_Trans macro only works properly when the respective object is
constructed with its "center" at the coordinate origin (x=0,z=0). Your
car is slightly off-center in the X direction, and seriously off-center
in the Z direction.
In addition, note that Spline_Trans expects the object's "front" to face
in the Z direction, whereas your car faces in the X direction.
> (Sorry for my English)
Aus deinem POVRay-Code entnehme ich dass dir Deutsch wesentlich besser
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hello,
>
> I have a problem by Povray, I am very new by Povray area
> Maybe you can help me, It will be very nice.
>
> My problem is as following,
>
> I established a vehicle, which I would like on 8 form platform once racing in
> Povray.
> I used for it, the Spline_Trans macro from See Johansen.
>
> My problem is, the vehicle does not tracking the path
> That I already defined
>
>
> The following is mine povray code
> Could you tell me please where did I made mistake?
> -----
> #include "colors.inc" // Defintion der Farben
> #include "math.inc"
> #include "transforms.inc"
> background {color rgb<1,1,1>}
>
>
>
> camera
> {
> location< 0, 8, -20.0>
> look_at<0, -0.8, 0>
> angle 12
> }
>
> light_source {< -30, 30, 0> color White }
>
>
> //definition der Bahn
> cylinder {
> <0,-1.1,0>,<0,-1,0>, 2.1
> texture { pigment { color Grey } }
> }
>
>
> cylinder
> {
> <0,-1.3,0>,<0,-1,0>, 0.77
> texture { pigment { color Green }
> }
> }
>
>
> cylinder {
> <0,-1.1,2.6>,<0,-1,2.6>, 2.1
> texture { pigment { color Grey } }
> }
>
> cylinder
> {
> <0,-1.3,2.6>,<0,-1,2.6>, 0.77
> texture { pigment { color Green }
> }
> }
>
>
> #declare FahrzeugKoerper=
>
> box{<-0.3, -0.95, 1.0>,<0.2, -0.88, 1.3> texture { pigment {color rgb<2,
> 0, 0>}}} ;
>
>
> #declare reifen=
> union
>
> {
>
> torus{0.05,0.018
> texture{pigment {color rgb<5, 5, 5>}}} // rim - Felge
>
> torus{0.06,0.02
> texture{pigment {color rgb<0, 0, 0>}}} // tire - Reifen
> } ;
>
>
>
> #declare Fahrzeug=
>
> union
> {
>
> object {FahrzeugKoerper}
>
>
> object {reifen translate<0.10, 0.985, 0.925> rotate<90,0,0>} //Vorne Rechts
>
>
> object {reifen translate<-0.20, 0.985, 0.925> rotate<90,0,0>} //Hinten Rechts
>
>
> object {reifen translate<0.10, 1.315, 0.925> rotate<90,0,0>} //Vorne Links
>
>
> object {reifen translate<-0.20, 1.315, 0.925> rotate<90,0,0>} //Hinten Rechts
>
> }
>
> #declare MySpline =
> spline {
>
> cubic_spline
>
> -1,<0, 0, 0>, // control point
> 0.00,<0.00,0.00,2.60>
> 1.00,<0.45,0.00,2.50>
> 2.00,<0.90,0.00,2.00>
> 3.00,<1.30,0.00,1.30>
> 4.00,<0.90,0.00,0.70>
> 5.00,<0.45,0.00,0.30>
> 6.00,<0.00,0.00,0.00>
> 7.00,<-0.45,0.00,-0.30>
> 8.00,<-0.90,0.00,-0.70>
> 9.00,<-1.30,0.00,-1.30>
> 10.00,<-0.90,0.00,-2.00>
> 11.00,<-0.45,0.00,-2.50>
> 12.00,<0.00,0.00,-2.60>
> 13.00,<0.45,0.00,-2.50>
> 14.00,<0.90,0.00,-2.00>
> 15.00,<1.30,0.00,-1.30>
> 16.00,<0.90,0.00,-0.70>
> 17.00,<0.45,0.00,-0.30>
> 18.00,<0.00,0.00,0.00>
> 19.00,<-0.45,0.00,0.30>
> 20.00,<-0.90,0.00,0.70>
> 21.00,<-1.30,0.00,1.30>
> 22.00,<-0.90,0.00,2.00>
> 23.00,<-0.45,0.00,2.50>
> 24.00,<0.00,0.00,2.60>
> 25.00,<0.00,0.00,2.60>
> }
>
> object { Fahrzeug Spline_Trans (MySpline, clock*25,<0,1,0>, 0.1, 0.00001) }
>
> -------------------
> My ini file is;
>
> Antialias=On
> Antialias_Threshold=0.2
> Antialias_Depth=3
>
> Input_File_Name=backup.pov
>
> Initial_Frame=1
> Final_Frame=25
> Initial_Clock=0
> Final_Clock=1
>
> Pause_when_Done=off
> Cyclic_Animation=off
>
>
> Thanks a lot in advance
>
> regards
> Yetkin
>
> (Sorry for my English)
>
>
I added the following to make your spline visible:
#declare Spl_Pos = 0;
union{
#while(Spl_Pos <=25)
sphere{MySpline(Spl_Pos)-1*y, 0.02}
#declare Spl_Pos=Spl_Pos +1/4;
#end
pigment{rgb<1,1,0>}
}
If you do the same thing, you'll clearly see that your spline don't
follow your track at all. It start and end in the center of the top loop
and cross in the center of the botom one.
You need to adjust your spline so that it follow the correct path.
You need to create your "car" at the origin. You can place the center of
the car or the mid point of it's rear axle at <0,0,0>.
The bottom of the wheels should be at elevation zero.
The left side should located at -Right_Side.
Now, it goes from 1 to 1.3 while it MUST go from -0.15 to 0.15.
Spline_Trans assume that your object front points toward +z. As your,s
point toward +x, it looks like it's moving sideway.
Same size, correct orientation, rear center at x=0, z=0:
box{<-0.15, -0.95, 0.6>, <0.15, -0.88, 0>
Change the controll point at -1 to <-0.45,0.00,2.50>
Change the controll point at 25 to <0.45,0.00,2.50>
This will ensure a smooth junction.
It's never advisable to have a controll point at the same location as
the neibouring point.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello,
many many thanks Clipka & Alain for your advices
you just made my day :)
It's work now,
but I have some questions,
1. The control points are for me not clearly,What is the task of control point
in this macro? Why should I define a control point by [-1] and by [25]even if I
have frames from 0 to 24 (25 in my case)?
2.Can I define the spline points with a parameter? I mean for expl. if I want to
declare 50 frames(pictures), it will be take long time to type it for each
frame the declaration of points?
In my case, If I want to get the cars in following time in this position
1-Clock 0, <1,30,0,2.60] Start
2-Clock*1/8 <0,0,1.3>
3-clock*2/8 <-1.3,0,0>
4-clock*3/8 <0,0,-1.3>
5-clock*4/8 <1.3,0,0>
6-clock*5/8 <0,0,1.3>
7-clock*6/8 <-1.3,0,2.6>
8-clock*7/8 <0,0,3.9>
9-clock*8/8 <1.3,0,2.6> End
But 50 frames from clock 0 to clock 1.
How should I declare spline point cleverly, that I avoid to type 50 points?
(I have tried following defination for spline points
clock*50, <1.30*cos(2*pi*clock),0,2.60+1.3*sin(2*pi*clock)>
But it doesn't work, what I expected.
)
Many Thanks in advance for your advices
Yetkin
Alain <aze### [at] qwertyorg> wrote:
> > Hello,
> >
> > I have a problem by Povray, I am very new by Povray area
> > Maybe you can help me, It will be very nice.
> >
> > My problem is as following,
> >
> > I established a vehicle, which I would like on 8 form platform once racing in
> > Povray.
> > I used for it, the Spline_Trans macro from See Johansen.
> >
> > My problem is, the vehicle does not tracking the path
> > That I already defined
> >
> >
> > The following is mine povray code
> > Could you tell me please where did I made mistake?
> > -----
> > #include "colors.inc" // Defintion der Farben
> > #include "math.inc"
> > #include "transforms.inc"
> > background {color rgb<1,1,1>}
> >
> >
> >
> > camera
> > {
> > location< 0, 8, -20.0>
> > look_at<0, -0.8, 0>
> > angle 12
> > }
> >
> > light_source {< -30, 30, 0> color White }
> >
> >
> > //definition der Bahn
> > cylinder {
> > <0,-1.1,0>,<0,-1,0>, 2.1
> > texture { pigment { color Grey } }
> > }
> >
> >
> > cylinder
> > {
> > <0,-1.3,0>,<0,-1,0>, 0.77
> > texture { pigment { color Green }
> > }
> > }
> >
> >
> > cylinder {
> > <0,-1.1,2.6>,<0,-1,2.6>, 2.1
> > texture { pigment { color Grey } }
> > }
> >
> > cylinder
> > {
> > <0,-1.3,2.6>,<0,-1,2.6>, 0.77
> > texture { pigment { color Green }
> > }
> > }
> >
> >
> > #declare FahrzeugKoerper=
> >
> > box{<-0.3, -0.95, 1.0>,<0.2, -0.88, 1.3> texture { pigment {color rgb<2,
> > 0, 0>}}} ;
> >
> >
> > #declare reifen=
> > union
> >
> > {
> >
> > torus{0.05,0.018
> > texture{pigment {color rgb<5, 5, 5>}}} // rim - Felge
> >
> > torus{0.06,0.02
> > texture{pigment {color rgb<0, 0, 0>}}} // tire - Reifen
> > } ;
> >
> >
> >
> > #declare Fahrzeug=
> >
> > union
> > {
> >
> > object {FahrzeugKoerper}
> >
> >
> > object {reifen translate<0.10, 0.985, 0.925> rotate<90,0,0>} //Vorne Rechts
> >
> >
> > object {reifen translate<-0.20, 0.985, 0.925> rotate<90,0,0>} //Hinten Rechts
> >
> >
> > object {reifen translate<0.10, 1.315, 0.925> rotate<90,0,0>} //Vorne Links
> >
> >
> > object {reifen translate<-0.20, 1.315, 0.925> rotate<90,0,0>} //Hinten Rechts
> >
> > }
> >
> > #declare MySpline =
> > spline {
> >
> > cubic_spline
> >
> > -1,<0, 0, 0>, // control point
> > 0.00,<0.00,0.00,2.60>
> > 1.00,<0.45,0.00,2.50>
> > 2.00,<0.90,0.00,2.00>
> > 3.00,<1.30,0.00,1.30>
> > 4.00,<0.90,0.00,0.70>
> > 5.00,<0.45,0.00,0.30>
> > 6.00,<0.00,0.00,0.00>
> > 7.00,<-0.45,0.00,-0.30>
> > 8.00,<-0.90,0.00,-0.70>
> > 9.00,<-1.30,0.00,-1.30>
> > 10.00,<-0.90,0.00,-2.00>
> > 11.00,<-0.45,0.00,-2.50>
> > 12.00,<0.00,0.00,-2.60>
> > 13.00,<0.45,0.00,-2.50>
> > 14.00,<0.90,0.00,-2.00>
> > 15.00,<1.30,0.00,-1.30>
> > 16.00,<0.90,0.00,-0.70>
> > 17.00,<0.45,0.00,-0.30>
> > 18.00,<0.00,0.00,0.00>
> > 19.00,<-0.45,0.00,0.30>
> > 20.00,<-0.90,0.00,0.70>
> > 21.00,<-1.30,0.00,1.30>
> > 22.00,<-0.90,0.00,2.00>
> > 23.00,<-0.45,0.00,2.50>
> > 24.00,<0.00,0.00,2.60>
> > 25.00,<0.00,0.00,2.60>
> > }
> >
> > object { Fahrzeug Spline_Trans (MySpline, clock*25,<0,1,0>, 0.1, 0.00001) }
> >
> > -------------------
> > My ini file is;
> >
> > Antialias=On
> > Antialias_Threshold=0.2
> > Antialias_Depth=3
> >
> > Input_File_Name=backup.pov
> >
> > Initial_Frame=1
> > Final_Frame=25
> > Initial_Clock=0
> > Final_Clock=1
> >
> > Pause_when_Done=off
> > Cyclic_Animation=off
> >
> >
> > Thanks a lot in advance
> >
> > regards
> > Yetkin
> >
> > (Sorry for my English)
> >
> >
> I added the following to make your spline visible:
> #declare Spl_Pos = 0;
> union{
> #while(Spl_Pos <=25)
> sphere{MySpline(Spl_Pos)-1*y, 0.02}
> #declare Spl_Pos=Spl_Pos +1/4;
> #end
> pigment{rgb<1,1,0>}
> }
>
> If you do the same thing, you'll clearly see that your spline don't
> follow your track at all. It start and end in the center of the top loop
> and cross in the center of the botom one.
>
> You need to adjust your spline so that it follow the correct path.
> You need to create your "car" at the origin. You can place the center of
> the car or the mid point of it's rear axle at <0,0,0>.
> The bottom of the wheels should be at elevation zero.
> The left side should located at -Right_Side.
> Now, it goes from 1 to 1.3 while it MUST go from -0.15 to 0.15.
> Spline_Trans assume that your object front points toward +z. As your,s
> point toward +x, it looks like it's moving sideway.
> Same size, correct orientation, rear center at x=0, z=0:
> box{<-0.15, -0.95, 0.6>, <0.15, -0.88, 0>
>
> Change the controll point at -1 to <-0.45,0.00,2.50>
> Change the controll point at 25 to <0.45,0.00,2.50>
> This will ensure a smooth junction.
> It's never advisable to have a controll point at the same location as
> the neibouring point.
>
>
>
> Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
yet### [at] gmailcom wrote:
> (I have tried following defination for spline points
> clock*50, <1.30*cos(2*pi*clock),0,2.60+1.3*sin(2*pi*clock)>
> But it doesn't work, what I expected.
This looks like it should work, but I think you are
confusing the clock value for the current render frame
with the time parameter for defining the entire
spline. You probably want something like
#declare N = 50;
#declare I = 0;
#while (I <= N)
#local T = I/COUNT;
T, <1.30*cos(2*pi*T),0,2.60+1.3*sin(2*pi*T)>
#declare N = N + 1;
#end
(And yes I know #local has no effect here but I still
like to use it to indicate it's local to the block.)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hello,
>
> many many thanks Clipka& Alain for your advices
>
> you just made my day :)
>
> It's work now,
>
> but I have some questions,
>
> 1. The control points are for me not clearly,What is the task of control point
> in this macro? Why should I define a control point by [-1] and by [25]even if I
> have frames from 0 to 24 (25 in my case)?
A control point is a point that is NOT realy part of the spline but
control it's shape at the end points. The point at [-1] control the
shape at point [0] and the one at [25] control the shape at [24]
>
> 2.Can I define the spline points with a parameter? I mean for expl. if I want to
> declare 50 frames(pictures), it will be take long time to type it for each
> frame the declaration of points?
You don't need to define the spline at every points. For example, with
your original cubic_spline, if you read points between any 2 points
you'll get intermediate values. In fact, you could have skipped about 2
thirds of the points and still have roughly the same path. The values
between the explicitely defined points are interpolated along a smooth
curved path.
To see the efective path of your spline, I used a #while loop to place
small spheres with a step value of 0.25 giving me 3 intermediate points
for each defined points. I could have used a step value of 0.01 if I
wanted to and got 99 intermediate locations.
here is the code:
#declare Spl_Pos = 0;
#declare Steps = 1/4;
union{
#while(Spl_Pos < 25)
sphere{MySpline(Spl_Pos)-1*y, 0.02}
#declare Spl_Pos=Spl_Pos + Steps;
#end
pigment{rgb<1,1,0>}
}
>
> In my case, If I want to get the cars in following time in this position
> 1-Clock 0,<1,30,0,2.60] Start
> 2-Clock*1/8<0,0,1.3>
> 3-clock*2/8<-1.3,0,0>
> 4-clock*3/8<0,0,-1.3>
> 5-clock*4/8<1.3,0,0>
> 6-clock*5/8<0,0,1.3>
> 7-clock*6/8<-1.3,0,2.6>
> 8-clock*7/8<0,0,3.9>
> 9-clock*8/8<1.3,0,2.6> End
>
> But 50 frames from clock 0 to clock 1.
> How should I declare spline point cleverly, that I avoid to type 50 points?
No, your original 24 points are more than suficient to the task. You can
keep your code exactly the same and just change the final frame from 25
to 50, or whatever value like 100 or 10000, without any problem.
>
>
> (I have tried following defination for spline points
> clock*50,<1.30*cos(2*pi*clock),0,2.60+1.3*sin(2*pi*clock)>
> But it doesn't work, what I expected.
> )
During a given frame, clock always have a single value. That value will
change for the next frame and cause the shape to change.
>
> Many Thanks in advance for your advices
> Yetkin
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 8/28/2011 2:33 PM, Alain wrote:
>> Hello,
>>
>> many many thanks Clipka& Alain for your advices
>>
>> you just made my day :)
>>
>> It's work now,
>>
>> but I have some questions,
>>
>> 1. The control points are for me not clearly,What is the task of
>> control point
>> in this macro? Why should I define a control point by [-1] and by
>> [25]even if I
>> have frames from 0 to 24 (25 in my case)?
>
> A control point is a point that is NOT realy part of the spline but
> control it's shape at the end points. The point at [-1] control the
> shape at point [0] and the one at [25] control the shape at [24]
>
>>
>> 2.Can I define the spline points with a parameter? I mean for expl. if
>> I want to
>> declare 50 frames(pictures), it will be take long time to type it for
>> each
>> frame the declaration of points?
>
> You don't need to define the spline at every points. For example, with
> your original cubic_spline, if you read points between any 2 points
> you'll get intermediate values. In fact, you could have skipped about 2
> thirds of the points and still have roughly the same path. The values
> between the explicitely defined points are interpolated along a smooth
> curved path.
>
> To see the efective path of your spline, I used a #while loop to place
> small spheres with a step value of 0.25 giving me 3 intermediate points
> for each defined points. I could have used a step value of 0.01 if I
> wanted to and got 99 intermediate locations.
>
> here is the code:
> #declare Spl_Pos = 0;
> #declare Steps = 1/4;
> union{
> #while(Spl_Pos < 25)
> sphere{MySpline(Spl_Pos)-1*y, 0.02}
> #declare Spl_Pos=Spl_Pos + Steps;
> #end
> pigment{rgb<1,1,0>}
> }
>
>
>>
>> In my case, If I want to get the cars in following time in this position
>> 1-Clock 0,<1,30,0,2.60] Start
>> 2-Clock*1/8<0,0,1.3>
>> 3-clock*2/8<-1.3,0,0>
>> 4-clock*3/8<0,0,-1.3>
>> 5-clock*4/8<1.3,0,0>
>> 6-clock*5/8<0,0,1.3>
>> 7-clock*6/8<-1.3,0,2.6>
>> 8-clock*7/8<0,0,3.9>
>> 9-clock*8/8<1.3,0,2.6> End
>>
>> But 50 frames from clock 0 to clock 1.
>> How should I declare spline point cleverly, that I avoid to type 50
>> points?
>
> No, your original 24 points are more than suficient to the task. You can
> keep your code exactly the same and just change the final frame from 25
> to 50, or whatever value like 100 or 10000, without any problem.
>
>>
>>
>> (I have tried following defination for spline points
>> clock*50,<1.30*cos(2*pi*clock),0,2.60+1.3*sin(2*pi*clock)>
>> But it doesn't work, what I expected.
>> )
>
> During a given frame, clock always have a single value. That value will
> change for the next frame and cause the shape to change.
>
>>
>> Many Thanks in advance for your advices
>> Yetkin
>>
>>
>
>
Note, there is some formula, or such, which can be used to "derive" the
control points, so that you only set the ones you actually intend to
follow, then generate the start and end points from the data available.
Whether that work with the spline used here, never mind what the math
was to do that... I am really not sure. But, it always seriously bugged
me that you couldn't bloody set the points you need, without having to
know/guess what the controls where supposed to be. :p
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|