POV-Ray : Newsgroups : povray.newusers : getting the table's shadows on the wall : Re: and a door to open Server Time
5 Sep 2024 06:13:26 EDT (-0400)
  Re: and a door to open  
From: Bob H 
Date: 12 Sep 2001 21:01:33
Message: <3ba0056d@news.povray.org>
"Wade" <Zav### [at] aolcom> wrote in message
news:3b9fe8e2$1@news.povray.org...
>  How do I create a doorway with a
> partly-closed door allowing some light in?

Ahhh, the wonders of CSG...

With the room script I last saw you'd need to put difference {} around the
wall the door is to be.  Also place the texture into the end of that
'difference' so that the door frame shows as a color.  But you can also put
a new texture into the box used for the doorway cutout too.

Basically:

// left wall
difference {
  box { // wall
         <-2,-1,-6>,<2,1,6>
         scale <0.1,1,1>
  }
  box { // doorway cutout
         <-0.21,-1,-3>,<0.21,0.7,-2>
  }
 texture {pigment {rgb <1,1,1>}}
  translate <2,0,0>
}

I'm just guessing at dimensions and placement here, you'll want to change
those.
I must point out something about the way you are going about your scene.
There doesn't seem to be any real world units used, i.e. meters, feet,
yards, etc.  That makes it difficult to accumulate the scene because you
always have to reference at least some part of it to know where and what
size things will be.

Anyway, notice that the scaled wall box is at 0.2 POV units along +/- x,
making it 0.4 total thickness, then the doorway box is a couple hundredths
thicker so it will complete the CSG correctly.  As well as being postioned
from floor (-1*y) to near ceiling but not quite (+0.7*y) and a width of 1
unit along z.

Apologies if I'm explaining what you already knew or even if you can't
follow me easily.

This should be the idea you asked about as far as creating the doorway.  To
make the door and it be ajar (opened a little) there is a little more to it.
Really actually simple though.  You make the box (with texture added) so one
side where the hinges would be is along 0*y.  Something like: box
{<0,-1,0>,<0.1,0.7,1>} where the 0*x and 0*z axes are the pivot plane
(corner edge of door).  Add rotate -15*y to the box statement for the amount
of open/close.  Finally translate into place where the doorway is, in this
example it would be at <1.8,0,-3>, since the cutaway was put at <1.8,-1,-2>
to <2.2,0.7,-3> (so -2 to -3 * z is door width and position) and the door
itself goes from zero to one z.

Hinges would be inside room in this case, toward +z, and door opens on
the -z side into room.  Adding clock to the rotation for animation, or just
a predeclared variable, makes it easy to change the door movement.

Since you used a +z placed camera last I saw this opens the door so light
outside wouldn't go toward the table and back wall though so you'll need to
turn that all around.  Sorry.  I'm getting confused.  I'm not trying this as
I go, just writing it here so be aware this could be faulty.

Basically you can see how it matters a whole lot how you go about setting it
all up from the beginning.  The door could be placed into a union of the
difference so that when translating it to the right or left it all goes
together rather than piecing it in later.  Obviously it's all something
individual people must learn to do in their own way.

Bob H.


Post a reply to this message

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