POV-Ray : Newsgroups : povray.general : Re: Overlapping multiple generated scenes Server Time
1 Nov 2024 11:13:58 EDT (-0400)
  Re: Overlapping multiple generated scenes (Message 1 to 8 of 8)  
From: clipka
Subject: Re: Overlapping multiple generated scenes
Date: 23 Apr 2012 10:27:33
Message: <4f9566d5$1@news.povray.org>
Am 23.04.2012 15:30, schrieb sic2:
> This is the code I have written so far:
>
> #declare Index = 0;
> #declare offset_index = 30;
>
> #while(Index<  90)
>    difference {
>
>     sphere {
>             <1, 0, -6>, 0.5
>             finish {
>                     ambient 0.1
>                     diffuse 0.6
>             }
>             pigment { NeonPink }
>     }
>    // Cutting plane
>    #declare rgb_coeff = 255;
>    plane {
>     // http://www.povray.org/documentation/view/3.6.0/297/
>     <0, 0, 1>, -7 // This will vary depening on the index
>     pigment {
>                    rgb<Index/rgb_coeff, Index/rgb_coeff, Index/rgb_coeff>
>            }
>           translate<0, 0, 1>
>    }
>
>
>    }  // end difference
>          #declare Index = Index + offset_index;
> #end // end while-loop
>
>
>
> What I am aiming to get is to cut the same scene multiple times at different
> depths and getting the cut scene (the scene is cut using a plane). Then I want
> to take all the cut scenes (from the one cut to its farthest point to the one
> cut at its closest point) and overlap all of them.
> I should then get a depth map with different grays like this one:
> http://www.dofpro.com/tutorials/chessDM.jpg
>
> How do I go about getting the different cut scenes and put all of them
> together?
>
> Thank you very much in advance.

If all you want is a depth map, a much easier, faster and qualitatively 
superior approach is to simply use a corresponding texture.

Comment out any textures already applied to your objects (or use an 
"#if...#end" construct). Place all your objects into a single union, and 
equip that one with a texture having an "emission 1 ambient 0 diffuse 0 
specular 0 phong 0" finish (in POV-Ray 3.6, use "ambient 1" instead of 
"emission 1 ambient 0"), and a gradient or planar pigment fading from 
white (near the camera) to black (far away from the camera).


Post a reply to this message

From: sic2
Subject: Re: Overlapping multiple generated scenes
Date: 23 Apr 2012 15:55:01
Message: <web.4f95b36761b138fc9a9b32670@news.povray.org>
> If all you want is a depth map, a much easier, faster and qualitatively
> superior approach is to simply use a corresponding texture.
>
> Comment out any textures already applied to your objects (or use an
> "#if...#end" construct). Place all your objects into a single union, and
> equip that one with a texture having an "emission 1 ambient 0 diffuse 0
> specular 0 phong 0" finish (in POV-Ray 3.6, use "ambient 1" instead of
> "emission 1 ambient 0"), and a gradient or planar pigment fading from
> white (near the camera) to black (far away from the camera).


This is what I got:

union {
 sphere {
  <-2, 0, -6>, 0.5
 }

 box {
  <-1, -2, -5>, < 1,  2,  3>
  rotate <0, -20, 0>
 }
 pigment {
  gradient x
  pigment_map {
   [ -10 White]
   [ 100 Black ]
  }
 }
 finish {
  ambient 1
  diffuse 0
  specular 0
  phong 0
 }

}  // end union

However, the transition between Black and White is not very homogeneous.
What do I do wrong?
Also do you know if it's possible to create a gray map of just depth Z lets say
(or from depth Z_1 to Z_2) ? I need an answer for the second question for post
processing the image later.
Thank you again.


Post a reply to this message

