POV-Ray : Newsgroups : povray.programming : sphere memory Server Time
28 Jul 2024 14:35:08 EDT (-0400)
  sphere memory (Message 6 to 15 of 25)  
<<< Previous 5 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: William F  Pokorny
Subject: Re: sphere memory
Date: 30 Aug 2002 03:29:33
Message: <3D6F1EDD.815584CB@attglobal.net>
Mark & Niki,
I am sure some of the developers better know the numbers, but if you are willing
to listen to a relative newbie, here is how I see it.

I believe Pov-Ray uses a 4 by 4 matrix of doubles internally for each transform
of anything.  This would account for 16 x 16 = 256 bytes of what you see for
each sphere.  Guessing a little, but automatic bounds,  the light buffers and
vista buffers for half a million objects has to be pushing 256 bytes per object
- this you could actually test by turning these options off. If you try it, I
would not bother completing the render as the performance will be awful.  Just
those things  get us to 512 bytes per sphere.  Then we have the sphere itself at
4 x 16 = 64 bytes.  Probably at least 4 pointers at 4 bytes is another 16 bytes
a sphere. Let see that gets us to 592 bytes per sphere. Just to store the
calculated image for say an 800 x 600 render (Internally 3 x 16 bytes a pixel)
is about 46 bytes per sphere and there is bound to be pointers from each of
those screen locations to something for another 4 bytes per sphere.  That gets
us to 642 bytes a sphere.  I myself cannot account for the remaining 80 bytes
per sphere, but I would make a bet there are people here who know.

Mark, I think the doubling you saw when you individually textured is simply
because instead of storing one texture for all spheres you must now  store
500,000 and these texture structures. Even when textures are very, basic they
are not small and each will most probably be themselves transformed which means
pointers at the very least.

I guess I don't see this amount of storage as being that out of line - if
performance and reasonable accuracy are you goals.  I expect it is possible to
more compactly represent this data, but likely only at some performance expense
and code complexity.  Someone, in one of the Pov-Ray news groups, mentioned the
idea of an option to use floats everywhere instead of doubles to reduce storage.
Pov-Ray would run this way, but I doubt you would like the inaccuracies which
would be apparent in all but the simplest images.

Memory is reasonably priced these days - perhaps Pov-Ray costs something after
all! :-)
Bill P.


Post a reply to this message

From: ABX
Subject: Re: sphere memory
Date: 30 Aug 2002 03:40:27
Message: <p58umuotf4foqsjdke3frbatfivd1q536j@4ax.com>
On Fri, 30 Aug 2002 03:29:33 -0400, "William F. Pokorny"
<pok### [at] attglobalnet> wrote:
> I believe Pov-Ray uses a 4 by 4 matrix of doubles internally for each transform
> of anything.

Every transformation structure contains 2 matrixes: normal and inversed one.

ABX


Post a reply to this message

From: Niki Estner
Subject: Re: sphere memory
Date: 30 Aug 2002 04:17:56
Message: <3d6f2a34@news.povray.org>
This question may be dumb, but why does a sphere need a bounding box? It
isn't used during rendering, is it?
Also, why does an ellipsoid need a center and a readius? The light ray must
be transformed into "sphere space"
anyway, couldn't center and radius be done right with that, too
(scale+translate of unity sphere)? If I say all my spheres share one
texture, couldn't I save some of the pointers for texture, interior,...?
That was basically the idea when I started to think about my "sphere_mesh".
I began to implement it, it needs one transformation per sphere (as already
said, 2x4x4x8 bytes). Unfortunately, my spheres don't use e
vista/light-buffer anymore of course, which makes them quite slow. I read
(in the vlbuffer comments) that the triangle-mesh and blob objects have
their own "vista-buffering-like" optimizations. Both objects are too slow
for me, but I'll take a deep look at the mesh-bounding-trees, I guess.
Now, finally, the last dumb question: All matrices are 4x4, while only 4x3
is needed (3x3 transformation matrix plus 3x1 translation vector). Couldn't
I store the matrices in 4x3 format, "unpacking" them when needed (64 bytes
per sphere)? Also, I could try to store the matrix with floats instead of
doubles (another 96 bytes).

