|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Heyas!
Just wondering if you can help. I'm a relative newbie to POV, and I've
been trying to follow the help file included to solve this, but to no avail.
Basically, I want to create a nested while loop containing two different
instructions- scale and translate- and apply it to a blob object. The help
file suggests that I put the starting loop instructions just after the
threshold statement of the blob object, like so:
blob {
threshold 0.5
#declare Length = 0;
#while ( Length >= -30 )
#declare Scale = 2;
#while ( Scale >= 0.25 )
sphere { <0,0,0>, 20, 1 scale <1,1,0.9> }
translate <Length,0,0>
scale Scale
#declare Length = Length - 0.25;
#declare Scale = Scale - 0.1;
#end
#end
}
However, when I run this, I get an error message: No matching } in blob,
sphere found instead. (I'm using version 3.6, if that makes any
difference.) I've tried putting the loops in assorted other places as well,
but... nada.
I've also noticed that the help file indicates that the format of nested
while loops should be:
#declare Variable1 = 0;
#while ( Variable1 <= X )
#declare Variable2 = 0;
#while ( Variable2 >= Y )
{{{Stuff here}}}
#declare Variable1 = Variable1 + A;
#end
#declare Variable2 = Variable2 - B;
#end
I've not found this works. Instead, I put both #end statements after the
last variable (as in the previous example), and it seems to work, which is
confusing. I'd be really grateful if someone could tell me what I'm doing
wrong.
Also, can someone fully explain trace for me? I can't seem to get it to
work properly, and I would like to be able to 'trace' an object repeatedly,
so that several instances of the same object are applied. Don't know if I'm
making much sense here?
Anyway, cheers for reading this far, and thanks in advance for any replies!
Heulwen.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Amazon_Warrior" <heu### [at] yahoocom> wrote in message
news:43c1ab14@news.povray.org...
>
> Just wondering if you can help. I'm a relative newbie to POV, and I've
> been trying to follow the help file included to solve this, but to no
> avail.
> Basically, I want to create a nested while loop containing two different
> instructions- scale and translate- and apply it to a blob object. The
> help
> file suggests that I put the starting loop instructions just after the
> threshold statement of the blob object, like so:
>
> blob {
> threshold 0.5
> #declare Length = 0;
> #while ( Length >= -30 )
> #declare Scale = 2;
> #while ( Scale >= 0.25 )
> sphere { <0,0,0>, 20, 1 scale <1,1,0.9> }
> translate <Length,0,0>
> scale Scale
> #declare Length = Length - 0.25;
> #declare Scale = Scale - 0.1;
> #end
> #end
> }
>
> However, when I run this, I get an error message: No matching } in blob,
> sphere found instead. (I'm using version 3.6, if that makes any
> difference.) I've tried putting the loops in assorted other places as
> well,
> but... nada.
You're applying transformations (the translate and scale), multiple times,
only to the blob object itself but not to the sphere(s). Maybe I'm
misunderstanding this myself here, don't know for sure, it just looks like
this error is about that particular aspect even though the blob should still
be transformable like other objects.
> I've also noticed that the help file indicates that the format of nested
> while loops should be:
>
> #declare Variable1 = 0;
> #while ( Variable1 <= X )
> #declare Variable2 = 0;
> #while ( Variable2 >= Y )
> {{{Stuff here}}}
> #declare Variable1 = Variable1 + A;
> #end
> #declare Variable2 = Variable2 - B;
> #end
>
> I've not found this works. Instead, I put both #end statements after the
> last variable (as in the previous example), and it seems to work, which is
> confusing. I'd be really grateful if someone could tell me what I'm doing
> wrong.
For the loops to retain their own identities they require the #end to be
placed where only the corresponding #while contains the parts you want to
change during the looping. If you have the #end's together you aren't
applying anything unique to the first (or outer wrapping) loop, since both
variables change during the second (inner wrapped) loop but nothing is done
once it leaves it.
Back to your blob looping... you seem to be creating a series of shells. The
placing of the spheres would repeat (0*x to -30*x), with smaller sizes (2 to
0.25 radii). This won't matter much unless you animated it during the
process, so I'm guessing you have some idea of what is being done there
(like maybe only a while loop test?).
The actual while loops should be okay if it is written:
blob {
threshold 0.5
// setup for outer (first) loop
#declare Length = 0;
#while ( Length >= -30 )
// set up for inner (second) loop [also gets reset during outer loop]
#declare Scale = 2;
// run the following loop
#while ( Scale >= 0.25 )
sphere {
<0,0,0>, 20, 1 scale <1,1,0.9>
translate <Length,0,0>
scale Scale
} // enclose sphere statement here
// inner loop variable change
#declare Scale = Scale - 0.1;
#end
// outer loop variable change
#declare Length = Length - 0.25;
#end
}
If that's still not making sense enough please go ahead and ask more about
it. I think you're going to want to shift the position around more than
this, anyway, to keep the parts separate and visible. For example, by adding
movement in another direction during the scaling part.
> Also, can someone fully explain trace for me? I can't seem to get it to
> work properly, and I would like to be able to 'trace' an object
> repeatedly,
> so that several instances of the same object are applied. Don't know if
> I'm
> making much sense here?
I like to point out the sample scene files when someone asks about such
things as 'trace'!
[main POV-Ray files location]\scenes\language
There are three or four examples using trace there.
I can only manage a loose description of what takes place and how it is
doing it, mimicking the Help wording, so I'd rather not try. ;) Someone
else might have insights into using it in #while loops so I'll leave that up
to another person, if anyone else replies.
Bob
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bob Hughes" <omniverse@charter%net> schreef in bericht
news:43c20d85$1@news.povray.org...
>
> I can only manage a loose description of what takes place and how it is
> doing it, mimicking the Help wording, so I'd rather not try. ;) Someone
> else might have insights into using it in #while loops so I'll leave that
up
> to another person, if anyone else replies.
>
This is a trace example taken from my last scene. It is essentially
identical to the examples in the POV documentation, but you may try it,
changing some parameters to your own conveniences of course. It is rather
self-explanatory I think.
//================= start code ============================
#declare Spacing = 0.25;
#declare PosX = -10;
#while (PosX < 10)
#declare PosZ = -30;
#while (PosZ < 10)
// trace function
#declare Norm = <0, 0, 0>;
#declare Start = <PosX+(Spacing*rand(Seed)), MaxBox.y+1,
PosZ+(Spacing*rand(Seed))>;
#declare Pos = trace (
Cliff, // object to test
Start, // starting point
-y, // direction
Norm ); // normal
#if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0) // if intersection is
found, normal differs from 0
#if ((vdot(Norm, y)>0.9) /*& (Pos.y > 1.0)*/) // criteria for placing
trees: steep (0.1) to flat (0.9); and above certain level
object {AlienTree
scale RRand(0.01, 0.03, Seed)
rotate RRand(0, 360, Seed)*y
translate Pos
}
#end //end of vdot() & Pos.y
#end //end of Norm
#declare PosZ=PosZ+Spacing;
#end //end of while Z
#declare PosX=PosX+Spacing;
#end //end of while X
//================= end code ============================
Thomas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks for the rapid replies everyone!
"Bob Hughes" <omniverse@charter%net> wrote in message
news:43c20d85$1@news.povray.org...
> "Amazon_Warrior" <heu### [at] yahoocom> wrote in message
> news:43c1ab14@news.povray.org...
> >
> > Just wondering if you can help. I'm a relative newbie to POV, and I've
> > been trying to follow the help file included to solve this, but to no
> > avail.
> > Basically, I want to create a nested while loop containing two different
> > instructions- scale and translate- and apply it to a blob object. The
> > help
> > file suggests that I put the starting loop instructions just after the
> > threshold statement of the blob object, like so:
> >
> > blob {
> > threshold 0.5
> > #declare Length = 0;
> > #while ( Length >= -30 )
> > #declare Scale = 2;
> > #while ( Scale >= 0.25 )
> > sphere { <0,0,0>, 20, 1 scale <1,1,0.9> }
> > translate <Length,0,0>
> > scale Scale
> > #declare Length = Length - 0.25;
> > #declare Scale = Scale - 0.1;
> > #end
> > #end
> > }
> >
> > However, when I run this, I get an error message: No matching } in
blob,
> > sphere found instead. (I'm using version 3.6, if that makes any
> > difference.) I've tried putting the loops in assorted other places as
> > well,
> > but... nada.
>
> You're applying transformations (the translate and scale), multiple times,
> only to the blob object itself but not to the sphere(s). Maybe I'm
> misunderstanding this myself here, don't know for sure, it just looks like
> this error is about that particular aspect even though the blob should
still
> be transformable like other objects.
>
> > I've also noticed that the help file indicates that the format of nested
> > while loops should be:
> >
> > #declare Variable1 = 0;
> > #while ( Variable1 <= X )
> > #declare Variable2 = 0;
> > #while ( Variable2 >= Y )
> > {{{Stuff here}}}
> > #declare Variable1 = Variable1 + A;
> > #end
> > #declare Variable2 = Variable2 - B;
> > #end
> >
> > I've not found this works. Instead, I put both #end statements after
the
> > last variable (as in the previous example), and it seems to work, which
is
> > confusing. I'd be really grateful if someone could tell me what I'm
doing
> > wrong.
>
> For the loops to retain their own identities they require the #end to be
> placed where only the corresponding #while contains the parts you want to
> change during the looping. If you have the #end's together you aren't
> applying anything unique to the first (or outer wrapping) loop, since both
> variables change during the second (inner wrapped) loop but nothing is
done
> once it leaves it.
>
Ok, I think I see what you mean... I'm not a programmer as such, just an
interested on-looker, so I can grasp some of this, but please be patient
with me if I seem especially dense!
> Back to your blob looping... you seem to be creating a series of shells.
The
> placing of the spheres would repeat (0*x to -30*x), with smaller sizes (2
to
> 0.25 radii). This won't matter much unless you animated it during the
> process, so I'm guessing you have some idea of what is being done there
> (like maybe only a while loop test?).
>
> The actual while loops should be okay if it is written:
>
> blob {
> threshold 0.5
> // setup for outer (first) loop
> #declare Length = 0;
> #while ( Length >= -30 )
> // set up for inner (second) loop [also gets reset during outer loop]
> #declare Scale = 2;
> // run the following loop
> #while ( Scale >= 0.25 )
> sphere {
> <0,0,0>, 20, 1 scale <1,1,0.9>
> translate <Length,0,0>
> scale Scale
> } // enclose sphere statement here
> // inner loop variable change
> #declare Scale = Scale - 0.1;
> #end
> // outer loop variable change
> #declare Length = Length - 0.25;
> #end
> }
>
> If that's still not making sense enough please go ahead and ask more about
> it. I think you're going to want to shift the position around more than
> this, anyway, to keep the parts separate and visible. For example, by
adding
> movement in another direction during the scaling part.
>
H'mmm. Thanks for the advice, I think I followed it, however, I'm not so
sure about my version of POV! I copy&pasted your example into POV and ran
it. The translation part certainly seems to work fine, but there is no
noticable scaling effect, which is a problem I've experienced before with
this. I could achieve one effect only at the expense of the other that I
desired. (I changed the parameters to make everything more obvious, and it
was clear that no scaling was occuring.) If the loops are switched around,
I get scaling, but no translation. Grrrrrrr!
> > Also, can someone fully explain trace for me? I can't seem to get it to
> > work properly, and I would like to be able to 'trace' an object
> > repeatedly,
> > so that several instances of the same object are applied. Don't know if
> > I'm
> > making much sense here?
>
> I like to point out the sample scene files when someone asks about such
> things as 'trace'!
>
> [main POV-Ray files location]\scenes\language
>
> There are three or four examples using trace there.
>
> I can only manage a loose description of what takes place and how it is
> doing it, mimicking the Help wording, so I'd rather not try. ;) Someone
> else might have insights into using it in #while loops so I'll leave that
up
> to another person, if anyone else replies.
>
> Bob
>
I've checked them out before, actually. There's some fascinating stuff in
the scenes directory! :) Think I'll have to have another look. I can
usually figure things out if I think about them carefully. However, I
suspect I'm onto a loser unless I can get these wretched while loops to
behave first. Thank you very much for your time and thoughts, tho!
Heulwen
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you, that's very kind of you. Your example looks to be a little
easier to follow that some of the examples in the scene folder. I'll have a
bit of a play, and see if I can figure it out! :)
Cheers muchly!
Heulwen
"Thomas de Groot" <t.d### [at] internlnet> wrote in message
news:43c217ef@news.povray.org...
>
> "Bob Hughes" <omniverse@charter%net> schreef in bericht
> news:43c20d85$1@news.povray.org...
> >
> > I can only manage a loose description of what takes place and how it is
> > doing it, mimicking the Help wording, so I'd rather not try. ;) Someone
> > else might have insights into using it in #while loops so I'll leave
that
> up
> > to another person, if anyone else replies.
> >
>
> This is a trace example taken from my last scene. It is essentially
> identical to the examples in the POV documentation, but you may try it,
> changing some parameters to your own conveniences of course. It is rather
> self-explanatory I think.
>
> //================= start code ============================
> #declare Spacing = 0.25;
>
> #declare PosX = -10;
>
> #while (PosX < 10)
>
> #declare PosZ = -30;
>
> #while (PosZ < 10)
>
> // trace function
> #declare Norm = <0, 0, 0>;
> #declare Start = <PosX+(Spacing*rand(Seed)), MaxBox.y+1,
> PosZ+(Spacing*rand(Seed))>;
> #declare Pos = trace (
> Cliff, // object to test
> Start, // starting point
> -y, // direction
> Norm ); // normal
>
>
> #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0) // if intersection is
> found, normal differs from 0
> #if ((vdot(Norm, y)>0.9) /*& (Pos.y > 1.0)*/) // criteria for
placing
> trees: steep (0.1) to flat (0.9); and above certain level
>
> object {AlienTree
> scale RRand(0.01, 0.03, Seed)
> rotate RRand(0, 360, Seed)*y
> translate Pos
> }
>
> #end //end of vdot() & Pos.y
> #end //end of Norm
>
> #declare PosZ=PosZ+Spacing;
> #end //end of while Z
>
> #declare PosX=PosX+Spacing;
> #end //end of while X
>
> //================= end code ============================
>
>
> Thomas
>
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Amazon_Warrior" <heu### [at] yahoocom> wrote in message
news:43c1ab14@news.povray.org...
> Heyas!
>
> Just wondering if you can help. I'm a relative newbie to POV, and I've
> been trying to follow the help file included to solve this, but to no
> avail.
> Basically, I want to create a nested while loop containing two different
> instructions- scale and translate- and apply it to a blob object. The
> help
> file suggests that I put the starting loop instructions just after the
> threshold statement of the blob object, like so:
>
> blob {
> threshold 0.5
> #declare Length = 0;
> #while ( Length >= -30 )
> #declare Scale = 2;
> #while ( Scale >= 0.25 )
> sphere { <0,0,0>, 20, 1 scale <1,1,0.9> }
> translate <Length,0,0>
> scale Scale
> #declare Length = Length - 0.25;
> #declare Scale = Scale - 0.1;
> #end
> #end
> }
>
> However, when I run this, I get an error message: No matching } in blob,
> sphere found instead.
The only way I could get this particular code to parse, (on 3.5), is
this:
blob {
threshold 0.5
#declare Length = 0;
#while ( Length >= -30 )
#declare Scale = 2;
#while ( Scale >= 0.25 )
#end
sphere { <0,0,0>, 20, 1 scale <1,1,0.9>
translate <Length,0,0>
scale Scale
#declare Length = Length - 0.25;
#declare Scale = Scale - 0.1;
#end
Let me know what you think, oh, and welcome to povray.
~Steve~
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"St." <dot### [at] dotcom> wrote in message news:43c2cc54@news.povray.org...
> The only way I could get this particular code to parse, (on 3.5), is
> this:
And parse... and parse... and parse... and parse... and parse...
Heh, I killed it at 10 hours parse-time this morning. It would be
interesting to know if what I did would have resulted in an image?
~Steve~
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Well, we shouldn't expect it otherwise, since...
> blob {
> threshold 0.5
> #declare Length = 0;
> #while ( Length >= -30 )
> #declare Scale = 2;
..... this loop...
> #while ( Scale >= 0.25 )
>
> #end
..... is terminated here, without altering Scale from its initial value 2:
it'll never drop below 0.25, so making the execution everlasting.
> sphere { <0,0,0>, 20, 1 scale <1,1,0.9>
> translate <Length,0,0>
> scale Scale
> #declare Length = Length - 0.25;
> #declare Scale = Scale - 0.1;
>
> #end
>
> Let me know what you think, oh, and welcome to povray.
>
> ~Steve~
I think they should try this instead:
blob {
threshold 0.5
#declare Length = 0;
#while ( Length >= -30 )
#declare Scale = 2;
#while ( Scale >= 0.25 )
sphere { <0,0,0>, 20, 1 scale <1,1,0.9>
translate <Length,0,0>
scale Scale
}
#declare Scale = Scale - 0.1;
#end
#declare Length = Length - 0.25;
#end
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Frango com Nata" <nomail@nomail> wrote in message
news:web.43c3edfdb43d912cde6a74b0@news.povray.org...
> Well, we shouldn't expect it otherwise, since...
>
>> blob {
>> threshold 0.5
>> #declare Length = 0;
>> #while ( Length >= -30 )
>> #declare Scale = 2;
>
> ..... this loop...
>
>> #while ( Scale >= 0.25 )
>>
>> #end
>
> ..... is terminated here, without altering Scale from its initial value 2:
> it'll never drop below 0.25, so making the execution everlasting.
Ah, thank you. I'm not experienced at all with #declare and #while, but
was quite pleased that I actually got it to parse after trying quite a few
things. Thankfully, it was only parsing overnight... ;)
> I think they should try this instead:
>
> blob {
> threshold 0.5
> #declare Length = 0;
> #while ( Length >= -30 )
> #declare Scale = 2;
> #while ( Scale >= 0.25 )
> sphere { <0,0,0>, 20, 1 scale <1,1,0.9>
> translate <Length,0,0>
> scale Scale
> }
> #declare Scale = Scale - 0.1;
> #end
> #declare Length = Length - 0.25;
> #end
> }
Oh, that parsed in what seemed like less than half a second! Image looks
like it's going to be *real* slow though. The blob?
Hope it helps the OP.
~Steve~
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
H'mm. Some interesting ideas here. I'll try them and see how I get on! At
least the more I experiment, the better I understand how the code actually
works, so it's all to the good, I guess. Just very frustrating when I want
it to work now! :p
Thanks loads for all the suggestions from everybody, anyway. Much obliged!
"St." <dot### [at] dotcom> wrote in message news:43c3fb57@news.povray.org...
>
> "Frango com Nata" <nomail@nomail> wrote in message
> news:web.43c3edfdb43d912cde6a74b0@news.povray.org...
> > Well, we shouldn't expect it otherwise, since...
> >
> >> blob {
> >> threshold 0.5
> >> #declare Length = 0;
> >> #while ( Length >= -30 )
> >> #declare Scale = 2;
> >
> > ..... this loop...
> >
> >> #while ( Scale >= 0.25 )
> >>
> >> #end
> >
> > ..... is terminated here, without altering Scale from its initial value
2:
> > it'll never drop below 0.25, so making the execution everlasting.
>
> Ah, thank you. I'm not experienced at all with #declare and #while, but
> was quite pleased that I actually got it to parse after trying quite a few
> things. Thankfully, it was only parsing overnight... ;)
>
>
> > I think they should try this instead:
> >
> > blob {
> > threshold 0.5
> > #declare Length = 0;
> > #while ( Length >= -30 )
> > #declare Scale = 2;
> > #while ( Scale >= 0.25 )
> > sphere { <0,0,0>, 20, 1 scale <1,1,0.9>
> > translate <Length,0,0>
> > scale Scale
> > }
> > #declare Scale = Scale - 0.1;
> > #end
> > #declare Length = Length - 0.25;
> > #end
> > }
>
> Oh, that parsed in what seemed like less than half a second! Image looks
> like it's going to be *real* slow though. The blob?
>
> Hope it helps the OP.
>
> ~Steve~
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|