POV-Ray : Newsgroups : povray.unofficial.patches : For fun: half full glass : Re: For fun: half full glass Server Time
2 Sep 2024 08:12:56 EDT (-0400)
  Re: For fun: half full glass  
From: Chris Huff
Date: 15 Apr 2000 12:46:01
Message: <chrishuff_99-D71689.11484415042000@news.povray.org>
In article <38F8879E.732977CB@my-dejanews.com>, 
gre### [at] my-dejanewscom wrote:

> Is there a procedural way to set up a cylinder so that it looks like
> it's half full of liquid--liquid that refracts, interacts with photons,
> etc?   I know how to make the whole cylinder look like a liquid: I want
> to be able to animate the level at which the liquid resides, etc.

What do you mean by "procedural"? Isosurfaces? Macros? Or just CSG? Or 
do you want to do the whole thing with just textures? It would be done 
with a CSG macro like this:

#macro Tube(ORad, IRad, TubeHeight, LiquidHeight, Open, GlassMaterial, 
LiquidMaterial)
    #local Thk = ORad-IRad;// wall thickness
    union {
        difference {
            cylinder {< 0, 0, 0>, < 0, TubeHeight, 0>, ORad}
            #if(Open = yes)
                cylinder {< 0, Thk, 0>, < 0, TubeHeight+Thk, 0>, IRad}
            #else
                cylinder {< 0, Thk, 0>, < 0, TubeHeight-Thk, 0>, IRad}
            #end
            material {GlassMaterial}
        }
        cylinder {< 0, Thk, 0>, < 0, LiquidHeight, 0>, IRad*1.001
            material {LiquidMaterial}
        }
#end

#declare LiqMat =
material {
    texture {
        pigment {color Green filter 0.8}
    }
    interior {
        ior 1.1
    }
}
#declare GlassMat =
material {
    texture {
        pigment {color White filter 0.95}
    }
    interior {
        ior 1.3
    }
}

Tube(0.5, 0.45, 2, 1.3, yes, GlassMat, LiqMat)
    translate < 1, 0.001, 0>
}
Tube(0.5, 0.45, 2, 1, no, GlassMat, LiqMat)
    translate <-1, 0.001, 0>
}


> I tried this a few times with setting up a gradient y in the pigment,
> but this never had quite the right effect.  Are there interior maps or
> is there some way to do this with the pigment?

No, there is no "interior map"(and "material_map" is completely 
unrelated). Things like varying ior are hard to calculate, and would be 
quite slow.
You could get varying colors and amounts of filter with a pigment, but 
you can't get different iors for the liquid and the glass that way, and 
it probably wouldn't look very good up close.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

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