All this doesn't make nice code, and it's no fun doing it anyway, so if
anyone got any better ideas for me, please tell me so.

Niki

"ABX" <abx### [at] abxartpl> schrieb im Newsbeitrag
news:uf3umuo52v40rumoc9smuvfnhr3lfim85r@4ax.com...
> On Fri, 30 Aug 2002 01:21:32 -0400, Mark Wagner <mar### [at] gtenet>
wrote:
> > or about 720 bytes per sphere.
>
> whole sphere structure in discussed example cause at least:
> - 11 pointers
> - 1 int
> - 1 unsigned long
> - 7 single float
> - 34 double float
>
> and it contains:
> - pointer to sphere and pointers to local structures
> - transformation
> - center and radius
> - bounding box vectors
> - other parameters
>
> I don't know how much of memory use vista buffer.
> I don't know how much of memory use other structures required for
rendering.
>
> ABX


Post a reply to this message

From: ABX
Subject: Re: sphere memory
Date: 30 Aug 2002 04:34:40
Message: <htaumu085v98bnq04l8vuqq4ag3fctqgm1@4ax.com>
On Fri, 30 Aug 2002 10:10:24 +0200, "Niki Estner" <nik### [at] freenetde>
wrote:
> This question may be dumb, but why does a sphere need a bounding box? It
> isn't used during rendering, is it?

Bounding boxes usually are not used in theirs parent objects. They are for
vista buffer for example.

> Also, why does an ellipsoid need a center and a readius? The light ray must
> be transformed into "sphere space"
> anyway, couldn't center and radius be done right with that, too
> (scale+translate of unity sphere)?

It would be much slower.

> If I say all my spheres share one
> texture, couldn't I save some of the pointers for texture, interior,...?

IIRC it is done similiar way, but I can be wrong

> All this doesn't make nice code, and it's no fun doing it anyway, so if
> anyone got any better ideas for me, please tell me so.

Buy RAM ? :-)

ABX


Post a reply to this message

From: Niki Estner
Subject: Re: sphere memory
Date: 30 Aug 2002 05:53:06
Message: <3d6f4082@news.povray.org>
> > [using a matrix transformation instead of center/radius]
> It would be much slower.
For a sphere, I understand this, but for an ellipsoid? The ray has to be
multiplied with a matrix anyway, the center/radius scale/translate matrix
could be combined with the matrix that's already there (that made an
ellipsoid out of the sphere). Wouldn't that save a vector-subtraction (no
big time saving, but not slower at least)

> IIRC it is done similiar way, but I can be wrong
What's IIRC?

> Buy RAM ? :-)
Guess I'll gonna do that...
But admit it: when you read my problem first, you also thought: 500,000
spheres - no problem with 256MB.


Post a reply to this message

From: ABX
Subject: Re: sphere memory
Date: 30 Aug 2002 06:03:04
Message: <e4gumugqfqrkc7efjhrjcdb0v1k9clcql1@4ax.com>
On Fri, 30 Aug 2002 11:46:17 +0200, "Niki Estner" <nik### [at] freenetde>
wrote:
> For a sphere, I understand this, but for an ellipsoid? The ray has to be
> multiplied with a matrix anyway, the center/radius scale/translate matrix
> could be combined with the matrix that's already there (that made an
> ellipsoid out of the sphere). Wouldn't that save a vector-subtraction (no
> big time saving, but not slower at least)

That's the problem of design. It would be necessary to add ellipsoid object to
SDL to add this optimization and leave speed of 'normal' sphere. Try this with
own patch.

> > IIRC it is done similiar way, but I can be wrong
> What's IIRC?

http://www.acronymfinder.com

> > Buy RAM ? :-)
> Guess I'll gonna do that...
> But admit it: when you read my problem first, you also thought: 500,000
> spheres - no problem with 256MB.

That's becouse recent time when I watched my 8000x8000 render it was started
with 2GB of RAM ;-)

ABX


