POV-Ray : Newsgroups : povray.binaries.images : Method. Visible surface at a distance from light source. Server Time
7 Nov 2024 00:21:52 EST (-0500)
  Method. Visible surface at a distance from light source. (Message 1 to 6 of 6)  
From: William F Pokorny
Subject: Method. Visible surface at a distance from light source.
Date: 14 Jan 2018 11:55:44
Message: <5a5b8b90@news.povray.org>
There was recently a post to povray.general about getting ray path 
lengths. Less recently, Christoph suggested the idea of using a negative 
spotlight within a positive one which spurred some negative light play 
images. There too have been questions/github patch work for depth maps. 
An idea popped into my head this morning related to those threads.

By using a positive light and a negative light at the same position 
where the fade distance of the negative light is slightly inside the 
positive one, and where both have very high fade powers, we can 'see' 
what non-shadowed surfaces are at a certain distance from the light 
source position.

Unsure if such a 'spherical shell of light at a radius' method really 
useful in practice, but a trick for the bag in any case.

The bright parts of the attached image represent the surfaces both 
visible to the camera position and at 0.8+-0.01 from the light source at 
<0.5,0.5,-0.5>. Example code below.

Bill P.


//------------------ Example ----------------------
#version 3.8;
global_settings { assumed_gamma 1 }
#default { finish {ambient 0.02 diffuse 0.98} }
#declare Grey40 = srgb <0.4,0.4,0.4>;
background { color Grey40 }
#declare Camera00 = camera {
     perspective
     location <2.5,2.5,-2.501>
     sky y
     angle 35
     right x*(image_width/image_height)
     look_at <0,0,0>
}
#declare VarDist = 0.8;
#declare VarDistRes = 0.02;
#declare VarDistPos = VarDist+(VarDistRes/2);
#declare VarDistNeg = VarDist-(VarDistRes/2);
#declare White = srgb <1,1,1>;
#declare Light00 = light_source {
     <0.5,0.5,-0.5>, White
     fade_distance VarDistPos
     fade_power 1000
}
#declare Light01 = light_source {
     <0.5,0.5,-0.5>, White*-1
     fade_distance VarDistNeg
     fade_power 1000
}
#declare Red = srgb <1,0,0>;
#declare CylinderX = cylinder { -x, x, 0.01 pigment { color Red } }
#declare Green = srgb <0,1,0>;
#declare CylinderY = cylinder { -y, y, 0.01 pigment { color Green } }
#declare Blue = srgb <0,0,1>;
#declare CylinderZ = cylinder { -z, z, 0.01 pigment { color Blue } }
#declare Plane00 = plane { y, 0 pigment { color White } }

//--- scene ---
camera { Camera00 }
light_source { Light00 }
light_source { Light01 }
object { Plane00 }
object { CylinderX }
object { CylinderY }
object { CylinderZ }


Post a reply to this message


Attachments:
Download 'the.png' (34 KB)

Preview of image 'the.png'
the.png


 

From: Bald Eagle
Subject: Re: Method. Visible surface at a distance from light source.
Date: 14 Jan 2018 14:05:01
Message: <web.5a5ba90d66dce5e65cafe28e0@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:

> By using a positive light and a negative light at the same position
> where the fade distance of the negative light is slightly inside the
> positive one, and where both have very high fade powers, we can 'see'
> what non-shadowed surfaces are at a certain distance from the light
> source position.

Hi Bill,
That's a very cool idea!  :)
Just to raise the bar a bit - is there any way that you can think of to simulate
an interference pattern?  Is there a way to [de facto] define a pattern for the
light_source such that one can [faux]cancel the other?
Off the top of my head, I'd say that it would have to be standard light source,
and a distance function-based pigment like Christoph suggested coupled with a
sin function...

But:  Couldn't you just enclose the entire scene into a union, and use an onion
pattern?

Define a color map with a narrow band of white, and the rest is rgbt 1, and then
scale it to highlight the desired distance.

I suppose you could also define a color map for the onion pattern going from 0
to 1, and then scaling it to the maximum desired radius.  The color value at any
point would then be the distance from wherever you translated the center of the
onion pattern to.

At the moment, I think the only way to indirectly find the total ray path length
is the formula method suggested by Christoph, but that's only for direct
lighting.  The ray path length for a light reflected from a mirror that hits an
object and then travels to the camera (ok, it's the reverse of that for
raytracing...) I think might presently be a challenging task.

Let me know if any of this has merit, or I'm in error.


Post a reply to this message

From: Alain
Subject: Re: Method. Visible surface at a distance from light source.
Date: 15 Jan 2018 11:25:09
Message: <5a5cd5e5$1@news.povray.org>

