POV-Ray : Newsgroups : povray.newusers : Mirror Reflection Server Time
22 Dec 2024 11:06:19 EST (-0500)
  Mirror Reflection (Message 1 to 6 of 6)  
From: ptsneves
Subject: Mirror Reflection
Date: 6 Jun 2012 06:40:00
Message: <web.4fcf323e3c804514295860870@news.povray.org>
Hello I know this must sound an obvious question but i have taken the optics
demo apart to ray trace a scene which reflects a directional photon beam with a
mirror. The problem is that the beam stops at the mirror. I have tried to set
the max_trace_level to higher numbers and still can't figure out why this
doesn't work.


If somebody can give me a hand i would be grateful. Thanks in advance
Paulo Neves


#version 3.7;

#include "colors.inc"


global_settings {
    max_trace_level 5
    photons {
        count 150000
        max_trace_level 9
        media 500, 2
    }
}

#declare CamPos = < 0, 18, 0>;

camera {
    location CamPos
    look_at < 0, 0, 0>
    angle 35
}

light_source {CamPos, color Gray25
    photons {refraction off reflection off}
    media_interaction on
}
light_source {<-150, 0.5, 0>, color rgb < 1.2, 1, 1.5>
    spotlight radius 0.3 falloff 0.35 point_at < 0, 0.5, 0>
    photons {refraction on reflection on}
}

#macro Block(From, To)
    union {
        cylinder {From, To*(x+z), 0.1 scale < 1, 10*To.y, 1>
            texture {
                pigment {checker color Gray90, color Gray70
                    scale 0.1
                }
                finish {brilliance 0.5}
            }
        }
        cylinder {From, To*(x+z), 0.025
            translate y*To
            texture {
                pigment {color rgb < 1, 0.7, 0.2>}
                finish {ambient 0.8}
            }
        }
    }
#end

box {<-100,-1,-100>, < 100, 0, 100>
    texture {
        pigment {checker color Gray90, color rgb < 0.2, 0, 0.4>}
        finish {brilliance 0.25}
    }
}
box {<-7,-0.1,-3>, < 6, 1, 4> hollow
    texture {pigment {color rgbf 1}}
    interior {
        media {
            scattering {0.5, color White extinction 0}
//            emission color White*0.2
            method 3
            intervals 1 samples 4
        }
    }
    photons {target}
}

union {
    difference {
        object {Block(<-4, 0,-3>, <-4, 1.5, 3>)}
        box {<-5, 0.25,-0.5>, < -3, 0.75, 0.5>}
    }
    cylinder {<-4, 0, 0>, <-4, 1.5, 0>, 0.1 translate z*0.15}
    cylinder {<-4, 0, 0>, <-4, 1.5, 0>, 0.1 translate -z*0.15}
    texture {pigment {color rgb 1}}
}

#declare MirrorTex1 =
texture {
    pigment {color White}
    finish {ambient 0 diffuse 0 reflection 1 ambient 1}
}


#macro PhotonTarget(Reflect, Refract, IgnorePhotons)
 photons {
  target
  reflection Reflect
  refraction Refract
  collect off

 }
#end



#macro Mirror(Pos, Ang, Width, Height, Tex)
 box {<-0.1,-0.1,-Width/2>, < 0, Height, Width/2>
     texture {Tex}
     PhotonTarget(yes, yes, yes)
     rotate -y*Ang
     translate Pos
 }
#end

object {Mirror(<-3, 0, 0>, 3*45, 2, 1, MirrorTex1)}


Post a reply to this message

From: Warp
Subject: Re: Mirror Reflection
Date: 6 Jun 2012 09:19:13
Message: <4fcf58d0@news.povray.org>
ptsneves <nomail@nomail> wrote:
> Hello I know this must sound an obvious question but i have taken the optics
> demo apart to ray trace a scene which reflects a directional photon beam with a
> mirror. The problem is that the beam stops at the mirror. I have tried to set
> the max_trace_level to higher numbers and still can't figure out why this
> doesn't work.

  I think that you have to specify "photons { pass_through }" in your
