POV-Ray : Newsgroups : povray.general : Transparent PNGs Server Time
4 May 2024 13:28:48 EDT (-0400)
  Transparent PNGs (Message 25 to 34 of 44)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Sven Littkowski
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 08:38:28
Message: <59de10c4$1@news.povray.org>
On 11.10.2017 06:49, clipka wrote:
> right
> x*image_width/image_height
Thanks. :-)

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Sven Littkowski
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 08:41:33
Message: <59de117d$1@news.povray.org>
Okay, here is the latest problem and also the scene code.

The value "AmountLines" allows me to set the amount of oar lines above
each other, but strangely, I always get just one line. I am very sure,
the fault is with me: "I am not seeing the forest because of all the
trees in my eyesight". Means, I am looking at the scene code, and just
can't discover the error in thinking/writing. Can you help?

---SCENE-------------------------------------------------------



#local Temp_version = version;
#version 3.7;

#declare MyRadiosity = off;   // on

global_settings
{
 #if(MyRadiosity)
  radiosity
  {
   media on
   pretrace_start 0.08
   pretrace_end   0.001
   count 400
   error_bound 0.75
   recursion_limit 1
   normal on
  }
 #end
 subsurface        {}
 adc_bailout       0.0039
 ambient_light     rgb < 0.000, 0.000, 0.000 >
 assumed_gamma     1.000
 irid_wavelength   rgb < 0.250, 0.180, 0.140 >
 max_trace_level   5
 number_of_waves   10
 noise_generator   3
 charset           ascii
}

camera
{
 location < 7.0,  0.0, -50.0 >
 look_at  < 7.0,  0.0,   0.0 >
 right x*image_width/image_height
}

light_source
{
 < -50000.0, 50000.0, -50000.0 > //light position
 color rgb < 1.0, 1.0, 1.0 > * 1.0
 parallel
 point_at < 0.0, 0.0, 0.0 >
}

//
---------------------------------------------------------------------------
-----------------------

#include "textures.inc"

#declare UpperOar = texture
{
 DMFDarkOak
 pigment { color rgb < 1.0, 1.0, 1.0 > }
 normal { wood 0.5 scale 0.3 turbulence 0.1 }
 finish { phong 1 }
 rotate< 90.0, 0.0, 0.0 >
 scale 0.25
}

#declare LowerOar = texture
{
 DMFDarkOak
 pigment { color rgb < 0.3, 0.01, 0.0 > }
 normal { wood 0.5 scale 0.3 turbulence 0.1 }
 finish { phong 1 }
 rotate< 90.0, 0.0, 0.0 >
 scale 0.25
}

#declare TotalLength      = 10.0;   // length of oars of the lowest line
#declare AmountOarsInLine = 30;
#declare AmountLines      = 3;
#declare LineLeftShift    = 0.5;    // shift towards the left side for
additional lines
#declare LineHeightShift  = 0.5;    // distance to line below
#declare MyVariance       = 4.0;    // human irregularity
#declare MyHeightMore     = 0.50;   // upper lines need longer oars
#declare GeneralAngle     = 40;     // the angle of each oar from hull
towards water
#declare BladeAngle       = 85.0;   // the angle of the blade when
touching water
#declare ForwardAngle     = 05.0;   // to equalize the ends of each line
to the eye

#declare R1 = seed(1);
#declare R2 = seed(2);
#declare R3 = seed(3);





//
---------------------------------------------------------------------------
-----------------------

#macro MyOar(MyHeightMoreThis)
 union
 {
  union
  {
   cone
   {
    < 0.0, -10.0, 0.0 > 0.000 < 0.0, -9.9, 0.0 > 0.250
   }
   cone
   {
    < 0.0, -9.9, 0.0 > 0.250 < 0.0, -5.5, 0.0 > 0.000
   }
   texture { LowerOar }
   scale < 1.0, 1.0, 0.1 >
  }
  union
  {
   cone
   {
    < 0.0, -9.5, 0.0 > 0.020 < 0.0, -5.5, 0.0 > 0.075
   }
   cylinder
   {
    < 0.0, -5.5, 0.0 > < 0.0, 0.0, 0.0 > 0.075
   }
   #if(MyHeightMoreThis>0)
    cylinder
    {
     < 0.0, MyHeightMoreThis, 0.0 > < 0.0, 0.0, 0.0 > 0.075
    }
    translate < 0.0, -MyHeightMoreThis, 0.0 >
   #end
   texture { UpperOar }
  }  no_shadow
 }
