POV-Ray : Newsgroups : povray.newusers : how to render a transparent cube Server Time
2 Jun 2024 13:58:48 EDT (-0400)
  how to render a transparent cube (Message 1 to 8 of 8)  
From: chenfanfu jiang
Subject: how to render a transparent cube
Date: 27 Dec 2011 05:30:01
Message: <web.4ef99d082d2b0fb7e9c69f4b0@news.povray.org>
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?


Post a reply to this message

From: Stephen
Subject: Re: how to render a transparent cube
Date: 27 Dec 2011 06:00:50
Message: <4ef9a562$1@news.povray.org>
On 27/12/2011 10:25 AM, chenfanfu.jiang 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?
>
>

Without the code it is just guesswork but are you using union instead of 
merge?

See the help 2.2.3.5 CSG Merge

-- 
Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: how to render a transparent cube
Date: 27 Dec 2011 17:58:28
Message: <4efa4d94@news.povray.org>

>
> 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

From: chenfanfu jiang
Subject: Re: how to render a transparent cube
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

From: chenfanfu jiang
Subject: Re: how to render a transparent cube
Date: 27 Dec 2011 19:55:02
Message: <web.4efa684ff1937dc6e9c69f4b0@news.povray.org>
I'm now using a difference of a box and [4 spheres]. Please see my code. I still
cannot get the refraction effect like my referred image

Stephen <mcavoys_at@aoldotcom> wrote:
> On 27/12/2011 10:25 AM, chenfanfu.jiang 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?
> >
> >
>
> Without the code it is just guesswork but are you using union instead of
> merge?
>
> See the help 2.2.3.5 CSG Merge
>
> --
> Regards
>      Stephen


Post a reply to this message

From: Alain
Subject: Re: how to render a transparent cube
Date: 29 Dec 2011 23:53:58
Message: <4efd43e6@news.povray.org>

>
> Thank you for the reply!
> Here is my code, I have modified it but the result still looks weird.
>
I added this as I use version 3.7:
#version 3.7;
MUST be the first statement.

> #include "colors.inc"
> #include "shapes.inc"
> #include "textures.inc"
> #include "glass.inc"
>
>
> global_settings {
>      assumed_gamma 2.2
You should use assumed_gamma 1 to get acurate results.
Set file_gamma to 2.2 OR srgb (if using version 3.7) in povray.ini

>      max_trace_level 5
You realy need a larger value.
I used this:
max_trace_level 30
adc_bailout 0.01

and got trace level of 27/30.
Some of the lines you see are caused by reatching max_trace_level to soon.

>
>      photons {
>          count 20000
>      }
OK
> }
>
> #declare LIGHT_FADING_DIST = 20.0;
Excessively long. I'd use something like 1 and increase the light's 
intensity as needed.
Idealy, for a point light, it should be something like 1e-5 and a light 
intensity in the millions. A value of 1 is a good compromise.
For an area_light, it should be the sixe of the light.

>
> background { Gray50 }
>
Why do you use 4 lights? Especialy in the testing phase, one light 
should be enough.
I tested with this one replacing your first and commented out the other 3:

#declare LIGHT_FADING_DIST = 1;

light_source {
     < 0, 10,  -3>  rgb 45
     fade_distance LIGHT_FADING_DIST fade_power 2
}

> light_source {
>      <  0, 4,  0>  color Gray60
>      fade_distance LIGHT_FADING_DIST fade_power 2
>
>      photons {
>          reflection on
>          refraction on
>      }

This photons block is not needed as you use the default one for any 
light_source.

> }
>
> 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}
> }
Personaly, I prefer to use variable reflection for anything that is not 
a mirror.

>
> 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 }

Would be beter to use pigment{rgbt 1}
pigment{rgbt 0.98} is also acceptable.
The pigment in in the mass, not at the surface.

>
>          finish {
>              phong 1 phong_size 30
>              reflection 0.01

That reflection is totaly unrealistic. You should use variable 
reflection with the fresnel option:
reflection{0.01, 0.9 fresnel}

>          }
>      }
>
>      interior {
>          ior 1.34
>          fade_color Red
>          fade_distance 10

Shorten this to about 0.2 to 0.4
I got good looking result using 0.33

fade_distance is the key parameter to controll the intensity of fading 
interior.

>          fade_power 1001
>      }
> }
>
> object {
>      jello
>
>
>      photons {
>          target
>          reflection on
>          refraction on
>      }
> }
>
>
>

Your original render used an area_light. Probably the one from the 
include menu. It's array, at 4 by 4, is realy to sparce, and with the 
use of jitter, lead to some very grainy penumbrae. Without jitter, you 
get strong banding.

You should use a much higher density and add adaptive.
I commonly use this:
area_light x,z 17,17 adaptive 0 //for testing, may need adaptive 1 or 2.
I often also use circular orient to simulate a spherical light_source.

This area_light can be about as fast as the one from the include menu.



Alain


Post a reply to this message

From: chenfanfu jiang
Subject: Re: how to render a transparent cube
Date: 30 Dec 2011 03:30:00
Message: <web.4efd75cef1937dc6e9c69f4b0@news.povray.org>
Thank you very much!
I am using v3.6. I changed the code according to your advice. The new rendering
result has some strange white light regions on the jello surface. How can I get
rid of that? (I can see it does not appear when I change ior to 1.0).

