POV-Ray : Newsgroups : povray.general : Intersecting material kills interior color Server Time
1 Apr 2025 16:38:07 EDT (-0400)
  Intersecting material kills interior color (Message 1 to 4 of 4)  
From: Cousin Ricky
Subject: Intersecting material kills interior color
Date: 24 Mar 2025 13:24:11
Message: <67e1953b$1@news.povray.org>
The upper left object has a simple material with interior color, and can
be used as wine.

But suppose you want ripples on the wine's surface?  Simply adding a
normal to the material causes ripples all over, not just on the upper
surface.  The upper right object shows the result.  (I used 'quilt'
instead of ripples to better illustrate the normal.)

The obvious solution, especially if we're creating a macro that can vary
the wine's pour level, is to intersect the top of the wine with a
material that has the normal; but for some reason, this kills the
interior color.  The result is at the lower left.

It turns out that I can get the desired result by applying a naked
texture to the intersecting plane.  This is shown in the object at the
lower right.  But I am still puzzled why using a material failed.

---%<-----%<-----%<-----%<---[BEGIN CODE]---%<-----%<-----%<-----%<---
#version 3.7;

//-------------------- AN ENVIRONMENT ----------------------

camera
{ location <0, 25, -23>
  look_at <0, 2.3, 0>
  right x
  angle 17.5
}
global_settings
{ assumed_gamma 1
  max_trace_level 100
}
light_source
{ <35, 73, -61>, rgb 360000
  fade_distance 0.12
  fade_power 2
  spotlight point_at <0, 2, 0>
  radius -90 falloff 90 tightness 2
}
box
{ -<72, 0.001, 72>, <72, 96, 72>
  hollow
  pigment { rgb 1 }
  finish { diffuse 0.6 ambient rgb 0.1 emission 0 }
}

//----------------------- THE TEST -------------------------

#declare t_Wine = texture
{ pigment { rgbf 1 }
  finish
  { reflection { 1 fresnel } conserve_energy
    specular albedo 0.028 roughness 0.0003
  }
}
#declare m_Wine = material
{ texture { t_Wine }
  interior
  { ior 1.34
    fade_color rgb <0.9, 0, 0.6>
    fade_distance 0.2
    fade_power 1000
  }
}
#declare n_Surface = normal { quilted -0.6 scale 0.5 rotate 45 * y}

intersection // smooth material
{ sphere { y, 1 scale <2, 4, 2> }
  plane { y, 4 }
  hollow
  material { m_Wine }
  translate <-2.25, 0, 3>
}

intersection // material with normal
{ sphere { y, 1 scale <2, 4, 2> }
  plane { y, 4 }
  hollow
  material { m_Wine texture { t_Wine normal { n_Surface } } }
  translate <2.25, 0, 3>
}

intersection // material with intersecting material
{ sphere { y, 1 scale <2, 4, 2> }
  plane
  { y, 4
    material { m_Wine texture { t_Wine normal { n_Surface } } }
  }
  hollow
  material { m_Wine }
  translate <-2.25, 0, -3>
}

intersection // material with intersecting texture
{ sphere { y, 1 scale <2, 4, 2> }
  plane
  { y, 4
    texture { t_Wine normal { n_Surface } }
  }
  hollow
  material { m_Wine }
  translate <2.25, 0, -3>
}
--->%----->%----->%----->%----[END CODE]---->%----->%----->%----->%---


Post a reply to this message


Attachments:
Download 'cutaway_normal_mat.jpg' (59 KB)

Preview of image 'cutaway_normal_mat.jpg'
cutaway_normal_mat.jpg


 

From: Bald Eagle
Subject: Re: Intersecting material kills interior color
Date: 24 Mar 2025 13:50:00
Message: <web.67e19ab5a029623a5a6be6925979125@news.povray.org>
Cousin Ricky <ric### [at] yahoocom> wrote:

> The obvious solution, especially if we're creating a macro that can vary
> the wine's pour level, is to intersect the top of the wine with a
> material that has the normal; but for some reason, this kills the
> interior color.  The result is at the lower left.
>
> It turns out that I can get the desired result by applying a naked
> texture to the intersecting plane.  This is shown in the object at the
> lower right.  But I am still puzzled why using a material failed.

Best I can figure is that your sphere is just a regular thing, and has a default
ior of 1.  But your material has a different ior, and so you might get some sort
of interface where Snell's law applies, and depending on your viewing angle, you
might hit that critical angle.
Not to mention that the quilted normal probably gives you lens-like effects.

Your successful experiment applies the ior to the whole intersection result.

Try it with a different normal, different viewing angle, and try one experiment
where the sphere is given an interior ior as well before intersecting.

Maybe there's a solution in there somewhere. . .

- BW


Post a reply to this message

From: William F Pokorny
Subject: Re: Intersecting material kills interior color
Date: 25 Mar 2025 06:37:51
Message: <67e2877f$1@news.povray.org>
On 3/24/25 13:24, Cousin Ricky wrote:
> The obvious solution, especially if we're creating a macro that can vary
> the wine's pour level, is to intersect the top of the wine with a
> material that has the normal; but for some reason, this kills the
> interior color.  The result is at the lower left.

It's always been the case that the interior{} intersections must be 
'clean' for the fade_* features to work correctly.

Meaning, for the fading calculations there cannot be terminating or 
intervening surfaces unrelated to those forming an interior region.

Your case is, I believe, more complicated in that by referencing the 
'material' wrap of a texture{} and interior{} for the plane in the 
intersection for the lower left case, you've created a situation where 
two different interior{} definitions are seen (that they are identical 
doesn't matter) which are attached to two different transparent surfaces.

Where the starting and stopping intersections are on different surfaces 
with respect to the attached interiors, no fading calculations get done.

Attached is an image where for the lower left case I changed:

   hollow
   material { m_Wine }

to:

   hollow
   texture { pigment {rgb 1 } }

This makes the fade calculation for interior attached to the plane in 
the intersection 'clean'. Not what you want of course, but yep...    	

Bill P.


Post a reply to this message


Attachments:
Download 'cricky.png' (158 KB)

Preview of image 'cricky.png'
cricky.png


 

From: Cousin Ricky
Subject: Re: Intersecting material kills interior color
Date: 25 Mar 2025 11:40:38
Message: <67e2ce76$1@news.povray.org>
On 2025-03-24 13:47 (-4), Bald Eagle wrote:
> 
> Try it with a different normal, different viewing angle, and try one experiment
> where the sphere is given an interior ior as well before intersecting.

I tried all those before posting.

> Maybe there's a solution in there somewhere. . .

Yes, it's on the lower right.


Post a reply to this message

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