POV-Ray : Newsgroups : povray.general : Duplicate ? Server Time
5 Aug 2024 08:26:39 EDT (-0400)
  Duplicate ? (Message 17 to 26 of 26)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: ABX
Subject: Re: Duplicate ?
Date: 25 Nov 2002 03:35:36
Message: <cun3uukglfb2mnsf7trmtlnsm9amtpissu@4ax.com>
On 24 Nov 2002 12:02:23 -0500, "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:
> 2. add new syntax :
>   duplicate { ... } 
> that will work in same way as 
>   object {... }
> but will re-use memory

That's near top on my TODO and perheps will be realised this year.
Check http://news.povray.org/povray.binaries.images/14001/

ABX


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: Duplicate ?
Date: 25 Nov 2002 09:25:25
Message: <Xns92D19C56FF14Braf256com@204.213.191.226>
Warp <war### [at] tagpovrayorg> wrote in news:3de1dbc6@news.povray.org

>   Have you ever heard of #while-loops? They are handy, you know...
> #while(Xpos < 100)
>   #while(Zpos < 100)
>     object { GrassPatch translate <Xpos, 0, Zpos> }
>   Magically you get 100*100 instances 

...and copy of mesh[1] for each loop-pass (100*100 copies in RAM).

Your sarcasm was quite stupid, if You would read first post(s) carfule You 
will notice that techinque described above is exacly what i'm doing now, 
but that I'm searching for more memory-saving idea.

[1] mesh data = bounding box etc. Ofcourse list of triangles wectors is not 
replicated, but still even bounding boxes.

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Warp
Subject: Re: Duplicate ?
Date: 25 Nov 2002 10:01:55
Message: <3de23b63@news.povray.org>
Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
> ...and copy of mesh[1] for each loop-pass (100*100 copies in RAM).

  10000 copies does not sound like extremely memory-intensive.
  How much memory does one copy need? Even if it required, let's say,
1 kilobyte, that would only require about 10 megabytes, far less than
the 500 megabytes you were talking about. And the copies probably need
far less than 1 kilobyte.

  If you want less memory consumption, then make the mesh patch larger
and make less copies. If you, for example, make the mesh patch twice as
large in both axes and then make 50*50 copies, that's only 2500 copies
instead of 10000. The memory requirement for the copies dropped by 3/4.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Duplicate ?
Date: 25 Nov 2002 10:14:46
Message: <20021125161445.2dba7058.jaimevives@ignorancia.org>
On 24 Nov 2002 12:02:23 -0500
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> 
> I have following problem - I want to cover large area (about 1000x1000
> 
> units) by grass, each grass "leaf" tooks about 1 unit space on ground,
> so I wolud need about 1 mln leafs. 
> Each leaf is build from about 500 triangles, with gives 500,000,000 
> triangles - way to much to hold in memory.
> 
> So I thinked of optimisation :
> 1. every grass leaf is a mesh
> 2. organise 10x10 leafs into an union like GrassBlock
> 3. cover area (flat land) with same GrassBlock object
> 
> problem is with step #3 - each :
>   object { GrassBlock translate <X,0,Z> }
> results in duplicating GrassBlock in memory - so no memroy is saved as
> I aspected.

  I had a similar problem with this scene:

    http://www.ignorancia.org/images/marjal.jpg 

  and the less consuming solution was to actually move the
transformations from the grass patchs to the individual triangles, so
you can get a whole mesh for every grass patch, and then you can make a
union of these (with few but bigger meshes). Not that good as the
posibility of nesting meshes, but feasible, and the only solution that
worked for my 512MB.


-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: Duplicate ?
Date: 25 Nov 2002 10:48:51
Message: <Xns92D1AA7C8FFB5raf256com@204.213.191.226>
Warp <war### [at] tagpovrayorg> wrote in news:3de23b63@news.povray.org

> Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
>> ...and copy of mesh[1] for each loop-pass (100*100 copies in RAM).
>   10000 copies does not sound like extremely memory-intensive.
>   How much memory does one copy need? Even if it required, let's say,
[...]

look at p.b.i - Trees[WIP] uses about 800 MB memoty while rendering (no 
radiosity/photons), without grass same scene uses about 50 MB


> and make less copies. If you, for example, make the mesh patch twice as
> large in both axes and then make 50*50 copies, that's only 2500 copies

I will try but IMHO size of boxes wan't change anything while 1 path is NOT 
a mesh, only 1 grass pice is a mesh.
So grass-field always has same number of mashes, both :
1000*1000 pathes = 1000*1000 *  10* 10 meshes
 100* 100 pathes =  100* 100 * 100*100 meshes

It WOULD be ony i.e. 100*100 MESHES if only syntax 
mesh {
  mesh { ... }
  mesh { ... }
  transform
}

