|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
I want to have a thin box (or plate) with a lot of equaly spaced holes inside.
Basically I know how to do it and it already worked, but I needed ~17min to
render the picture, so I hope there is a better (faster) way to reach my goal.
Here is what I did:
----------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#declare i=0; //just two counters
#declare j=0;
//here follows the box:
#declare pure_table=box{<0,0,0>, <-362, 1, 150>
texture{
pigment{color rgb<0.7,0.7,0.7>}
normal{wrinkles scale 0.02}
finish{phong 1.0 phong_size 120 metallic reflection 0.3 brilliance 2}
}
};
//one Hole is defined here:
#declare hole=sphere{<0,0.5,0>,0.7 pigment{color Black}};
//just a few constants
#declare hole_xoffset=4.75;
#declare hole_zoffset=3.75;
#declare holes_x=141;
#declare holes_z=57;
//this is the macro that gives me all the holes I want to have;
#macro all_holes()
union{#while(i< holes_x)
#while(j<holes_z)
object{hole translate <-hole_xoffset-i*2.5,0,hole_zoffset+j*2.5>}
#declare j = j + 1;
#end
#declare j=0;
#declare i =i + 1;
#end}
#end
//here I draw the difference between the table and the holes:
difference{object{pure_table}
object{all_holes()}}
//top-view camea
camera {
location <-180, 90, 75>
look_at <-160, 0, 70>
}
light_source {
<-300, 90, 75>
color White
}
/*this light source is just the test for me to see, if the holes are really
through the table*/
light_source {
<-300,-70,75>
color Blue
}
plane{<0,1,0>,-100
pigment{
gradient x
color_map{
[0.8 rgb<0.9,0.9,0.9> ]
[1.0 rgb<0.5,0.5,0.5> ]
}
turbulence 1
}
}
---------------------------------------------------------------
Another thing I tried was not to have the macro but a normal definition
---------------
#declare all_holes=#while ...... #end
-------------
My Problem with this solution was, that I alway got error messages from the
POVRay-Parser when I ended the line with a ";"
But without the ";" all the spheres were actually drawn which is the complete
opposite from the thing I want to have.
Only the rendering time was very short....
Every advice or comment is appreciated.
Thanks
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"McMinty" <nomail@nomail> wrote in message
news:web.4a621451d328db22dc80fc610@news.povray.org...
> Hi,
>
> I want to have a thin box (or plate) with a lot of equaly spaced holes
> inside.
>
> Basically I know how to do it and it already worked, but I needed ~17min
> to
> render the picture, so I hope there is a better (faster) way to reach my
> goal.
>
It turns out to be a lot quicker to create a small block with a hole in it
and assemble those blocks.
Mike Williams has written up a choice of solutions to this problem at
http://www.econym.demon.co.uk/holetut/index.htm
> ... snip ...
> Another thing I tried was not to have the macro but a normal definition
>
> ---------------
> #declare all_holes=#while ...... #end
> -------------
>
> My Problem with this solution was, that I alway got error messages from
> the
> POVRay-Parser when I ended the line with a ";"
> But without the ";" all the spheres were actually drawn which is the
> complete
> opposite from the thing I want to have.
> Only the rendering time was very short....
>
To declare your holes in this way you would still need the 'union' statement
that you had in your macro. So you could do:
#declare all_holes = union{
#while
... add your objects into the union here ...
#end
} // end of union
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Chris B" <nom### [at] nomailcom> wrote:
> It turns out to be a lot quicker to create a small block with a hole in it
> and assemble those blocks.
> Mike Williams has written up a choice of solutions to this problem at
> http://www.econym.demon.co.uk/holetut/index.htm
I *think* it should also speed things up if you don't subtract individual holes,
but multiple unions of holes - or maybe even unions of unions of holes. The idea
is to enforce a nested hierarchy of bounding boxes this way, which is what's
actually missing with a difference containing hundreds of individual objects.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hi,
>
> I want to have a thin box (or plate) with a lot of equaly spaced holes inside.
>
> Basically I know how to do it and it already worked, but I needed ~17min to
> render the picture, so I hope there is a better (faster) way to reach my goal.
>
>
> Here is what I did:
>
> ----------------------------------------------------------------------------
> #include "colors.inc"
> #include "textures.inc"
>
> #declare i=0; //just two counters
> #declare j=0;
>
>
> //here follows the box:
> #declare pure_table=box{<0,0,0>, <-362, 1, 150>
> texture{
> pigment{color rgb<0.7,0.7,0.7>}
> normal{wrinkles scale 0.02}
> finish{phong 1.0 phong_size 120 metallic reflection 0.3 brilliance 2}
> }
> };
>
> //one Hole is defined here:
> #declare hole=sphere{<0,0.5,0>,0.7 pigment{color Black}};
You do this only if you want the sides of the holes to actualy be black.
Also, it's more effecient to apply any texture to an union rather that
to each of the components.
>
> //just a few constants
> #declare hole_xoffset=4.75;
> #declare hole_zoffset=3.75;
> #declare holes_x=141;
> #declare holes_z=57;
>
>
> //this is the macro that gives me all the holes I want to have;
> #macro all_holes()
> union{#while(i< holes_x)
> #while(j<holes_z)
> object{hole translate <-hole_xoffset-i*2.5,0,hole_zoffset+j*2.5>}
> #declare j = j + 1;
> #end
> #declare j=0;
> #declare i =i + 1;
> #end
If you want a distinct texture for the holes, add it here.
> }
> #end
>
> //here I draw the difference between the table and the holes:
> difference{object{pure_table}
> object{all_holes()}}
>
>
> //top-view camea
> camera {
> location <-180, 90, 75>
> look_at <-160, 0, 70>
> }
>
>
> light_source {
> <-300, 90, 75>
> color White
> }
>
>
> /*this light source is just the test for me to see, if the holes are really
> through the table*/
> light_source {
> <-300,-70,75>
> color Blue
> }
>
> plane{<0,1,0>,-100
> pigment{
> gradient x
> color_map{
> [0.8 rgb<0.9,0.9,0.9> ]
> [1.0 rgb<0.5,0.5,0.5> ]
> }
> turbulence 1
> }
> }
>
> ---------------------------------------------------------------
>
>
> Another thing I tried was not to have the macro but a normal definition
>
> ---------------
> #declare all_holes=#while ...... #end
> -------------
>
> My Problem with this solution was, that I alway got error messages from the
> POVRay-Parser when I ended the line with a ";"
> But without the ";" all the spheres were actually drawn which is the complete
> opposite from the thing I want to have.
> Only the rendering time was very short....
>
>
> Every advice or comment is appreciated.
>
> Thanks
>
>
Normaly, in that case, the best way is to first declare a small box with
a single hole.
Then, you assemble many of those small box with a single hole into a
large composite object.
Things to do and dont do:
Don't apply any texture to your small boxes, nor to the object used to
make the hole.
Do apply the texture to the complete usion.
Why this is way faster:
When you use a difference where you remove a large number of objects
from a single one, the bounding becomes VERY ineficient. For each ray
that can encounter your object, the base object and each and every holes
must be tested.
When you use many small components in an union, each small box-hole
component have it's own bounding, and you only have to test very few
components for each ray. This will save you a conciderable amount of time.
Question of "style": you should always use an opper-case character as
the first character of any user defined variable.
"x", "y", "z", "t", "clock", "gray", "grey" where once not reserved
variables names. When they became reserved, it played havok with many
scenes that used them as user variables...
Who know, "i", "j", "k" may become reserved at some time.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hey,
thanks for all the comments and helpful tips.
It helped me a lot.
cu
Mcminty
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|