Post a reply to this message

From: Niki Estner
Subject: Re: sphere memory
Date: 30 Aug 2002 06:57:40
Message: <3d6f4fa4@news.povray.org>
> That's the problem of design. It would be necessary to add ellipsoid
object to
> SDL to add this optimization and leave speed of 'normal' sphere. Try this
with
> own patch.

IIRC the ellipsoid is already some kind of an own object type - it has
different methods from the sphere. Making the memory layout different
wouldn't change too much. However, that's just 32 bytes of about 500-1000
bytes per sphere, so that won't solve my problem. The texture pointers and
stuff are in the standard OBJECT_FIELDS, so kicking them I would loose the
vista/light buffer - which again hurts performance badly (indeed, I tried
that already).

Ok, now this is really off-topic, but did anyone ever think about
hyper-textures? I read about it in theory some time ago, but I don't really
have an idea about where to start.
I guess modifying the isosurface object, so it wraps around a given object
(spheres, boxes, cylinders, heightfields come right to my mind), and
limiting it so some optimizations can be done to it, while keeping it
general enough for most effects (hair, grass, wool, cloth, stones, sand,
broken wood, etc).
Unfortunately my imagination doesn't seem to be sufficient for such a
modification, not even mentioning my math...


Post a reply to this message

From: Christopher James Huff
Subject: Re: sphere memory
Date: 3 Sep 2002 15:10:03
Message: <chrishuff-8D1F8A.15094603092002@netplex.aussie.org>
In article <3d6f4fa4@news.povray.org>,
 "Niki Estner" <nik### [at] freenetde> wrote:

> Ok, now this is really off-topic, but did anyone ever think about
> hyper-textures? I read about it in theory some time ago, but I don't really
> have an idea about where to start.

I'm not sure what "hypertextures" are, but I think they have something 
to do with actually deforming the surface of the object. POV is a 
raytracer that traces most shapes directly, it doesn't reduce everything 
to triangles, so doing real deformation would require tesselating the 
objects into a triangle meshe or tracing curved rays. The former has 
problems like high memory use and triangle artifacts, the latter would 
just barely be possible by approximating the curved ray with many short 
straight ray segments, and would be very slow and still limited.
Giving a way to tesselate shapes into meshes and a way to deform meshes 
might be sufficient.


> I guess modifying the isosurface object, so it wraps around a given object
> (spheres, boxes, cylinders, heightfields come right to my mind), and
> limiting it so some optimizations can be done to it, while keeping it
> general enough for most effects (hair, grass, wool, cloth, stones, sand,
> broken wood, etc).

I'm not really sure what you mean, or that you understand isosurfaces. 
There are existing functions for the shapes you listed, but not every 
primitive POV supports can be done as an isosurface. You can't just wrap 
an isosurface around another object, you can usually design the function 
to make a similar surface though. Are you talking about built-in 
isosurface functions for making displaced versions of the basic 
primitives, so a user defined function doesn't have to be interpreted?

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: sphere memory
Date: 4 Sep 2002 07:32:24
Message: <3d75ef48@news.povray.org>
In article <chr### [at] netplexaussieorg> , 
Christopher James Huff <chr### [at] maccom>  wrote:

> I'm not sure what "hypertextures" are

See the book "Computer Graphics, Principles and Practice" (1990) or
"Hypertexture" by Ken Perlin in ACM SIGGRAPH Computer Graphics 23, July
1989.


    Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Christopher James Huff
Subject: Re: sphere memory
Date: 4 Sep 2002 20:13:30
Message: <chrishuff-717D8A.20125204092002@netplex.aussie.org>
In article <3d75ef48@news.povray.org>,
 "Thorsten Froehlich" <tho### [at] trfde> wrote:

> > I'm not sure what "hypertextures" are
> 
> See the book "Computer Graphics, Principles and Practice" (1990) or
> "Hypertexture" by Ken Perlin in ACM SIGGRAPH Computer Graphics 23, July
> 1989.

I'll look for those, but my chances of finding them are slim. Any web 
sites or online papers?

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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

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