From: clipka
Subject: Re: Overlapping multiple generated scenes
Date: 23 Apr 2012 16:23:31
Message: <4f95ba43@news.povray.org>
Am 23.04.2012 21:54, schrieb sic2:
>> If all you want is a depth map, a much easier, faster and qualitatively
>> superior approach is to simply use a corresponding texture.
>>
>> Comment out any textures already applied to your objects (or use an
>> "#if...#end" construct). Place all your objects into a single union, and
>> equip that one with a texture having an "emission 1 ambient 0 diffuse 0
>> specular 0 phong 0" finish (in POV-Ray 3.6, use "ambient 1" instead of
>> "emission 1 ambient 0"), and a gradient or planar pigment fading from
>> white (near the camera) to black (far away from the camera).
>
>
> This is what I got:
>
> union {
>   sphere {
>    <-2, 0, -6>, 0.5
>   }
>
>   box {
>    <-1, -2, -5>,<  1,  2,  3>
>    rotate<0, -20, 0>
>   }
>   pigment {
>    gradient x
>    pigment_map {
>     [ -10 White]
>     [ 100 Black ]
>    }
>   }

The value range for any pattern is always 0..1, so you'll need to use

   pigment_map {
     [0.0 White]
     [1.0 Black]
   }

For the gradient to cover the proper range, scale (and possibly 
translate) the pigment, as in

   pigment {
     gradient x
     pigment_map {...}
     scale <110,1,1>
     translate -10*x
   }

> Also do you know if it's possible to create a gray map of just depth Z lets say
> (or from depth Z_1 to Z_2) ? I need an answer for the second question for post
> processing the image later.

I don't really understand what you mean. Maybe it would help if you 
described what you are ultimately trying to achieve with all of this.


Post a reply to this message

From: sic2
Subject: Re: Overlapping multiple generated scenes
Date: 23 Apr 2012 17:25:00
Message: <web.4f95c7f461b138fc9a9b32670@news.povray.org>
> > Also do you know if it's possible to create a gray map of just depth Z lets say
> > (or from depth Z_1 to Z_2) ? I need an answer for the second question for post
> > processing the image later.
>
> I don't really understand what you mean. Maybe it would help if you
> described what you are ultimately trying to achieve with all of this.

It kind of hard to explain, but I will try:
What I am trying to get are a number of maps for different depths. So basically
I will have a map, for example, every 10 units in the z-axis.
Here is the hard part:
A depth map can be imagined as a scene cut many many times (at different depths)
where each time you assign a different gray to the cut scene depending on the
depth, right? Then if you overlap all the resulting scenes you should get what
we've done so far.
However, given two depths from i to j;  I want the cut objects, in the scene,
starting at depth i until depth j and make them to look smaller.
So if I have a sphere this would be cut and then "look" gray with a radius r,
but I want the radius to be (r - x).  This principle could be applied to any
object.
I already have some idea on how to make the gray part of a certain object
"smaller" by using Matlab or some other programming language.
However, what it could be useful would be to:
1. generate a depth map that excludes the depth from i to j. So there would be a
map from 0 to i, a jump, and then from j to the farthest point in the scene.
Thus the fading from white to black won't be homogeneous.
2. generate a depth map that contains takes in consideration only the depth from
i to j. this would then be post-processed and added to the first map.

I hope all this was clear somehow. I would perfectly understand if this seems
just a mess to you.


Post a reply to this message

From: clipka
Subject: Re: Overlapping multiple generated scenes
Date: 23 Apr 2012 18:17:34
Message: <4f95d4fe@news.povray.org>
Am 23.04.2012 23:21, schrieb sic2:

> I hope all this was clear somehow. I would perfectly understand if this seems
> just a mess to you.

Thank you for your understanding :-)

Maybe you're better off with your initial approach of cutting the scene 
into slices after all.

Note that you can do this as an "animation" to get an image for every 
slice; just compute the position of the slicing planes (or slicing box) 
from either "clock" or "frame_number", and specify "+kfi1 kff100" (for 
instance, to get 100 slices) as rendering options.

You can then post-process each of the slices separately as needed, and 
finally layer them over another again. (It might help to activate alpha 
channel output; use "background { color rgbt 1 }" and the rendering 
option "+UA" for that. Make sure to use an image format that supports 
transparency, such as PNG.)


Post a reply to this message