would be allowed - as explained in other posts

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Christopher James Huff
Subject: Re: Duplicate ?
Date: 25 Nov 2002 12:20:33
Message: <chrishuff-A7C9ED.12180425112002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> I will try but IMHO size of boxes wan't change anything while 1 path is NOT 
> a mesh, only 1 grass pice is a mesh.

Well, as you have already been told, make each patch a mesh. It doesn't 
require any patching or new features, you just need to construct things 
a little differently.

-- 
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: Rafal 'Raf256' Maj
Subject: Re: Duplicate ?
Date: 25 Nov 2002 12:45:51
Message: <Xns92D1BE53324FBraf256com@204.213.191.226>
Christopher James Huff <chr### [at] maccom> wrote in
news:chr### [at] netplexaussieorg 

as I alread told, I know it, but it needs quite un-comfortable work around.
I must repleace

union {
  //...
  mesh {triangle{a,b,c} triangle{d,e,f} triangle{g,h,i} rotate A }
  //...
  mesh {triangle{a,b,c} triangle{d,e,f} triangle{g,h,i} rotate B }
  //...
  mesh {triangle{a,b,c} triangle{d,e,f} triangle{g,h,i} rotate C }
  rotate X
}

with

mesh {  
  //...
  triangle{vrotate(a,A),vrotate(b,A),vrotate(c,A)}
  triangle{vrotate(d,A),vrotate(e,A),vrotate(f,A)}
  triangle{vrotate(g,A),vrotate(h,A),vrotate(i,A)}
  //...
  triangle{vrotate(a,B)//.....
  triangle{vrotate(d,B)//.....
  triangle{vrotate(g,B)//.....
  //...
  triangle{vrotate(a,C)//.....
  triangle{vrotate(d,C)//.....
  triangle{vrotate(g,C)//.....
  rotate X
}

not to mention scale and translate in every triangel.

I hnow this is possible, but I suggest to make it more comfortable.



-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Christopher James Huff
Subject: Re: Duplicate ?
Date: 25 Nov 2002 13:26:49
Message: <chrishuff-BCD637.13242125112002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> as I alread told, I know it, but it needs quite un-comfortable work around.
> I must repleace

A simple macro would make things easier:

#macro Tri(PA, PB, PC, Trans)
    #local TransFn = function {transform {Trans}}
    triangle {
        TransFn(PA.x, PA.y, PA.z),
        TransFn(PB.x, PB.y, PB.z),
        TransFn(PC.x, PC.y, PC.z)
    }
#end

mesh {
    #declare BladeTrans = transform {...}
    Tri(A, B, C, BladeTrans)
    Tri(A, B, C, BladeTrans)
    Tri(A, B, C, BladeTrans)
...
}

Again, no need for a new feature, you just don't know how to use the 
existing features properly.

-- 
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: Warp
Subject: Re: Duplicate ?
Date: 26 Nov 2002 04:28:03
Message: <3de33ea3@news.povray.org>
This can be made even easier if you put the data inside an array and
then create the mesh from it. This avoids repetition of calling the macro
and giving it the same transformation each time (you can call the macro
only at one line inside a loop).

  (Of course you will save a lot of space if you store the vertices and
triangle indices separately, as in the mesh2 format, but that's another
story.)

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Tim Nikias
Subject: Re: Duplicate ?
Date: 27 Nov 2002 03:06:58
Message: <3de47d22@news.povray.org>
I think the problem is that you're placing the triangles
in a mesh and rotating the mesh. Why not use vrotate
and rotate the edges, then place tons of triangles
into a mesh? I think it would be worth the effort it
you corrected this memory-consumptious technique
you're using. But that's just my 2 cents worth.

I've made a mesh-grass-macro myself. It creates a set
of 2D Arrays with vector-positions, which represent the
edge-data for a single grass-blade (of which several are
calculated). Then, these are loaded into a 3D Array and,
using vrotate and mutliplying with floats, changed in size
and orientation. After all that, the 3D Array is "parsed"
with a macro which places appropriate triangles, and
then this little bush of grass is saved to disk. In this manner,
I mostly create 20 blades, take a selection of 15 per bush,
and make 5 bushes = 5 meshes. Since they're base size
is a circle, I can just randomly rotate them around the
y-axis, place hundreds of them, and use little memory (though
tracing time goes up, but no wonder, with hundreds of
objects, eh?).

Regards,
Tim

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde

>   This can be made even easier if you put the data inside an array and
> then create the mesh from it. This avoids repetition of calling the macro
> and giving it the same transformation each time (you can call the macro
> only at one line inside a loop).
>
>   (Of course you will save a lot of space if you store the vertices and
> triangle indices separately, as in the mesh2 format, but that's another
> story.)
>


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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