> William F Pokorny <ano### [at] anonymousorg> wrote:
> 
>> By using a positive light and a negative light at the same position
>> where the fade distance of the negative light is slightly inside the
>> positive one, and where both have very high fade powers, we can 'see'
>> what non-shadowed surfaces are at a certain distance from the light
>> source position.
> 
> Hi Bill,
> That's a very cool idea!  :)
> Just to raise the bar a bit - is there any way that you can think of to simulate
> an interference pattern?  Is there a way to [de facto] define a pattern for the
> light_source such that one can [faux]cancel the other?
> Off the top of my head, I'd say that it would have to be standard light source,
> and a distance function-based pigment like Christoph suggested coupled with a
> sin function...
> 
> But:  Couldn't you just enclose the entire scene into a union, and use an onion
> pattern?
> 
> Define a color map with a narrow band of white, and the rest is rgbt 1, and then
> scale it to highlight the desired distance.
> 
> I suppose you could also define a color map for the onion pattern going from 0
> to 1, and then scaling it to the maximum desired radius.  The color value at any
> point would then be the distance from wherever you translated the center of the
> onion pattern to.
> 
> At the moment, I think the only way to indirectly find the total ray path length
> is the formula method suggested by Christoph, but that's only for direct
> lighting.  The ray path length for a light reflected from a mirror that hits an
> object and then travels to the camera (ok, it's the reverse of that for
> raytracing...) I think might presently be a challenging task.
> 
> Let me know if any of this has merit, or I'm in error.
> 

It's impossible to apply any pattern to the light. The only ways to 
spatially modulate the light is with light fading or by using spotlight, 
cylindrical or projected_through.

You may try using negative fade_distance or negative fade_power... I've 
never tried that.


Post a reply to this message

From: William F Pokorny
Subject: Re: Method. Visible surface at a distance from light source.
Date: 15 Jan 2018 12:46:52
Message: <5a5ce90c$1@news.povray.org>
On 01/14/2018 02:01 PM, Bald Eagle wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
> 
> That's a very cool idea!  :)
Thanks. And, I see I attached the image for distance 0.707 instead of 
the 0.8 I intended...

> Just to raise the bar a bit - is there any way that you can think of to simulate
> an interference pattern? 

If multiple lights are projected onto a surface you can get 
'interference effects' in POV-Ray. If you look at this code attachment:

http://news.povray.org/povray.binaries.images/attachment/%3C59c91c45%241%40news.povray.org%3E/utf-8

to the Calling the Doctor - nighttime - 16:9 thread:

http://news.povray.org/povray.binaries.images/thread/%3C59c067a6%40news.povray.org%3E/?mtop=417998

and just uncomment both lights you'll get an interference pattern from 
both 'sphere/pattern enclosed' lights as seen on a plane. It's a 
technique useful for creating image maps, height fields etc. Long 
doable, but oh so much easier with the new 3.8 user_defined{} feature of 
pigment{}.

With the technique I posted you can use more dual lights of differing 
color to, for example, answer questions like what surface regions are 
equidistant from two points in space.

Your following ideas - at least in some form - can work too I think 
depending on what you want to do.

> 
> But:  Couldn't you just enclose the entire scene into a union, and use an onion
> pattern?
> 
> Define a color map with a narrow band of white, and the rest is rgbt 1, and then
> scale it to highlight the desired distance.
> 
> I suppose you could also define a color map for the onion pattern going from 0
> to 1, and then scaling it to the maximum desired radius.  The color value at any
> point would then be the distance from wherever you translated the center of the
> onion pattern to.
> 

Such approaches are the easiest by changing the pigment over distance, 
having finishes of ambient 1 or emission 1 and taking care to 
view/access/write linearly stored 'distance' values.

Note. You can change effective color of a light source over distance 
using the positive/negative light method. For example update the two 
light sources in my example code to read:

#declare Light00 = light_source {
     <0.5,0.5,-0.5>, White
//  fade_distance VarDistPos
//  fade_power 1000
}
#declare Light01 = light_source {
     <0.5,0.5,-0.5>, Blue*-1
     fade_distance VarDistNeg
     fade_power 1
}

The result is yellow up to VarDistNeg, then fading to white the further 
you get from the dual light source position.  Also note that the 
intensity of the light 'seen' on the plane fades too as the angle of 
rays becomes less and less perpendicular to the plane surface.

> At the moment, I think the only way to indirectly find the total ray path length
> is the formula method suggested by Christoph, but that's only for direct
> lighting.  The ray path length for a light reflected from a mirror that hits an
> object and then travels to the camera (ok, it's the reverse of that for
> raytracing...) I think might presently be a challenging task.
> 

Agree.

Aside: I find myself wondering what happens with pos/neg light sources 
in media. Would both the positive and negative rays be sampled/scattered 
identically?

Bill P.


Post a reply to this message

From: Alain
Subject: Re: Method. Visible surface at a distance from light source.
Date: 16 Jan 2018 21:40:48
Message: <5a5eb7b0@news.povray.org>


> Agree.
> 
> Aside: I find myself wondering what happens with pos/neg light sources 
> in media. Would both the positive and negative rays be sampled/scattered 
> identically?
> 
> Bill P.

Why would they be sampled differently?
The algorithm don't care what the value of the light is, just that there 
is some light shining at any given point.


Post a reply to this message

From: William F Pokorny
Subject: Re: Method. Visible surface at a distance from light source.
Date: 18 Jan 2018 09:33:02
Message: <5a60b01e$1@news.povray.org>
On 01/16/2018 09:41 PM, Alain wrote:

> 
>>
>> Aside: I find myself wondering what happens with pos/neg light sources 
>> in media. Would both the positive and negative rays be 
>> sampled/scattered identically?
> 
> Why would they be sampled differently?
> The algorithm don't care what the value of the light is, just that there 
> is some light shining at any given point.

Likely true. Thanks.

Bill P.


Post a reply to this message

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