#end




#declare MyNumber = 0;


#macro MyOarLine(AmountOarsInLine,MyHeightMoreThis)
 union
 {
  #while(MyNumber<AmountOarsInLine)

   #declare MyAngleWater     = (rand(R1)*MyVariance)+GeneralAngle;
   #declare MyAngleHands     = (rand(R2)*MyVariance)+BladeAngle;
   #declare MyAngleDirection = (rand(R3)*MyVariance)+ForwardAngle;
   object
   {
    MyOar(MyHeightMoreThis)
    rotate < 0.0, MyAngleHands, 0.0 >
    rotate < MyAngleWater, 0.0, 0.0 >
    rotate < 0.0, 0.0, MyAngleDirection >
    translate < (MyNumber*0.925), 0.0, 0.0 >
   }
   #declare MyNumber = MyNumber+1;
  #end
 }
#end



union
{
 #declare ThisLine = 0;
 #while(ThisLine<AmountLines)
  object { MyOarLine(AmountOarsInLine,MyHeightMore*ThisLine) translate <
-((AmountOarsInLine*0.925)/2)+0.925-(LineLeftShift*ThisLine),
LineHeightShift*ThisLine, 0.0 > }
  #declare ThisLine=ThisLine+1;
 #end

 box
 {
  < -20.0, -15.0, 0.0 > < 20.0, 15.0, 0.1 >
  pigment { color rgb < 1.0, 1.0, 1.0 > }
 }
 box
 {
  < -1.0, -25.0, 2.0 > < 1.0, 25.0, 2.1 >
  pigment { color rgb < 0.5, 0.5, 0.5 > }
 }
 translate < 0.0, 0.0, 0.0 >
}


---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Bald Eagle
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 09:35:00
Message: <web.59de1d6bc5de9ff4c437ac910@news.povray.org>
Sven Littkowski <I### [at] SvenLittkowskiname> wrote:
> Okay, here is the latest problem and also the scene code.
>
> The value "AmountLines" allows me to set the amount of oar lines above
> each other, but strangely, I always get just one line. I am very sure,
> the fault is with me: "I am not seeing the forest because of all the
> trees in my eyesight". Means, I am looking at the scene code, and just
> can't discover the error in thinking/writing. Can you help?


>  #declare ThisLine = 0;
>  #while(ThisLine<AmountLines)

You never have a line that increments ThisLine.

Add
#declare ThisLine = ThisLine + 1;

or use a

#for (ThisLine, 1, 3)
 ....
#end

loop.


Post a reply to this message

From: clipka
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 10:04:05
Message: <59de24d5$1@news.povray.org>
Am 11.10.2017 um 15:32 schrieb Bald Eagle:
> Sven Littkowski <I### [at] SvenLittkowskiname> wrote:
>> Okay, here is the latest problem and also the scene code.
>>
>> The value "AmountLines" allows me to set the amount of oar lines above
>> each other, but strangely, I always get just one line. I am very sure,
>> the fault is with me: "I am not seeing the forest because of all the
>> trees in my eyesight". Means, I am looking at the scene code, and just
>> can't discover the error in thinking/writing. Can you help?
> 
> 
>>  #declare ThisLine = 0;
>>  #while(ThisLine<AmountLines)
> 
> You never have a line that increments ThisLine.

Actually he does.


Post a reply to this message

From: Bald Eagle
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 10:15:00
Message: <web.59de2659c5de9ff4c437ac910@news.povray.org>
grrr.

Sorry, I was in the middle of handling a few thousand pounds of stuff and
clicked before I triple-read your code.

Now that I have a proper break:
Of course you had to have that increment, otherwise you'd have an infinite
loop...


But I do notice you're translating based on that value times 0.5.  Is that
supposed to be 0.5 times --- some absolute height value?   Maybe your vertical
translation is too small.

