POV-Ray : Newsgroups : povray.newusers : Prism and CSG difference operation Server Time
29 Jul 2024 08:20:14 EDT (-0400)
  Prism and CSG difference operation (Message 1 to 3 of 3)  
From: JPU
Subject: Prism and CSG difference operation
Date: 13 May 2006 03:25:00
Message: <web.44658966644d0aa43edeae360@news.povray.org>
Hello,

 I have just started using POV-Ray and I want to use it for visualising
architectural indoor scenes. Currently, I am defining geometries of rooms,
and the idea is to use the PRISM solid object to define the basic room
geometry.

 Therefor I create prisms with two polygons (the outer and inner surfaces of
the walls), where one polygon contains the other one (I have a sample scene
with the effect attached at the bottom of the message):

#declare lv_room_walls = prism {
linear_sweep
linear_spline
0,   // sweep the following shape from here ...
2.2, // height of room is 2.2m
20,  // num of inner an outer points
<-0.5, 0.2>, <2.9, 0.2>, <3, -8.7>, <-2.92, -8.7>, <-2.92, -4.6>, <-4.5,
-4.6>, <-4.5, -4.5>, <-0.5, -4.4>, <-0.5, -0.5>     // outer wall
<0,0>,<2.7,0>, <2.7,-4.25>, <2.43,-4.25>, <2.18,-8.45>, <-2.62, -8.45>,
<-2.62, -4.8>, <-0.3, -4.7>, <-0.25, -0.3>, <0,-0.25>,<0,0> // inner wall
}

 This works fine. However, cutting out windows or doors using the CSG
difference operations with a box does not result in a solid object. The
locations of the door- and window-frames show the two sufaces<of the prism,
and an empty space between them.

 Is this the expected behaviour? Is there a possibility, to make the
resulting CSG appear as a solid object?

 Any help and any best practices for defining indoor architectural scenes
are highly welcome.

 Thank in advance for your suggestions&help.

 Best regards,

 Jan.

--------
#include "textures.inc"
#include "sunpos.inc"

global_settings {
        radiosity {
                pretrace_start 0.08
                pretrace_end   0.01
                count 80
                nearest_count 5
                error_bound 0.7
                recursion_limit 3
                low_error_factor 0.8
                gray_threshold 0
                minimum_reuse 0.015
                brightness 1.5
                adc_bailout 0.01/2
        }
}


// sky sphere
sphere {
          0, 1000
          pigment { color <0.7, 0.7, .9>
                     } // end of pigment
          finish {
                ambient 1
                diffuse 0
          }
}


camera {
        location <2.4, 1.8, -3.1>
        look_at <-2, 1.5, -8.45>
        angle 63
}


#declare global_diffuse= .8;

light_source {
      //SunPos(2000, 6, 21, 11, 30, 0, 51.4667, 0.00)
      <1.6, 1.2, -14>
      rgb <1,1,.9>
   }

#declare lv_room_walls = prism {
linear_sweep
linear_spline
0,   // sweep the following shape from here ...
2.2, // height of room is 2.2m
20,  // num of inner an outer points
<-0.5, 0.2>, <2.9, 0.2>, <3, -8.7>, <-2.92, -8.7>, <-2.92, -4.6>, <-4.5,
-4.6>, <-4.5, -4.5>, <-0.5, -4.4>, <-0.5, -0.5>     // outer wall
<0,0>,<2.7,0>, <2.7,-4.25>, <2.43,-4.25>, <2.18,-8.45>, <-2.62, -8.45>,
<-2.62, -4.8>, <-0.3, -4.7>, <-0.25, -0.3>, <0,-0.25>,<0,0> // inner wall
}

difference {
          object {lv_room_walls
                pigment {color rgb 1}
                finish {
                        ambient 0
                        diffuse global_diffuse
                  }
          }

          /* window */
          box {
                <-2.619, 0.7, -7.65>
                <-2.921, 2, -6.15>
          }



          /* rear door */
          box {
                <1.38, 0.001, -8.449>
                <-0.62, 2.05, -8.701>
          }

}


Post a reply to this message

From: Roman Reiner
Subject: Re: Prism and CSG difference operation
Date: 13 May 2006 03:35:01
Message: <web.44658ba6ec628ebbb5ef244d0@news.povray.org>
What you see is not an empty space between the prismsurfaces but the
textures of the boxes namely the default texture which is black. if you
apply a texture to the boxes that is the one that will show up on that
location. If you want everything to have the same texture apply the texture
to the whole csg instead of texturing every object individually. This saves
memory and rendering time.

Here's the updated version:

#include "textures.inc"
#include "sunpos.inc"

global_settings {
        radiosity {
                pretrace_start 0.08
                pretrace_end   0.01
                count 80
                nearest_count 5
                error_bound 0.7
                recursion_limit 3
                low_error_factor 0.8
                gray_threshold 0
                minimum_reuse 0.015
                brightness 1.5
                adc_bailout 0.01/2
        }
}


// sky sphere
sphere {
          0, 1000
          pigment { color <0.7, 0.7, .9>
                     } // end of pigment
          finish {
                ambient 1
                diffuse 0
          }
}


camera {
        location <2.4, 1.8, -3.1>
        look_at <-2, 1.5, -8.45>
        angle 63
}


#declare global_diffuse= .8;

light_source {
      //SunPos(2000, 6, 21, 11, 30, 0, 51.4667, 0.00)
      <1.6, 1.2, -14>
      rgb <1,1,.9>
   }

#declare lv_room_walls = prism {
linear_sweep
linear_spline
0,   // sweep the following shape from here ...
2.2, // height of room is 2.2m
20,  // num of inner an outer points
<-0.5, 0.2>, <2.9, 0.2>, <3, -8.7>, <-2.92, -8.7>, <-2.92, -4.6>, <-4.5,
-4.6>, <-4.5, -4.5>, <-0.5, -4.4>, <-0.5, -0.5>     // outer wall
<0,0>,<2.7,0>, <2.7,-4.25>, <2.43,-4.25>, <2.18,-8.45>, <-2.62, -8.45>,
<-2.62, -4.8>, <-0.3, -4.7>, <-0.25, -0.3>, <0,-0.25>,<0,0> // inner wall
}

difference {
          object {lv_room_walls
          }

          /* window */
          box {
                <-2.619, 0.7, -7.65>
                <-2.921, 2, -6.15>
          }



          /* rear door */
          box {
                <1.38, 0.001, -8.449>
                <-0.62, 2.05, -8.701>
          }
          pigment {color rgb 1}
                finish {
                        ambient 0
                        diffuse global_diffuse
                  }
}

Regards Roman


Post a reply to this message

From: JPU
Subject: Re: Prism and CSG difference operation
Date: 13 May 2006 04:40:00
Message: <web.44659b19ec628ebb3edeae360@news.povray.org>
Roman,

 thanks a lot for your help! The scene now renders the way I wanted.

 Best regards,

 Jan.


Post a reply to this message

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