|
|
Hi all,
I am working on a macro to generate tiled floors (or walls) and stumbled on
a problem I had before. When using superellipsoids I get strange black
strips on certain tiles (in the example you can see them on the centered
tiles).
Does anyone have an idea what causes this and how I can get rid off it?
Here's the code:
camera
{
location <0, 6, -20>
look_at <0, 0, 0>
right x * image_width / image_height
}
global_settings
{
ambient_light rgb <1, 1, 1>
}
#declare singleTile =
difference
{
superellipsoid
{
<0.2, 0.2>
}
box
{
<-1.2, -1.6, -1.2> <1.2, 0.8, 1.2>
}
translate <0, -0.8, 0>
scale <0.5, 0.5, 0.5>
}
sky_sphere
{
pigment
{
gradient y
color_map
{
[0.0 rgb <1, 1, 1>]
[0.2 rgb <0.8, 0.9, 1.0>]
[0.5 rgb <0.6, 0.7, 1.0>]
[0.8 rgb <0.8, 0.9, 1.0>]
[1.0 rgb <1, 1, 1>]
}
}
}
light_source
{
0 * x
color rgb <1,1,1>
translate <-20, 40, -20>
}
plane
{
y, 0
pigment
{
rgb 1
}
}
#macro tiledFloor(tileWidth, tileDepth, tileSpace, xTiles, zTiles,
isCentered)
#declare zPos = 0;
#if (isCentered = 1)
#declare xCenter = ((tileWidth + tileSpace) * xTiles) * -0.5;
#declare zCenter = ((tileDepth + tileSpace) * zTiles) * -0.5;
#else
#declare xCenter = 0;
#declare zCenter = 0;
#end
#while (zPos < (xTiles * (tileDepth + tileSpace)))
#declare xPos = 0;
#while (xPos < (xTiles * (tileWidth + tileSpace)))
object
{
singleTile
pigment
{
rgb <0.8, 0.9, 1.0>
}
scale <tileWidth, 1, tileDepth>
translate <xCenter + xPos, 0, zCenter + zPos>
}
#declare xPos = xPos + (tileWidth + tileSpace);
#end
#declare zPos = zPos + (tileDepth + tileSpace);
#end
#end
tiledFloor(12, 12 , (3/8), 10, 10, 1)
Have a fine day, nUMBc
------------------------------------------------------------------------------
We don't stop playing because we get old; We get old, because we stop
playing!
Post a reply to this message
Attachments:
Download 'tiles001.jpg' (112 KB)
Preview of image 'tiles001.jpg'
|
|
|
|
Wasn't it nUMBc who wrote:
>Hi all,
>
>I am working on a macro to generate tiled floors (or walls) and stumbled on
>a problem I had before. When using superellipsoids I get strange black
>strips on certain tiles (in the example you can see them on the centered
>tiles).
>
>Does anyone have an idea what causes this and how I can get rid off it?
I could be wrong, but it might be related to this bit of the
superellipsoid documentation, even though your values aren't really what
I would call "very small".
Very small values of e and n might cause problems with the root
solver (the Sturmian root solver cannot be used).
You could make small changes to the values, <0.18, 0.2> seems to render
cleanly in this case, but the artefacts might possibly come back when
you move the camera.
Alternatively you could use the isosurface f_superellipsoid which uses a
different solver and doesn't seem to exhibit the problem.
In this particular case the isosurface superellipsoids render just as
fast as the CSG ones.
#include "functions.inc"
#declare singleTile =
isosurface {
function { - f_superellipsoid(x,y,z,0.2,0.2)}
contained_by {box {<-1,0.8,-1> <1,1,1>}}
max_gradient 1
translate <0, -0.8, 0>
scale <0.5, 0.5, 0.5>
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|