Also, if you could please look at the sample image
(http://s7.postimage.org/g4a0ahgrf/Untitled.png) again, you can see very shiny
effect inside it. I'm also wondering how to get a photon mapping like that? I
can tell it is not a result of scattering media.

Thanks again!
Current code:

#version 3.6;

#include "colors.inc"

global_settings {
    assumed_gamma 1
    max_trace_level 30
    adc_bailout 0.01
    photons {
        count 20000
    }
}

background { Gray50 }

#declare LIGHT_FADING_DIST = 1;

light_source {
     < 0, 10,  -3>  rgb 45
     fade_distance LIGHT_FADING_DIST fade_power 2
     area_light x,z 17,17 adaptive 2
     jitter
     circular orient
}

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

camera {
    location  <0, 1., -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*25

    texture {

        pigment{rgbt 1}

        finish {
            phong 1 phong_size 30
            reflection{0.01, 0.9 fresnel}
        }
    }

    interior {
        ior 1.4
        fade_color Red
        fade_distance 0.33
        fade_power 1001
    }
}

object {
    jello

    photons {
        target
        reflection on
        refraction on
    }
}



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

> >
> > Thank you for the reply!
> > Here is my code, I have modified it but the result still looks weird.
> >
> I added this as I use version 3.7:
> #version 3.7;
> MUST be the first statement.
>
> > #include "colors.inc"
> > #include "shapes.inc"
> > #include "textures.inc"
> > #include "glass.inc"
> >
> >
> > global_settings {
> >      assumed_gamma 2.2
> You should use assumed_gamma 1 to get acurate results.
> Set file_gamma to 2.2 OR srgb (if using version 3.7) in povray.ini
>
> >      max_trace_level 5
> You realy need a larger value.
> I used this:
> max_trace_level 30
> adc_bailout 0.01
>
> and got trace level of 27/30.
> Some of the lines you see are caused by reatching max_trace_level to soon.
>
> >
> >      photons {
> >          count 20000
> >      }
> OK
> > }
> >
> > #declare LIGHT_FADING_DIST = 20.0;
> Excessively long. I'd use something like 1 and increase the light's
> intensity as needed.
> Idealy, for a point light, it should be something like 1e-5 and a light
> intensity in the millions. A value of 1 is a good compromise.
> For an area_light, it should be the sixe of the light.
>
> >
> > background { Gray50 }
> >
> Why do you use 4 lights? Especialy in the testing phase, one light
> should be enough.
> I tested with this one replacing your first and commented out the other 3:
>
> #declare LIGHT_FADING_DIST = 1;
>
> light_source {
>      < 0, 10,  -3>  rgb 45
>      fade_distance LIGHT_FADING_DIST fade_power 2
> }
>
> > light_source {
> >      <  0, 4,  0>  color Gray60
> >      fade_distance LIGHT_FADING_DIST fade_power 2
> >
> >      photons {
> >          reflection on
> >          refraction on
> >      }
>
> This photons block is not needed as you use the default one for any
> light_source.
>
> > }
> >
> > 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}
> > }
> Personaly, I prefer to use variable reflection for anything that is not
> a mirror.
>
> >
> > 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 }
>
> Would be beter to use pigment{rgbt 1}
> pigment{rgbt 0.98} is also acceptable.
> The pigment in in the mass, not at the surface.
>
> >
> >          finish {
> >              phong 1 phong_size 30
> >              reflection 0.01
>
> That reflection is totaly unrealistic. You should use variable
> reflection with the fresnel option:
> reflection{0.01, 0.9 fresnel}
>
> >          }
> >      }
> >
> >      interior {
> >          ior 1.34
> >          fade_color Red
> >          fade_distance 10
>
> Shorten this to about 0.2 to 0.4
> I got good looking result using 0.33
>
> fade_distance is the key parameter to controll the intensity of fading
> interior.
>
> >          fade_power 1001
> >      }
> > }
> >
> > object {
> >      jello
> >
> >
> >      photons {
> >          target
> >          reflection on
> >          refraction on
> >      }
> > }
> >
> >
> >
>
> Your original render used an area_light. Probably the one from the
> include menu. It's array, at 4 by 4, is realy to sparce, and with the
> use of jitter, lead to some very grainy penumbrae. Without jitter, you
> get strong banding.
>
> You should use a much higher density and add adaptive.
> I commonly use this:
> area_light x,z 17,17 adaptive 0 //for testing, may need adaptive 1 or 2.
> I often also use circular orient to simulate a spherical light_source.
>
> This area_light can be about as fast as the one from the include menu.
>
>
>
> Alain


Post a reply to this message

From: Alain
Subject: Re: how to render a transparent cube
Date: 30 Dec 2011 21:51:36
Message: <4efe78b8@news.povray.org>

>
> Thank you very much!
> I am using v3.6. I changed the code according to your advice. The new rendering
> result has some strange white light regions on the jello surface. How can I get
> rid of that? (I can see it does not appear when I change ior to 1.0).
>
> Also, if you could please look at the sample image
> (http://s7.postimage.org/g4a0ahgrf/Untitled.png) again, you can see very shiny
> effect inside it. I'm also wondering how to get a photon mapping like that? I
> can tell it is not a result of scattering media.
>
> Thanks again!

You can reduce the transparency value of the pigment.
Example:
pigment{rgbt<1,1,1,0.7>}

You can try reducing the maximum reflection value.
Example:
reflection{0.01, 0.7 fresnel}

It's possible that the reference image use an unrealistic ior value.
It's also possible that it contains some emissive media.
It may use intside_texture with a larger reflection value and less 
transmition.
It may have been post processed.


Post a reply to this message

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