POV-Ray : Newsgroups : povray.newusers : Setting a scene inside a box Server Time
1 Nov 2024 00:24:32 EDT (-0400)
  Setting a scene inside a box (Message 1 to 3 of 3)  
From: Dror Atariah
Subject: Setting a scene inside a box
Date: 16 Feb 2012 04:05:01
Message: <web.4f3cc5b44c180f1bccae74d00@news.povray.org>
I would like to set a scene inside a box, such that its faces will consist of
grid lines and will be transparent. That is, if the camera is INSIDE the box, it
will see something which is outside and vice versa.

This is the best I could get:

//-----------

#include "textures.inc"
camera {
 perspective
 location < 4.0, 4.0, 12>
 right x * 1
 up y * 3/4
 angle 60
 look_at < 0.0, 0.0, 0.0>
}

light_source {
 < 0.0, 100, 100>
 rgb <0.999962, 1.000000, 1.000000>
}

box {
 < -2, -2, -2>, <2,2,2>
// no_shadow
 hollow on
// pigment {
//  rgb <0.000000, 0.202852, 1.000000>
// }
 pigment {
        Tiles_Ptrn()
        color_map{
         [0.02 color rgb <1,1,1>]   // white stanchions
  [0.04 color rgbt <0,0,0,1>]  // black spaces
        }
        rotate z*90  // rotates the pattern onto the "upper side" of the plane
 }
}

sphere {
 <0.0, 0.0, 0.0>, 0.5
 material {
  texture {
   pigment {
    rgb <0.000000, 0.202852, 1.000000>
   }
   normal {
    brick 0.5 //amount
   }
   finish {
    diffuse 0.6
    brilliance 1.0
   }
  }
 }
}
//--------

How can I finish it?


Post a reply to this message

From: Dror Atariah
Subject: Re: Setting a scene inside a box
Date: 16 Feb 2012 07:35:01
Message: <web.4f3cf7a5bf141a6dccae74d00@news.povray.org>
This is what I managed to produce:
//-------------
#include "textures.inc"

/*
Bounding box's corners
*/
#local xmin=-5;
#local ymin=-5;
#local zmin=0;
#local xmax=8;
#local ymax=9.2;
#local zmax=2*pi;

/*
zMax grid
*/
object{
 plane { <0,0,1>,zmax
  pigment {
   Tiles_Ptrn()
   color_map{
    [0.02 color rgb <1,1,1>]   // white stanchions
    [0.04 color rgbt <0,0,0,1>]  // black spaces
   }
   rotate z*90  // rotates the pattern onto the "upper side" of the plane
  }
 }
 no_shadow
 clipped_by{
  box{
   <xmin,ymin,zmin>, <xmax,ymax,zmax>
  }
 }
}

/*
zMin grid
= floor
*/
object{
 plane { <0,0,1>,zmin
  pigment {
   // Pattern color
   Tiles_Ptrn()
   color_map{
    [0.02 color rgb <0,0,0>]   // white stanchions
    [0.04 color rgbt <0,0.51,1,0.5>]  // black spaces
   }
   rotate z*90  // rotates the pattern onto the "upper side" of the plane
// Fixed Color
//   color rgbt<0,0.51,1,0.5>
//   rotate z*90  // rotates the pattern onto the "upper side" of the plane
  }
 }
 no_shadow
/*
Clipping here had to be removed in order to avoid some probelm with color
rendering
*/
// clipped_by{
//  box{
//   <xmin,ymin,zmin>,<xmax,ymax,zmax>
//  }
// }
}


object{
 plane { <1,0,0>,xmax
  pigment {
   Tiles_Ptrn()
   color_map{
    [0.02 color rgb <1,1,1>]   // white stanchions
    [0.04 color rgbt <0,0,0>]  // black spaces
   }
   rotate y*90  // rotates the pattern onto the "upper side" of the plane
  }
 }
 no_shadow
 clipped_by{
  box{
   <xmin,ymin,zmin>,<xmax,ymax,zmax>
  }
 }
}

object{
 plane { <1,0,0>,xmin
  pigment {
   Tiles_Ptrn()
   color_map{
    [0.02 color rgb <1,1,1>]   // white stanchions
    [0.04 color rgbt <0,0,0>]  // black spaces
   }
   rotate y*90  // rotates the pattern onto the "upper side" of the plane
  }
 }
 no_shadow
 clipped_by{
  box{
   <xmin,ymin,zmin>,<xmax,ymax,zmax>
  }
 }
}

object{
 plane { <0,1,0>,ymax
  pigment {
   Tiles_Ptrn()
   color_map{
    [0.02 color rgb <1,1,1>]   // white stanchions
    [0.04 color rgbt <0,0,0>]  // black spaces
   }
   rotate x*90  // rotates the pattern onto the "upper side" of the plane
  }
 }
 no_shadow
 clipped_by{
  box{
   <xmin,ymin,zmin>,<xmax,ymax,zmax>
  }
 }
}

object{
 plane { <0,1,0>,-5
  pigment {
   Tiles_Ptrn()
   color_map{
    [0.02 color rgb <1,1,1>]   // white stanchions
    [0.04 color rgbt <0,0,0>]  // black spaces
   }
   rotate x*90  // rotates the pattern onto the "upper side" of the plane
  }
 }
 no_shadow
 clipped_by{
  box{
   <xmin,ymin,zmin>,<xmax,ymax,zmax>
  }
 }
}
//---------------

It is not perfect, and slows down the rendering... but this is what I have. Can
anyone improve it?


Post a reply to this message

From: Le Forgeron
Subject: Re: Setting a scene inside a box
Date: 17 Feb 2012 12:50:17
Message: <4f3e9359$1@news.povray.org>
Le 16/02/2012 10:00, Dror Atariah nous fit lire :
> I would like to set a scene inside a box, such that its faces will consist of
> grid lines and will be transparent. That is, if the camera is INSIDE the box, it
> will see something which is outside and vice versa.

Drop the idea of painting a real box which does not exit.
Use cylinder{} objects for your lines around the virtual cube.

At worst, if you really want flat grid line, you can put the whole
collection of cylinder into a an union{} and apply a
difference/intersection{} of that union with a smaller and a bigger box
(one of them being inversed)

Have a look at #while/#for (if using povray 3.7RC3 or 4) to loop a bit.


Post a reply to this message

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