POV-Ray : Newsgroups : povray.binaries.images : Transition between two medias Server Time
30 Jul 2024 16:16:14 EDT (-0400)
  Transition between two medias (Message 1 to 10 of 22)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Thomas de Groot
Subject: Transition between two medias
Date: 24 Apr 2012 03:25:47
Message: <4f96557b@news.povray.org>
I am struggling with the following. Muddy water flowing out of an 
estuary towards sea, eventually sinks down/mixes with sea water some 
distance from the coast. The easy approach is shown in the image below: 
two boxes, sliced by a plane, and filled with two different media each 
(one absorption, one scattering).

I would prefer a more diffuse approach using a spherical pattern for 
instance, but I am unable to come up with a working code that can do 
that properly.

Any idea? Thanks!

Thomas


Post a reply to this message


Attachments:
Download 'mediatest2.png' (116 KB)

Preview of image 'mediatest2.png'
mediatest2.png


 

From: Le Forgeron
Subject: Re: Transition between two medias
Date: 24 Apr 2012 05:16:00
Message: <4f966f50$1@news.povray.org>
Le 24/04/2012 09:25, Thomas de Groot a écrit :
> I am struggling with the following. Muddy water flowing out of an
> estuary towards sea, eventually sinks down/mixes with sea water some
> distance from the coast. The easy approach is shown in the image below:
> two boxes, sliced by a plane, and filled with two different media each
> (one absorption, one scattering).
> 
> I would prefer a more diffuse approach using a spherical pattern for
> instance, but I am unable to come up with a working code that can do
> that properly.
> 
> Any idea? Thanks!

two words: Offset printing.

(in 3D)

It might be costly. Macro is a must have.

In details, use union/merge of spheres with fixed coordinates but
variables radius.

In the estuary, radius are such that spheres fills the whole space.

In the least yet perturbed sea, the radius become very small.

For sphere placements, use ABC or ABA compact spheres filling of space
(12 spheres around 1: 6 in same plane, 3 above, 3 below), rather than
cartesian grid. Tilt the placements by some rotations.

relative radius of spheres should be computed from the x,y position of
the center (you might also consider z if you like), relative your
gradient/pattern of diffusion between 100% estuary and the 100% sea.

To sum up:
 1. create that object A (limit the spheres to the mixing zone).
 2. create an object B, container of the mix.
 3. B is filled with sea media
 4. intersection of B & A is filled with estuary media.
 5. part before B in estuary is filled with estuary media
 6. part after B in sea is filled with sea media
(there might be a surface between 5/6 and B, so might be A and B must be
extended to one fill further in their direction)

(B is the whole flow, A is a squatter)
alternative with possible coincident surface issue:

difference { B A material{ Sea } }
intersection { B A material { Estuary } }

Tuning with the radius between the spheres coordinates.

-- 
Real software engineers work from 9 to 5, because that is
the way the job is described in the formal spec.  Working
late would feel like using an undocumented external procedure.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Transition between two medias
Date: 24 Apr 2012 06:58:43
Message: <4f968763@news.povray.org>
Thomas de Groot wrote:

> I would prefer a more diffuse approach using a spherical pattern for 
> instance, but I am unable to come up with a working code that can do 
> that properly.

are you looking for something like this:

#declare f_gradient_x_non_repeating = function
{
   select(x,0,select(x-1,x-1,1))

   // of course you can also construct something using
   // f_spherical here depending on desired geometry
}

box
{
   <-2,-1,0>,<2,1,1> hollow
   pigment  {color rgbt 1}
   interior
   {
     media
     {
       method 3
       absorption 10
       density
       {
         function {f_gradient_x_non_repeating(x,y,z)}
         translate -0.5*x
         scale 2*x
         rotate 45*z
         color_map
         {
           [0.0 color Navy]
           [1.0 color Khaki]
         }
       }
     }
   }
}


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Transition between two medias
Date: 24 Apr 2012 07:01:05
Message: <4f9687f1$1@news.povray.org>
Christian Froeschlin wrote:

note you will need to media statements, one to increase
the scattering and another to decrease the absorption.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Transition between two medias
Date: 24 Apr 2012 07:06:11
Message: <4f968923$1@news.povray.org>
Christian Froeschlin wrote:

>   select(x,0,select(x-1,x-1,1))

and that was actually supposed to be

select(x,0,select(x-1,x,1))


Post a reply to this message

