POV-Ray : Newsgroups : povray.newusers : how to render a transparent cube : Re: how to render a transparent cube Server Time
28 Sep 2024 17:56:29 EDT (-0400)
  Re: how to render a transparent cube  
From: chenfanfu jiang
Date: 27 Dec 2011 19:55:01
Message: <web.4efa67f3f1937dc6e9c69f4b0@news.povray.org>
Thank you for the reply!
Here is my code, I have modified it but the result still looks weird.

#include "colors.inc"
#include "shapes.inc"
#include "textures.inc"
#include "glass.inc"


global_settings {
    assumed_gamma 2.2
    max_trace_level 5

    photons {
        count 20000
    }
}

#declare LIGHT_FADING_DIST = 20.0;

background { Gray50 }

light_source {
    < 0, 4,  0> color Gray60
    fade_distance LIGHT_FADING_DIST fade_power 2

    photons {
        reflection on
        refraction on
    }
}

light_source {
    < 10, 4,  10> color Gray60
    fade_distance LIGHT_FADING_DIST fade_power 2

    photons {
        reflection on
        refraction on
    }
}

light_source {
    < -10, 4, 10> color Gray60
    fade_distance LIGHT_FADING_DIST fade_power 2

    photons {
        reflection on
        refraction on
    }
}

light_source {
    < 0, 0, -20> color Gray80
    fade_distance LIGHT_FADING_DIST fade_power 2

    photons {
        reflection on
        refraction on
    }
}



plane {
    y, -3
    pigment { color Gray50 }
    finish { reflection 0.35}
}

camera {
    location  <2, 1.5, -2>
    look_at   <0,0,  0>

}

#declare jello=
difference {
    box { <-0.5,-0.5,-0.5>, <0.5,0.5,0.5> }

    union {
        sphere {<5.47349,0,0>, 5.02349}
        sphere {<-5.47349,0,0>, 5.02349}
        sphere {<0,5.47349,0>, 5.02349}
        sphere {<0,-5.47349,0>, 5.02349}
        sphere {<0,0,5.47349>, 5.02349}
        sphere {<0,0,-5.47349>, 5.02349}
    }

    //rotate y*45
    rotate x*45

    texture {

        pigment { Red filter .98 }

        finish {
            phong 1 phong_size 30
            reflection 0.01
        }
    }

    interior {
        ior 1.34
        fade_color Red
        fade_distance 10
        fade_power 1001
    }
}

object {
    jello


    photons {
        target
        reflection on
        refraction on
    }
}




Alain <aze### [at] qwertyorg> wrote:

> >
> > I am trying to render jello. What I get is
> > http://s18.postimage.org/86nwkrp4p/jello.png
> > There are crossing lines on the surface. I really want to get something like
> > http://s7.postimage.org/g4a0ahgrf/Untitled.png
> >
> > I guess there's something wrong in my refraction? Could anyone help me?
> >
> >
>
> Your image looks mostly correct as it is. The lines you see are due to
> total internal reflection. They line up perfectly because you use a
> simple box object, while your reference have faces caving in.
> You can acheive that using a difference starting with a box and removing
> bits of the faces with large spheres, with a mesh object or some other ways.
>
> jello is mostly water. A correct ior should be between 1.33 and 1.34.
> It's colouration is in the mass, not at the surface. You should use
> fade_color Colour fade_distance Lenght fade_power 1 (or 1001).
>
> The sample image seems to be using photons. Please read about it in the
> ducumentation. You need a photons{} block in the global_settings and
> another for the object itself.
>
> The code for your jello should help find any eventual problem.
>
>
> Alain


Post a reply to this message

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