What if you create an array for your oar texture, and have each successive line
of oars be a different color - then it might be easier to see what's going on /
going wrong.

maybe output the location of the bounding boxes to the #debug stream as well...


Post a reply to this message

From: clipka
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 10:17:06
Message: <59de27e2$1@news.povray.org>
Am 11.10.2017 um 14:41 schrieb Sven Littkowski:

> The value "AmountLines" allows me to set the amount of oar lines above
> each other, but strangely, I always get just one line. I am very sure,
> the fault is with me: "I am not seeing the forest because of all the
> trees in my eyesight". Means, I am looking at the scene code, and just
> can't discover the error in thinking/writing. Can you help?

[...]
> #declare MyNumber = 0;
> 
> 
> #macro MyOarLine(AmountOarsInLine,MyHeightMoreThis)
>  union
>  {
>   #while(MyNumber<AmountOarsInLine)
> 
>    #declare MyAngleWater     = (rand(R1)*MyVariance)+GeneralAngle;
>    #declare MyAngleHands     = (rand(R2)*MyVariance)+BladeAngle;
>    #declare MyAngleDirection = (rand(R3)*MyVariance)+ForwardAngle;
>    object
>    {
>     MyOar(MyHeightMoreThis)
>     rotate < 0.0, MyAngleHands, 0.0 >
>     rotate < MyAngleWater, 0.0, 0.0 >
>     rotate < 0.0, 0.0, MyAngleDirection >
>     translate < (MyNumber*0.925), 0.0, 0.0 >
>    }
>    #declare MyNumber = MyNumber+1;
>   #end
>  }
> #end

You need to set `MyNumber = 0` each time you're running the macro (i.e.
the `#declare` should be inside the macro. Also, I'd suggest using
`#local` instead; it's good practice for macros, unless you want to pass
values out of the macro via global variables.)


Post a reply to this message

From: Sven Littkowski
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 13:47:29
Message: <59de5931$1@news.povray.org>
On 11.10.2017 10:17, clipka wrote:
> Am 11.10.2017 um 14:41 schrieb Sven Littkowski:
> 
>> The value "AmountLines" allows me to set the amount of oar lines above
>> each other, but strangely, I always get just one line. I am very sure,
>> the fault is with me: "I am not seeing the forest because of all the
>> trees in my eyesight". Means, I am looking at the scene code, and just
>> can't discover the error in thinking/writing. Can you help?
> 
> [...]
>> #declare MyNumber = 0;
>>
>>
>> #macro MyOarLine(AmountOarsInLine,MyHeightMoreThis)
>>  union
>>  {
>>   #while(MyNumber<AmountOarsInLine)
>>
>>    #declare MyAngleWater     = (rand(R1)*MyVariance)+GeneralAngle;
>>    #declare MyAngleHands     = (rand(R2)*MyVariance)+BladeAngle;
>>    #declare MyAngleDirection = (rand(R3)*MyVariance)+ForwardAngle;
>>    object
>>    {
>>     MyOar(MyHeightMoreThis)
>>     rotate < 0.0, MyAngleHands, 0.0 >
>>     rotate < MyAngleWater, 0.0, 0.0 >
>>     rotate < 0.0, 0.0, MyAngleDirection >
>>     translate < (MyNumber*0.925), 0.0, 0.0 >
>>    }
>>    #declare MyNumber = MyNumber+1;
>>   #end
>>  }
>> #end
> 
> You need to set `MyNumber = 0` each time you're running the macro (i.e.
> the `#declare` should be inside the macro. Also, I'd suggest using
> `#local` instead; it's good practice for macros, unless you want to pass
> values out of the macro via global variables.)
> 
Hi, thanks.

I pressed ENTER too fast and therefore wasn't able to add the
explanations to that posting as I actually had wanted.

Doing it now.

The ships had between one line of oars, two, or a maximum of three lines
of oars, each line above each other by half a meter (that is the "0.5"
value), and also half a meter shifted to the left (to prevent the oar
holes would be directly above each other).

