POV-Ray : Newsgroups : povray.newusers : Reflect light inside box Server Time
19 Nov 2026 20:23:10 EST (-0500)
  Reflect light inside box (Message 1 to 18 of 18)  
From: Rhonda
Subject: Reflect light inside box
Date: 10 Dec 2012 15:45:00
Message: <web.50c6497b5da86ae0e6e840160@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


Here's the current, non-working version of my code:

background { color Blue }
camera {
    location <0, 10, -50>
    look_at  <0, 0,  20>
}

box {
    < -10,  0,  0>,   // left corner
    <10, 20,   20>  // right corner
   hollow
    texture {
      Aluminum
 pigment { color Green }
    }
 interior
 { ior 1.5
 }
      finish {
       reflection {
   0.9, 1.0
   fresnel on
   metallic on
  }
     }
     clipped_by { box {
       <-9,1,0>,<9,10,1 >
     }
     }
rotate y*20

}

light_source { <5, 20, -30>
 color White
 }


Post a reply to this message

From: Leroy
Subject: Re: Reflect light inside box
Date: 10 Dec 2012 16:45:43
Message: <50c65807@news.povray.org>
Rhonda wrote:
> 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
> 
> 
> Here's the current, non-working version of my code:
> 
> background { color Blue }
> camera {
>     location <0, 10, -50>
>     look_at  <0, 0,  20>
> }
> 
> box {
>     < -10,  0,  0>,   // left corner
>     <10, 20,   20>  // right corner
>    hollow
>     texture {
>       Aluminum
>  pigment { color Green }
>     }
>  interior
>  { ior 1.5
>  }
>       finish {
>        reflection {
>    0.9, 1.0
>    fresnel on
>    metallic on
>   }
>      }
>      clipped_by { box {
>        <-9,1,0>,<9,10,1 >
>      }
>      }
> rotate y*20
> 
> }
> 
> light_source { <5, 20, -30>
>  color White
>  }
> 
> 
> 
> 

your "clipped_by" needs to be bigger
What ever in Not in the 'clipped_by' get cuts off
When I use a box to clipped a box I just copy values front the box I
want to clip put in the 'clipped_by ' statement then and 1 to each 
number the vectors. Except the on I want to cut off!

try:
      clipped_by { box {
        < -11,  -1,  0>,<11, 21,   21>
      }

Have Fun!


Post a reply to this message

From: Stephen
Subject: Re: Reflect light inside box
Date: 10 Dec 2012 16:53:36
Message: <50c659e0$1@news.povray.org>
On 10/12/2012 8:43 PM, Rhonda wrote:
> Probably because I have no idea what I'm doing. Can someone provide
> some guidance?
>
> Thanks in advance.

Join the club Rhonda. :-)

Primitives in PovRay are solids (sometime they are only surfaces o_O)
So what you need to do is make a box with six thin boxes. forming the 
walls, floors and ceiling. Use a union to join them then difference that 
with another box.
You only need to use the keyword "hollow" if you are going to fill it 
with media, such as scattering if you want to see the light.

I hope that helps and welcome.

-- 
Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Reflect light inside box
Date: 10 Dec 2012 21:26:38
Message: <50c699de@news.povray.org>
Le 2012-12-10 15:43, Rhonda a écrit :
> 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

From: Rhonda
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 14:35:01
Message: <web.50c789d7cf1ff5fee6e840160@news.povray.org>
This is all really helpful, thank you. I think I'm making progress. I still have
a few issues.

This is what I now have:

global_settings{photons{spacing 0.1}}

#declare my_texture =
 texture {
  finish{
     reflection{
      0.3, 1
      fresnel
    metallic
   }
   specular 1
   roughness 0.1
  }
 }

background { color Blue }
camera {
    location <0, 10, -50>
    look_at  <0, 0,  20>

  }

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>,<9, 10, 0.4>}// the opening
  texture{
   object{
    box{<-9,1,0.0001>,<9,10,1 >}
    my_texture,
    pigment {rgbt 1}
  }
  }


photons{target reflection on}

 rotate y*20
}

light_source { <5, 20, -30>
 color White
}

I'm getting an error on the

texture{
   object{
    box{<-9,1,0.0001>,<9,10,1 >}
    my_texture,
    pigment {rgbt 1}
  }
  }

code, saying that there is a missing }, but I don't see it.

Also, did I put the photons{target reflection on} in the right place, or do I
need to create an object that includes the box and the photons?

Rhonda


Post a reply to this message

