POV-Ray : Newsgroups : povray.general : Need a Macro; derive Visible Space Params Server Time
15 Nov 2024 07:12:17 EST (-0500)
  Need a Macro; derive Visible Space Params (Message 1 to 5 of 5)  
From: Jeff
Subject: Need a Macro; derive Visible Space Params
Date: 2 Nov 2004 22:20:00
Message: <web.41884da2d3548ff934d765680@news.povray.org>
I remember running a across a macro a couple of years ago that was supposed
to generate a lot of 3D stars (spheres) and so as not to waste effort, this
macro was supposed to *only* calculate and place stars in the *visable
area* of the screen (rather than just generate 5000 stars all over the
place, most of which you won't see).

As I recall, the macro didn't work to begin with and in any case I can't
find it in the PovRay links or on the web.

I need a macro that (preferably) : Given the camera location vector, look_at
vector and the camera angle (Field of View), derive the angles (random
negative and positive Pitches and Azimuths) to be used in a rotate
<Pitch,Azimuth,Bank> transformation and will *only* put an object on to the
*visible* part of the screen. The object will have already been defined at
the origin < 0, 0, 0>, scaled and then transformed out via a translate < 0,
0, SomeHugeAmountofZee>.

*OR*

Maybe just something that will put a bunch of triangles, discs or spheres at
random X and Y (but at a fixed Zee). It would be better with a rotate as
begged for in the last paragraph though... with a rotate triangles or discs
would be facing the correct direction (towards the camera ... or at least
towards the origin, which might be close enough).

I found a macro that MIGHT help me if I can perform some surgery on it
without frying too many of my brain cells : a modified Look_At_Raised macro
(part of his Look_At macro) by Tim Nikias Wenclawiak at
www.digitaltwilight.de/no_lights. Trying this is giving me headaches,
though. Strokes, even.

Any help would be greatly appreciated. Thanks - Jeff


Post a reply to this message

From: Tim Nikias
Subject: Re: Need a Macro; derive Visible Space Params
Date: 2 Nov 2004 22:30:09
Message: <418850c1$1@news.povray.org>
Hey Jeff!

1st: The appropriate link should have been http://www.nolights.de, I'm not a
DigitalTwilight since over a year. :-)
2nd: If you download my Glare-Macros, you'll find a macro called
Glare_Transform(x) in there. "x" is a position-vector which will get
transformed. If the x and y component of that vector is between .5 and -.5,
the transformed point in space will be within the viewing frustrum of a
standard camera. The z component returns the distance from the camera and
needs to be positive to be in front of the camera and not behind it...

Note that the macro requires at least two variables, Camera_Location and
Camera_Look_At, to work properly, other needed variables are declared with
default values in case they are specified.

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Jeff
Subject: Re: Need a Macro; derive Visible Space Params
Date: 2 Nov 2004 22:50:00
Message: <web.4188544cac9f131134d765680@news.povray.org>
Tim - Thanks - fast reply! (.. and I just got registered here about an hour
ago..).

Sorry about misposting your website, I copied/pasted that info from your
look_at.inc file.

Yes, I downloaded ALL of your macros about a week ago (and got the MMM
update this morning) - looked them over, I'm overwhelmed by your great
work...

I'll have a look at the glare macro, and maybe I can adapt it for what I am
trying to do - thanks again!

:)


Post a reply to this message

From: Warp
Subject: Re: Need a Macro; derive Visible Space Params
Date: 3 Nov 2004 03:36:52
Message: <418898a4@news.povray.org>
Jeff <nomail@nomail> wrote:
> I remember running a across a macro a couple of years ago that was supposed
> to generate a lot of 3D stars (spheres) and so as not to waste effort, this
> macro was supposed to *only* calculate and place stars in the *visable
> area* of the screen (rather than just generate 5000 stars all over the
> place, most of which you won't see).

  Are you sure it's all that bad to have tiny spheres all around the
camera? (Hint: Do you know what vista buffers are?)

  Secondly, if the stars are only located so that they can be viewed
from the camera, it will not work very well if you have reflecting
objects...

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Jeff
Subject: Re: Need a Macro; derive Visible Space Params
Date: 3 Nov 2004 05:15:00
Message: <web.4188ae72ac9f1311aab3f0cb0@news.povray.org>
Warp - thanks for your reply.

First let me mention my computer problems... my last GOOD computer was a
custom built Falcon Northwest computer pre-ordered in early 2001, delivered
in June 2001... I waited until the *first* GeForce 3 video cards arrived
via Canada. This was a cutting edge state of the art computer for its time.

That computer was destroyed a few months ago in an accident. My sole income
is military retirement + a small VA disability (a minor service connected
injury involving an "exploding knee"... hehehehe) - and I had my
hospitalization in July 1998 from a *massive* heart attack, and have since
developed COPD - so know I am very disabled and cant work (plus some debt
left over as a result of an $80,000 hospitalization, two operations, etc -
Im retired military, but they DONT pay for it all). If I just look at a
trampoline, or a treadmill or even a pair of athletic shoes I get angina
and wheeze. It will be a while before I can afford a good computer.

In the meantime, I have this old IBM 350 that I slapped together a few years
ago for playing old DOS games under DOS 6.22, with only a *Pentium 166*.
Originally, just to get back on the Internet, I scrounged 128 Mb of old
legacy RAM for it (it had 16 Mb at the time), and bought a cheap external
serial port dialup modem. I installed WIN98SE on the 850 Mb hard drive and
converted it to FAT32. It gets me back on the Internet. NOT the best thing
for ray tracing.

Having said that.... regarding Vista Buffers - its not rendering speed (so
much, speed is a *secondary* concern on this issue) but memory that I am
concerned about. If I generate 1000 stars but only 50 are visible, then 950
evil stars are not contributing to the scene and eating RAM. So I bump it
up to 10000 stars... maybe only 100 are visible, leaving 9900 freeloading
no-renderin ram-eatin evil stars. The 100 that are visible probably would
be unacceptable. If I keep going, my RAM will explode. Therefore I need to
make sure the stars I DO generate are not "wasted".

Regarding reflection - whenever I have reflecting water, then stars makes
the ocean look like it has contracted glow in the dark measles. Even a deep
space scene : a metal spacecraft or metallic asteroid looks strange with
little white spots all over it. Of course I could just use no_reflection in
the star object definitions, but then we go back to the first problem : RAM
eatin evil stars that don't directly contribute. Its better to *generate*
1000 stars and have them all show up rather than attempt to generate a
zillion just to show a thousand and have my RAM blow up.
:)
----------------
Tim (et al) - I was looking over a backup CD that I made a year or so ago,
and rediscovered a lot of tutorials from the "Cyclopedia" website - I need
to re-learn v_axis_rotate (etc) again, and then I think I can make a good,
compact customized visible-only star generation routine. I forgot, a year
or so ago I successfully used those functions to convert small (triangle)
meshes to intersections (of planes) so that I could do proper CSG on the
objects. If I can reach that level of proficiency again, I should be able
to do this.

- Thanks again all.


Post a reply to this message

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