POV-Ray : Newsgroups : povray.general : Intersecting material kills interior color : Intersecting material kills interior color Server Time
30 Mar 2025 22:57:29 EDT (-0400)
  Intersecting material kills interior color  
From: Cousin Ricky
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


 

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