From: sic2
Subject: Re: Overlapping multiple generated scenes
Date: 23 Apr 2012 18:35:01
Message: <web.4f95d7fe61b138fc9a9b32670@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 23.04.2012 23:21, schrieb sic2:
>
> > I hope all this was clear somehow. I would perfectly understand if this seems
> > just a mess to you.
>
> Thank you for your understanding :-)
>
> Maybe you're better off with your initial approach of cutting the scene
> into slices after all.
>
> Note that you can do this as an "animation" to get an image for every
> slice; just compute the position of the slicing planes (or slicing box)
> from either "clock" or "frame_number", and specify "+kfi1 kff100" (for
> instance, to get 100 slices) as rendering options.
>
> You can then post-process each of the slices separately as needed, and
> finally layer them over another again. (It might help to activate alpha
> channel output; use "background { color rgbt 1 }" and the rendering
> option "+UA" for that. Make sure to use an image format that supports
> transparency, such as PNG.)

Thank you very much for the answer. I will be working on it tomorrow and let you
know if it works or not.


Post a reply to this message

From: Stephen
Subject: Re: Overlapping multiple generated scenes
Date: 23 Apr 2012 18:46:30
Message: <4f95dbc6$1@news.povray.org>
On 23/04/2012 11:30 PM, sic2 wrote:
> clipka<ano### [at] anonymousorg>  wrote:
>> Am 23.04.2012 23:21, schrieb sic2:
>>
>>> I hope all this was clear somehow. I would perfectly understand if this seems
>>> just a mess to you.
>>
>> Thank you for your understanding :-)
>>
>> Maybe you're better off with your initial approach of cutting the scene
>> into slices after all.
>>
>> Note that you can do this as an "animation" to get an image for every
>> slice; just compute the position of the slicing planes (or slicing box)
>> from either "clock" or "frame_number", and specify "+kfi1 kff100" (for
>> instance, to get 100 slices) as rendering options.
>>
>> You can then post-process each of the slices separately as needed, and
>> finally layer them over another again. (It might help to activate alpha
>> channel output; use "background { color rgbt 1 }" and the rendering
>> option "+UA" for that. Make sure to use an image format that supports
>> transparency, such as PNG.)
>
> Thank you very much for the answer. I will be working on it tomorrow and let you
> know if it works or not.
>
>
>
It should work. I did something similar a few years ago to create three 
density files (r,g & b). Don't forget to use an orthographic camera.

-- 
Regards
     Stephen


Post a reply to this message

From: sic2
Subject: Re: Overlapping multiple generated scenes
Date: 25 Apr 2012 17:40:00
Message: <web.4f986e3e61b138fc489bdfbf0@news.povray.org>
Stephen <mcavoys_at@aoldotcom> wrote:
> On 23/04/2012 11:30 PM, sic2 wrote:
> > clipka<ano### [at] anonymousorg>  wrote:
> >> Am 23.04.2012 23:21, schrieb sic2:
> >>
> >>> I hope all this was clear somehow. I would perfectly understand if this seems
> >>> just a mess to you.
> >>
> >> Thank you for your understanding :-)
> >>
> >> Maybe you're better off with your initial approach of cutting the scene
> >> into slices after all.
> >>
> >> Note that you can do this as an "animation" to get an image for every
> >> slice; just compute the position of the slicing planes (or slicing box)
> >> from either "clock" or "frame_number", and specify "+kfi1 kff100" (for
> >> instance, to get 100 slices) as rendering options.
> >>
> >> You can then post-process each of the slices separately as needed, and
> >> finally layer them over another again. (It might help to activate alpha
> >> channel output; use "background { color rgbt 1 }" and the rendering
> >> option "+UA" for that. Make sure to use an image format that supports
> >> transparency, such as PNG.)
> >
> > Thank you very much for the answer. I will be working on it tomorrow and let you
> > know if it works or not.
> >
> >
> >
> It should work. I did something similar a few years ago to create three
> density files (r,g & b). Don't forget to use an orthographic camera.
>
> --
> Regards
>      Stephen

Working perfectly! There was no need to use an orthographic camera. The only
additional thing I did it was to disable antialiasing.

Thank you again ;)


Post a reply to this message

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