From: Thomas de Groot
Subject: Re: Transition between two medias
Date: 24 Apr 2012 08:06:06
Message: <4f96972e@news.povray.org>
On 24-4-2012 12:58, Christian Froeschlin wrote:
> are you looking for something like this:
>
> #declare f_gradient_x_non_repeating = function
> {
> select(x,0,select(x-1,x-1,1))
>
> // of course you can also construct something using
> // f_spherical here depending on desired geometry
> }
>
> box
> {
> <-2,-1,0>,<2,1,1> hollow
> pigment {color rgbt 1}
> interior
> {
> media
> {
> method 3
> absorption 10
> density
> {
> function {f_gradient_x_non_repeating(x,y,z)}
> translate -0.5*x
> scale 2*x
> rotate 45*z
> color_map
> {
> [0.0 color Navy]
> [1.0 color Khaki]
> }
> }
> }
> }
> }
Thank you both, Le_Forgeron and Christian. I feel Le_Forgeron's solution 
to be rather complicated and I do not yet understand everything yet, 
although it might be the best approach in the end.

Christians solution is elegant and promises to be my favourite choice. 
Using my own water colours, and tweaking the code in the following way:

//=======================================================================
#declare Sea_col = srgb <0.51373, 0.70588, 0.70588>;   //clear water
#declare Mud_col = srgb <0.74118, 0.71765, 0.41961>+<0.2, 0.2, 0>; 
//muddy water
#declare Dist    = 200;  //determines the depth transparency of the 
water column

#local FD = -(Dist/(6*25.4))/ln(0.58);	//fade distance

#declare f_gradient_x_non_repeating = function {select(x,0,select(x-1,x,1))}

box {
   <-3,-1,-1>, <3,1,1>
   hollow
   pigment {color rgbt 1}
   finish {
     conserve_energy
     diffuse 0.2
     ambient 0
     reflection {0.01, 0.2 fresnel on metallic 0}
   }
   normal {crackle 0.15 scale <0.45,0.25,0.25>*2 turbulence 0.5 }
   interior {
     ior 1.33
     media {
       method 3
       absorption 5
       density {rgb 1/FD}
       //next commented out to follow original fading on line above
       /*density {
         function {f_gradient_x_non_repeating(x,y,z)}
         translate 0.25*x
         scale 2*x
         rotate 70*z
         color_map {
           [0.0 color Sea_col]
           [1.0 color Mud_col]
         }
       }*/
     }
     media {
       method 3
       scattering {3, Sea_col}
       density {
         function {f_gradient_x_non_repeating(x,y,z)}
         translate 0.25*x
         scale 1*x
         rotate 60*z
         color_map {
           [0.0 color Mud_col]
           [1.0 color Sea_col]
         }
       }
     }
   }
}
//=======================================================================

This is going in the right direction! I have see how to tweak the 
colours to obtain approximately my original water aspect.

Thomas


Post a reply to this message


Attachments:
Download 'mediatest2.png' (33 KB)

Preview of image 'mediatest2.png'
mediatest2.png


 

From: Thomas de Groot
Subject: Re: Transition between two medias
Date: 24 Apr 2012 08:15:23
Message: <4f96995b@news.povray.org>
On 24-4-2012 14:06, Thomas de Groot wrote:
>
> This is going in the right direction! I have see how to tweak the
> colours to obtain approximately my original water aspect.
>

Nice! Adding also some turbulence.

Thomas


Post a reply to this message


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

Preview of image 'mediatest2.png'
mediatest2.png


 

From: Thomas de Groot
Subject: Re: Transition between two medias: Final result
Date: 25 Apr 2012 04:22:30
Message: <4f97b446@news.povray.org>
And this is the final result, as seen from a tower on the island 
offshore from Gancaloon.

Thanks Christian!

Thomas


Post a reply to this message


Attachments:
Download 'gancaloon.png' (607 KB)

Preview of image 'gancaloon.png'
gancaloon.png


 

From: Thomas de Groot
Subject: Re: Transition between two medias: Final result
Date: 25 Apr 2012 04:38:44
Message: <4f97b814@news.povray.org>
... and a view from the other side.

Thomas


Post a reply to this message


Attachments:
Download 'gancaloon.png' (993 KB)

Preview of image 'gancaloon.png'
gancaloon.png


 

From: Stephen
Subject: Re: Transition between two medias: Final result
Date: 25 Apr 2012 05:11:10
Message: <4f97bfae$1@news.povray.org>
On 25/04/2012 9:38 AM, Thomas de Groot wrote:
> .... and a view from the other side.
>
> Thomas
> .... and a view from the other side.
>
> Thomas
> .... and a view from the other side.
>
> Thomas

Is that the right image? The lower 3/5 is blank.

-- 
Regards
     Stephen


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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