From: James Holsenback
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 16:18:30
Message: <50c7a326$1@news.povray.org>
On 12/11/2012 02:31 PM, Rhonda wrote:
> This is all really helpful, thank you. I think I'm making progress. I still have
> a few issues.
>
> This is what I now have:
>
> global_settings{photons{spacing 0.1}}
>
> #declare my_texture =
>   texture {
>    finish{
>       reflection{
>        0.3, 1
>        fresnel
>      metallic
>     }
>     specular 1
>     roughness 0.1
>    }
>   }

the metallic keyword belongs in the finish block ... not the reflection 
block. The rest looked OK (quick glance)


Post a reply to this message

From: James Holsenback
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 16:20:50
Message: <50c7a3b2@news.povray.org>
On 12/11/2012 04:18 PM, James Holsenback wrote:
> On 12/11/2012 02:31 PM, Rhonda wrote:
>> This is all really helpful, thank you. I think I'm making progress. I
>> still have
>> a few issues.
>>
>> This is what I now have:
>>
>> global_settings{photons{spacing 0.1}}
>>
>> #declare my_texture =
>>   texture {
>>    finish{
>>       reflection{
>>        0.3, 1
>>        fresnel
>>      metallic
>>     }
>>     specular 1
>>     roughness 0.1
>>    }
>>   }
>
> the metallic keyword belongs in the finish block ... not the reflection
> block. The rest looked OK (quick glance)

LOL ... after reading further I see that that keyword /can/ indeed live 
in the reflection block ... going back into my corner now.


Post a reply to this message

From: clipka
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 17:31:24
Message: <50c7b43c$1@news.povray.org>
Am 11.12.2012 22:20, schrieb James Holsenback:

>> the metallic keyword belongs in the finish block ... not the reflection
>> block. The rest looked OK (quick glance)
>
> LOL ... after reading further I see that that keyword /can/ indeed live
> in the reflection block ... going back into my corner now.

Actually, if you use "metallic", you should put it in /both/ the finish 
and reflection block: The one makes the highlights look metallic, the 
other does the same for reflections.


Post a reply to this message

From: Rhonda
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 18:15:01
Message: <web.50c7be34cf1ff5fee6e840160@news.povray.org>
Thanks for the input. Any thoughts on why this isn't working:

texture{
   object{
    box{<-9,1,0.0001>,<9,10,1 >}
    my_texture,
    pigment {rgbt 1}
  }
  }


where, this is declared above

#declare my_texture=
 texture {
  finish{
     reflection{
      0.3, 1
      fresnel
    metallic
   }
   specular 1
   roughness 0.1
  }
 }


Post a reply to this message

From: James Holsenback
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 18:53:31
Message: <50c7c77b$1@news.povray.org>
On 12/11/2012 06:13 PM, Rhonda wrote:
> Thanks for the input. Any thoughts on why this isn't working:
>
> texture{
>     object{
>      box{<-9,1,0.0001>,<9,10,1 >}
>      my_texture,
>      pigment {rgbt 1}
>    }
>    }
>
>
> where, this is declared above
>
> #declare my_texture=
>   texture {
>    finish{
>       reflection{
>        0.3, 1
>        fresnel
>      metallic
>     }
>     specular 1
>     roughness 0.1
>    }
>   }
>
>
>
>
check out:
http://wiki.povray.org/content/Reference:Object_Pattern

i think my_texture doesn’t qualify as LIST_ITEM ... try something like 
shown in the example


Post a reply to this message

From: clipka
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 19:27:36
Message: <50c7cf78@news.povray.org>
Am 12.12.2012 00:13, schrieb Rhonda:
> Thanks for the input. Any thoughts on why this isn't working:
>
> texture{
>     object{
>      box{<-9,1,0.0001>,<9,10,1 >}
>      my_texture,
>      pigment {rgbt 1}
>    }
>    }

Try this:

   texture{
     object {
       box{<-9,1,0.0001>,<9,10,1 >}
       texture { my_texture },
       texture { pigment {rgbt 1} }
     }
   }


Post a reply to this message