My code features the same thing: I can set the amount of oar lines, and
the WHILE loop with the,lines is executed only one single time, in which
between one to three lines (or more if I had entered more) would be
created. The value "#declare ThisLine = 0;" right in front of this code
would be read only one time therefore (should be, to the best of my
knowledge).

Each line consists of a flexible amount of oars. But I don't think, that
any fault is within those code segments.

Concentrating back on the code segment for the creation of multiple oar
lines, I think here somewhere must be the problem.

If I specify three oar lines, it creates only the upper oar line (higher
starting position). If I specify two oar lines, it only creates one oar
line in the middle. And if i specify that the ship has only one oar
line, it creates the lowest oar line (correctly in this case). But in
the first two cases (3 and 2 lines), oar lines are missing.

Example:
specifying 3 oar lines, I should see three lines of oars, one on top,
one in the middle, one at the bottom, each slightly shifted to the side.
But I see only the upper oars line.

The WHILE loop calls a macro, but the WHILE loop itself is not part of
any macro. If I would put the "#declare ThisLine = 0;" value inside a
macro, I believe it wouldn't work as that value is needed outside that
macro in order to specify how many times that macro is being called.

Can anyone get this code to function? The configuration values close to
the top of this scene are set for creating 3 oars lines. Who can get it
to create 3 lines, or can find my error(s)?



---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Bald Eagle
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 15:10:01
Message: <web.59de6c03c5de9ff4c437ac910@news.povray.org>
Sven Littkowski <I### [at] SvenLittkowskiname> wrote:

I'm gonna go with Christoph's sharp eye and programming kung-fu.

> >> The value "AmountLines" allows me to set the amount of oar lines above
> >> each other, but strangely, I always get just one line. I am very sure,
> >> the fault is with me: "I am not seeing the forest because of all the
> >> trees in my eyesight". Means, I am looking at the scene code, and just
> >> can't discover the error in thinking/writing. Can you help?
> >
> > [...]
> >> #declare MyNumber = 0;

This line only ever gets parsed once.

> >> #macro MyOarLine(AmountOarsInLine,MyHeightMoreThis)
> >>  union
> >>  {
> >>   #while(MyNumber<AmountOarsInLine)
 {stuff}
> >>    #declare MyNumber = MyNumber+1;
> >>   #end
Now MyNumber = AmountOarsInLine.
Since you don't ever do #declare MyNumber = 0; to reset that, it STAYS this way.
The next time you run the macro, the #while directive just goes, "I'm already
maxxed out", and exits.
> >>  }
> >> #end
> >
> > You need to set `MyNumber = 0` each time you're running the macro (i.e.
> > the `#declare` should be inside the macro. Also, I'd suggest using
> > `#local` instead; it's good practice for macros, unless you want to pass
> > values out of the macro via global variables.)


So the question is:  Did you move #declare MyNumber = 0; to inside the macro and
run it?

Right after
#while(MyNumber<AmountOarsInLine)
put
#debug "creating row of oars \n"
or something, and see what happens.

The more you try to head off bugs, you'll find the less you have to debug...


Post a reply to this message

From: Sven Littkowski
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 15:21:46
Message: <59de6f4a$1@news.povray.org>
On 11.10.2017 15:07, Bald Eagle wrote:
>  only ever


Bald Eagle: FULL HIT!

You managed to open my eyes. Yes, it was "MyNumber", and when i placed
it inside the macro, it worked! I think, that is what Clipka had in
mind, too, but I did not understand him (my fault again)

Problem solved!

Thank a lot, everyone!

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Sven Littkowski
Subject: Re: Transparent PNGs
Date: 11 Oct 2017 15:41:21
Message: <59de73e1@news.povray.org>
Okay, I am getting there. Almost where I want to reach. Now another
problem where I need the advise of you experienced users: perspective!

Currently, the lower ends of the oars spread more towards the left and
right side (because they are closer to the camera). I don't want to
switch of that entirely, but i want to reduce the perspective drag
towards the sides a bit. I know, this must be accomplished inside the
CAMERA settings. but how exactly?

I started to experiment already, but have not yet found the path to
paradise.


---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message


Attachments:
Download 'sl - rome - oars.png' (90 KB)

Preview of image 'sl - rome - oars.png'
sl - rome - oars.png


 

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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