media container box, or else they won't show up in the media.

  (Yes, this is highly unintuitive, and I don't know why it works like
that. It's probably a quirk that ought to be fixed.)

  See also
http://wiki.povray.org/content/Documentation:Tutorial_Section_3.7#Media_and_photons

-- 
                                                          - Warp


Post a reply to this message

From: Stephen
Subject: Re: Mirror Reflection
Date: 6 Jun 2012 10:57:29
Message: <4fcf6fd9@news.povray.org>
On 06/06/2012 2:19 PM, Warp wrote:

>    I think that you have to specify "photons { pass_through }" in your
> media container box, or else they won't show up in the media.
>
>    (Yes, this is highly unintuitive, and I don't know why it works like
> that. It's probably a quirk that ought to be fixed.)
>
>    See also
> http://wiki.povray.org/content/Documentation:Tutorial_Section_3.7#Media_and_photons
>

I think that Clipka mentioned that there is a bug in RC4 & RC5 that 
breaks it.
Ver 3.6 works though.


-- 
Regards
     Stephen


Post a reply to this message

From: clipka
Subject: Re: Mirror Reflection
Date: 6 Jun 2012 11:19:13
Message: <4fcf74f1$1@news.povray.org>
Am 06.06.2012 12:34, schrieb ptsneves:
> Hello I know this must sound an obvious question but i have taken the optics
> demo apart to ray trace a scene which reflects a directional photon beam with a
> mirror. The problem is that the beam stops at the mirror. I have tried to set
> the max_trace_level to higher numbers and still can't figure out why this
> doesn't work.

As Stephen already mentioned, this is a known bug in 3.7 RC5; the next 
release will fix it.


Post a reply to this message

From: ptsneves
Subject: Re: Mirror Reflection
Date: 6 Jun 2012 16:50:00
Message: <web.4fcfc1ebfeb1e11a295860870@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 06.06.2012 12:34, schrieb ptsneves:
> > Hello I know this must sound an obvious question but i have taken the optics
> > demo apart to ray trace a scene which reflects a directional photon beam with a
> > mirror. The problem is that the beam stops at the mirror. I have tried to set
> > the max_trace_level to higher numbers and still can't figure out why this
> > doesn't work.
>
> As Stephen already mentioned, this is a known bug in 3.7 RC5; the next
> release will fix it.

Yep it seems that the original code i pasted works under 3.6 and not on 3.7. Is
there a patch i can apply instead of waiting. The difference in render time is
quite obvious


Post a reply to this message

From: clipka
Subject: Re: Mirror Reflection
Date: 6 Jun 2012 20:59:38
Message: <4fcffcfa@news.povray.org>
Am 06.06.2012 22:47, schrieb ptsneves:
> clipka<ano### [at] anonymousorg>  wrote:
>> Am 06.06.2012 12:34, schrieb ptsneves:
>>> Hello I know this must sound an obvious question but i have taken the optics
>>> demo apart to ray trace a scene which reflects a directional photon beam with a
>>> mirror. The problem is that the beam stops at the mirror. I have tried to set
>>> the max_trace_level to higher numbers and still can't figure out why this
>>> doesn't work.
>>
>> As Stephen already mentioned, this is a known bug in 3.7 RC5; the next
>> release will fix it.
>
> Yep it seems that the original code i pasted works under 3.6 and not on 3.7. Is
> there a patch i can apply instead of waiting. The difference in render time is
> quite obvious

If you're using Linux, or have a way to build 3.7 RC5 for your system, 
then it should be quite simple. Change the backend/render/trace.cpp file 
as follows:

At the end of the function Trace::ComputeReflection() (somewhere near 
line 1290), replace the lines

   Colour tmpCol;
   TraceRay(nray, tmpCol, weight, ticket, false);
   RGBColour tmpCol2(tmpCol);
   if (finish->Irid > 0.0)
     ComputeIridColour(finish, Vector3d(nray.Direction),
                       Vector3d(ray.Direction), normal, ipoint, tmpCol2);
   colour += Colour(tmpCol2);

with

   if (!ray.IsPhotonRay() && (finish->Irid > 0.0))
   {
     Colour tmpCol;
     TraceRay(nray, tmpCol, weight, ticket, false);
     RGBColour tmpCol2(tmpCol);
     ComputeIridColour(finish, Vector3d(nray.Direction),
                       Vector3d(ray.Direction), normal, ipoint, tmpCol2);
     colour += Colour(tmpCol2);
   }
   else
   {
     TraceRay(nray, colour, weight, ticket, false);
   }

Then rebuild. That'll fix it.

If you can't build a modified 3.7 RC5 for your system, I'm afraid you'll 
have to wait for RC6.


Post a reply to this message

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