From: Alain
Subject: Re: Reflect light inside box
Date: 11 Dec 2012 21:47:20
Message: <50c7f038$1@news.povray.org>
Le 2012-12-11 14:31, Rhonda a écrit :
> This is all really helpful, thank you. I think I'm making progress. I still have
> a few issues.
>
> This is what I now have:
>
> global_settings{photons{spacing 0.1}}
>
> #declare my_texture =
>   texture {
>    finish{
>       reflection{
>        0.3, 1
>        fresnel
>      metallic
>     }
>     specular 1
>     roughness 0.1
>    }
>   }
>
> background { color Blue }
> camera {
>      location <0, 10, -50>
>      look_at  <0, 0,  20>
>
>    }
>
> 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>,<9, 10, 0.4>}// the opening
>    texture{
>     object{
>      box{<-9,1,0.0001>,<9,10,1 >}
>      my_texture,
>      pigment {rgbt 1}
>    }
>    }
>
>
> photons{target reflection on}
>
>   rotate y*20
> }
>
> light_source { <5, 20, -30>
>   color White
> }
>
> I'm getting an error on the
>
> texture{
>     object{
>      box{<-9,1,0.0001>,<9,10,1 >}
>      my_texture,
>      pigment {rgbt 1}
>    }
>    }
>
> code, saying that there is a missing }, but I don't see it.
>
> Also, did I put the photons{target reflection on} in the right place, or do I
> need to create an object that includes the box and the photons?
>
> Rhonda
>
>
>

Using the box with the difference, you don't need to use the object 
pattern. It's a way of simulating an opening if you use a transparent 
pigment. Remove:
    object{
     box{<-9,1,0.0001>,<9,10,1 >}
     my_texture,
     pigment {rgbt 1}
   }

and only use:
texture{ my_texture }

Your photons block is correctly placed.


Alain


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Reflect light inside box
Date: 12 Dec 2012 03:38:47
Message: <50c84297$1@news.povray.org>
El 11/12/12 22:20, James Holsenback escribió:

> ... going back into my corner now.

   To experiment with better metals, I hope... :)

--
Jaime


Post a reply to this message

From: James Holsenback
Subject: Re: Reflect light inside box
Date: 12 Dec 2012 05:52:38
Message: <50c861f6$1@news.povray.org>
On 12/12/2012 03:38 AM, Jaime Vives Piqueres wrote:
> El 11/12/12 22:20, James Holsenback escribió:
>
>> ... going back into my corner now.
>
>    To experiment with better metals, I hope... :)
>
> --
> Jaime
>
LOL ... in my case there's only hope!


Post a reply to this message

From: Kenneth
Subject: Re: Reflect light inside box
Date: 12 Dec 2012 22:15:00
Message: <web.50c94541cf1ff5fec2d977c20@news.povray.org>
Try this slightly corrected, working version. I found a few syntax
errors--nothing to worry about, as we all make them from time to time. I've
included some helpful notes in the code.

 #include "colors.inc" // for your "White" and "Blue" colors
 global_settings{photons{spacing 0.1}}

 #declare my_texture =
   texture {
    // Did you mean to leave out a pigment? If so, that's OK, because a
    // 'default' pigment is substituted (but I think it's black, i.e., <0,0,0>)
    pigment{rgb .7} // POV-Ray expands this to <.7,.7,.7> or a bright gray
     finish{
        reflection{
        0.3, 1 // Might be too much reflection; try .2,.7
        fresnel
        metallic
                }
      specular 1
      roughness 0.1
           }
           }

 background { color Blue }

 camera {
      location <0, 10, -50>
      look_at  <0, 0,  20>
    }

 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>,<9, 10, 0.4>}// the opening. [This box doesn't work the
    //way you want, the dimensions are a little bit off. Try this one...
    box{<-9.1,1,-.1>,<9,10,.5>}
    texture{
      my_texture  // As Alain mentioned. BTW, no comma should go after this.
           }
  // There was an extra } bracket here, so I removed it

 photons{target reflection on}
 rotate y*30
 } // end of the difference

 light_source { <5, 20, -30>
   color White
 }

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

