|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi.
I have a question for you, well, I'm developing a ray-tracing program and
I need help with the aspect of the memory allocation. I define my objects in
special structures, each object is allocated in memory dynamically, you
know, with memalloc and free, but the question is: How can I optimize this?,
I want to use the less memory possible, because with objects like mesh or
series of thousand objects consumes a lot of RAM memory, I don't know how
POV-Ray uses the memory to its objects, but certainly it can trace scenes
with a lot of complex objects without problem...
Should I put everything in memory?, primitives, mesh, textures, etc. or
exist a technique to use more efficiently my resources.
Thanks for your time and patience.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
You didn't mention the programming language you are using ('memalloc' is
not a C nor C++ function; at least not a standard one).
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Sorry, malloc is the function, I'm writting my program in C, but what I want
to know is the Algorithm or procedure to distribute the memory, for example:
sphere needs 3 coordinates for the center and a radius, each variable takes
4 bytes of memory, well, I need 16 bytes for a sphere, but for a box I need
24 bytes...
sphere 16 bytes
box 24 bytes
cone 28 bytes
cylinder 28 bytes
plane 16 bytes
torus 8 bytes
this are without transformations, they need more memory, that's the problem,
my memori not is infinite
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
majucatur wrote:
> Hi.
>
> I have a question for you, well, I'm developing a ray-tracing program and
> I need help with the aspect of the memory allocation. I define my objects in
> special structures, each object is allocated in memory dynamically, you
> know, with memalloc and free, but the question is: How can I optimize this?,
> I want to use the less memory possible, because with objects like mesh or
> series of thousand objects consumes a lot of RAM memory, I don't know how
> POV-Ray uses the memory to its objects, but certainly it can trace scenes
> with a lot of complex objects without problem...
>
> Should I put everything in memory?, primitives, mesh, textures, etc. or
> exist a technique to use more efficiently my resources.
If you want to render more geometry than fits into memory, then only
option is to cache it (if you don't want to leave it to op. sys. swapping).
One paper I know about it could be found:
http://graphics.stanford.edu/papers/displace/
Google should help in finding similar papers.
Other option is to optimize geometry. Latest Siggraph papers ('00 IIRC)
have number of various optimizations described.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
majucatur <maj### [at] yahoocom> wrote:
> sphere needs 3 coordinates for the center and a radius, each variable takes
> 4 bytes of memory, well, I need 16 bytes for a sphere, but for a box I need
> 24 bytes...
So in 10 Megs of memory you can store almost 437000 boxes. I don't see
the problem.
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> box 24 bytes
so you use only 4 bytes for the float number storage?
IMHO a box needs 6 float parameters to be defined...
regards
SY
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> IMHO a box needs 6 float parameters to be defined...
In fact, 2 is enough. See the box syntax for an example. (Of course with
2 floats it's axis-aligned, but that doesn't matter; the transformations of
a box are not made by moving its vertices anyways.)
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 4 Mar 2002 11:52:27 -0500, Warp wrote:
>> IMHO a box needs 6 float parameters to be defined...
>
> In fact, 2 is enough. See the box syntax for an example. (Of course with
> 2 floats it's axis-aligned, but that doesn't matter; the transformations of
> a box are not made by moving its vertices anyways.)
floats or vectors?
--
#macro R(P)z+_(P)_(P)_(P+1)_(P+1)+z#end#macro Q(C,T)bicubic_patch{type 1u_steps
6v_steps 6R(1)R(3)R(5)R(7)pigment{rgb z}}#end#macro _(Y)#local X=asc(substr(C,Y
,1))-65;<T+mod(X,4)div(X,4)9>-2#end#macro O(T)Q("ABEFUQWS",T)Q("WSXTLOJN",T)#
end O(0)O(3)Q("JNKLCGCD",0)light_source{x 1}// ron### [at] povrayorg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> In fact, 2 is enough. See the box syntax for an example. (Of course with
> 2 floats it's axis-aligned, but that doesn't matter; the transformations
of
> a box are not made by moving its vertices anyways.)
how do you define a box with 2 floats? even length, height and depth would
already need 3!
regards
SY
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ron Parker <ron### [at] povrayorg> wrote:
> floats or vectors?
Floats. (Of course that will create a cube, but as I said, transformations
can make it a box of any shape, and place and orient it in any way.)
Thinking about it, it actually doesn't need any floats at all. Just
create a unit-cube by default and let the transformations do the rest.
So in fact it requires 0 floats.
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|