POV-Ray : Newsgroups : povray.newusers : Reflect light inside box : Re: Reflect light inside box Server Time
28 May 2024 16:01:33 EDT (-0400)
  Re: Reflect light inside box  
From: Alain
Date: 10 Dec 2012 21:26:38
Message: <50c699de@news.povray.org>

> I'm trying to draw a box, where the bottom half of the side of the box facing
> the light source is cut away, allowing the light to enter the box. I've tried
> using clipped_by and difference, and a few other things, but nothing is really
> working. Probably because I have no idea what I'm doing. Can someone provide
> some guidance?
>
> Thanks in advance.
>
> Rhonda
>
><code clipped>
>
>

Your box is solid. If you do a difference or intersection, the resulting 
shape is always closed.

You missuse the "hollow" keyword. It's a very common mistake. The 
purpose of hollow is to enable the existance of some media in the 
object. Otherwise, it have absolutely no effect. Also, the hollow, media 
containing object normaly need to be transparent so that the media is 
visible.

As have been said, clipped_by remove whatever is outside the clipping 
object. You can reverse that by using the "inverse" keyword that reverse 
the insideness of any object.

clipped_by{box{-1,1 inverse}} can be used to punch a hole in any object.
Here, {-1,1} is promoted to {<-1,-1,-1>,<1,1,1>}.

Your use of interior is OK.

When present, fresnel and metallic default to on. You don't need to 
explicitely specify it. They default to off when NOT present. metallic 
can use a float value from zero to whatever you want, but normaly no 
larger that 1.

Using color in the colors definitions and application is mostly a legacy 
thing and not needed.
pigment{ color Red } does exactly the same thing as pigment{ Red }.


Another thing you can do is to model a box with a thickness using a 
difference:

difference{
  box{< -10,  0,  0>,<10, 20,   20>}//outside of the box
  box{<-9.6,0.4,0.4><9.6,19.6,19.6>}//inside of the box
// the walls now have a thickness of 0.4 unit
  box{<-9,1,0.4>,<9,10,1 >}// the opening
  texture{pigment{rgb<0.1,1,0.2>}finish{reflection{0.3, 1 fresnel 
metallic}specular 1 roughness 0.1}
}

Now, the light comming into the opening will not actualy reflect in the 
box. The highlight will reflect, but not the incoming light. For that, 
you need to use the photons feature.
Add:

global_settings{photons{spacing 0.1}}
This turn on the photons feature.
You may also use count Value. Don't use both spacing and count.
With spacing, a small value increase the total number of photons shot. 
Small values increase the quality.
With count, you specify a target number of photons to shoot. Large value 
increase the quality.

In the object definition, add, just before the closing bracket:

photons{target reflection on}
This allow photons to be shot at the object and reflect off it.
As your object is not transparent, you can leave refraction to it's 
default of off.

You DON'T need to add any photons{} block to any light_source.

Now, another trick: Use the object pattern.
Change your texture as follow:
texture{
  object{box{<-9,1,0.0001>,<9,10,1 >}Your_texture, pigment{rgbt 1}}
  }

All points outside the box will receive Your_texture and points inside 
if it will be totaly transparent.
"Your_texture" been the texture you use now.
This will "paint" a transparent area in your box.
I replaced the zero by 0.0001 so that the opening will only show into 
the side and not the floor of the box.




Alain


Post a reply to this message

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