Sometimes POV-Ray returns an error message that may not make sense (if you can't
easily find the flaw it's reporting.) You'll need to more thoroughly search your
code, up above the flagged error line, to check for any other syntax errors,
missing brackets, etc.

BTW, when making hollow boxes like yours, I find it easier to specify the boxes
like this:

difference{
box{0,1 translate -.5} // i.e., <0,0,0>,<1,1,1>  then centers this unit-size
// box on the origin.
box{0,1 translate -.5 scale .95} // same, but a slightly smaller box
box{0,1 scale <...>  translate <...>  // the cutaway box
 scale <....> // final scale of the completed difference
 texture{...}
 rotate ... // this rotates the difference (and its texture) around
            // the origin--usually more intuitive.
 translate <....> // wherever you want it to go
 }

This way, you don't need to spend time figuring out the precise dimensions of
the inner box to get it 'centered' in the outer box; the 2nd box's scale takes
care of all that. In this case, though, some of the walls may end up with
different thicknesses, if you scale everything into a 'rectangular' shape.

How to go about things most efficiently in POV-Ray just involves experimenting
and practice. You'll find there are many ways of getting a certain result.


Post a reply to this message

From: Rhonda
Subject: Re: Reflect light inside box
Date: 13 Dec 2012 15:25:01
Message: <web.50ca3942cf1ff5fe27603e180@news.povray.org>
This is seriously awesome, thanks so much for your help.

I have a couple more questions.

The light isn't bouncing up into the box as much as I would expect. I increased
max_trace_level, but that didn't change anything. I also tried changing the
position of the light_source, but that didn't change things much either. Is it a
matter of increasing light intensity? Suggestions?

Is there a way to make the box transparent, but have the light rays stay in the
box? I've been moving the camera inside the box to see reflections, but maybe it
would be easier to leave it outside the box and make the box see-through and the
light a different color, such as red.

Rhonda


Post a reply to this message

From: Alain
Subject: Re: Reflect light inside box
Date: 13 Dec 2012 15:43:47
Message: <50ca3e03$1@news.povray.org>
Le 2012-12-13 15:23, Rhonda a écrit :
> This is seriously awesome, thanks so much for your help.
>
> I have a couple more questions.
>
> The light isn't bouncing up into the box as much as I would expect. I increased
> max_trace_level, but that didn't change anything. I also tried changing the
> position of the light_source, but that didn't change things much either. Is it a
> matter of increasing light intensity? Suggestions?
>
> Is there a way to make the box transparent, but have the light rays stay in the
> box? I've been moving the camera inside the box to see reflections, but maybe it
> would be easier to leave it outside the box and make the box see-through and the
> light a different color, such as red.
>
> Rhonda
>
>
>
>
>

The intensity decrease after each reflections. After a few, it can 
become to faint to be seen compared to some other elements. If the 
intensity goes under adc_bailout, the tracing just stop and return the 
value so far.

max_trace_level default to 5. In scenes like yours, with mostly 
reflective surfaces, it should be increased. max_trace_level 50 is 
reasonable, it's maximum is 255.

A possibility would be to slightly increase the value for the minimum 
reflection in your finish.

You could try reducing the adc_baulout value in the global_settings. It 
default to 1/256. It can be set lower than that, along with increasing 
max_trace_level. Be warned that it will significantly increase the 
rendering time.

Another viable option could be to use radiosity. It calculate the difuse 
interreflection. It may, or may not, improve things in your case.
Radiosity does take more time.
As a first try, use:

global_settings{ radiosity{} }
or, add:

radiosity{}
in your actual global_settings block.

This turn on radiosity calculation using all the default values.



Alain


Post a reply to this message

From: Kenneth
Subject: Re: Reflect light inside box
Date: 13 Dec 2012 21:20:00
Message: <web.50ca8c67cf1ff5fec2d977c20@news.povray.org>
"Rhonda" <rho### [at] gmailcom> wrote:

>
> I have a couple more questions.
>
> The light isn't bouncing up into the box as much as I would expect. I increased
> max_trace_level, but that didn't change anything. I also tried changing the
> position of the light_source, but that didn't change things much either. Is it a
> matter of increasing light intensity? Suggestions?
>

I commented-out your 'fresnel' keyword and that brightened up the interior very
much.

Here's something I forgot to mention: 'fresnel' in a 'reflection' block also
needs an interior{ior ...} block for it to work correctly. The interior {...}
block goes after the texture{...} block, it's not part of it. *But*, you can't
#declare a texture{...} followed by an interior{...} --POV-Ray treats them as
two completely separate things.  Instead, you can wrap them both in a 'material'
block! It's just a wrapper, and doesn't do anything.

#declare my_texture =
material{
texture{...}
interior{...}
}

Then, when you want to use this, it's:
material{my_texture}
and not texture{my_texture}

By the way, 'photons' almost always look better when the surface of an object is
disturbed in some way, even slightly (i.e., not completely flat.) You can do
this through geometry, or by using a 'normal' block. Try adding this inside your
texture block:

normal{bumps .1 scale 3}

and change global_settings{photons{spacing .1}} to .03  which makes the photon
effect 'tighter' and more detailed (but renders a little slower.)  You'll see
some very nice results!


Post a reply to this message

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