POV-Ray : Newsgroups : povray.binaries.images : isosurface lighting problem. : Re: isosurface lighting problem. Server Time
7 Aug 2024 19:23:16 EDT (-0400)
  Re: isosurface lighting problem.  
From: Alain
Date: 30 Dec 2005 12:34:00
Message: <43b56f88@news.povray.org>
Hasan3 nous apporta ses lumieres en ce 2005-12-29 07:39:
> "Josh" <s### [at] acom> wrote:
> 
>>Did all the objects have a texture applied, I've seem similar this if there
>>one object without a texture.
> 
> 
> Josh , Obje2 and Object4 are isosurface. And  have a same texture. Source
> code :
> 
> 
> 
> global_settings {
>   max_trace_level 5
>   assumed_gamma 1.2
>   ambient_light rgb 0
> 
> }
> 
> #include "colors.inc"
> #include "shapes.inc"
> #include "functions.inc"
> 
>   //*camera //--------------------------------------------------------------
>     camera {
>             perspective
>             location  <2.36351653729229,6.93219315555339,-6.80013009112446>
>             look_at   <11.7789531128032,3.12385465710533,5.38224681168665>
>     }
> 
> 
> 
> 
> //*Işık
> //--------------------------------------------------------------
> //------------------------------------------------------------------------
>   light_source {<-3.93798798921654,28.3416665636843,-14.8981105229398>
>         color rgb <1,1,1>*3
>   }
> 
> 
>  #declare mat_white =
>   texture {
>     pigment {  color rgb <0.1,0.5,0.3>}
> 
>     finish{
>             ambient 0.5
>             diffuse 0.7
>     }
>   }
> 
> 
> #declare Obje1=
>    box
>
{<8.07895311280318,0,7.58224681168665>,<12.5099417562586,3.12385465710533,-0.143131111903111>
>    texture {mat_white}
>  }
> 
> 
> 
> 
> #declare Obje3=
>    prism {
>       linear_sweep
>       linear_spline
>         0,
>         0.8,
>          9,
>        <1.6,0.6>,
>        <3.5,0.4>,
>        <5.8,0.8>,
>        <7.6,0.5>,
>        <5.6,0.6>,
>        <3.4,0.2>,
>        <1.7,0.4>,
>        <9.99999999999996E-02,-0.1>
>        <0,0>
>  translate <8.4,0.465846756827856,7.8>
> 
>   texture {mat_white}
>   Rotate_Around_Trans(-x*90,<8.4,0.465846756827856,7.8>)
>   Rotate_Around_Trans(-y*-90,<8.4,0.465846756827856,7.8>)
> 
> }
> 
> #declare Obje2=
> //---------------Isosurface--------------------------------------
>    isosurface {
>          function {sqrt(x*x + y*y + z*z) - 1 + f_noise3d(x*8, y*8,z*8)*0.25}
>          threshold 0
>          contained_by {box {<-1,-1,-1>, < 1, 1, 1>}}
>          accuracy   0.001
>          max_gradient 4
>          scale  <1.05,0.45,0.95>
>          texture {mat_white}
>          translate <8.52895311280318,3.15932827355748,-0.193131111903108>
>  }
> 
> #declare Obje4=
> //---------------Isosurface--------------------------------------
>    isosurface {
>      function {sqrt(x*x + y*y + z*z) - 1 + f_noise3d(x*8, y*8,z*8)*0.25}
>      threshold 0
>      contained_by {box {<-1,-1,-1>, < 1, 1, 1>}}
>      accuracy   0.001
>      max_gradient 4
>      scale  <0.3,0.2,3>
>      texture {mat_white}
>      translate <8.07895311280318,3.04726354996945,2.75686888809689>
>   }
> 
> #declare Obje5=
>  sphere {
>    <8.28069185181685,2.94789039307405,7.28398555070032>
>    0.58309518948453
>    texture {mat_white}
> }
> 
> #declare Obje6=
>  sphere {
>    <12.0806918518169,2.94789039307405,-1.60144492996793E-02>
>    0.58309518948453
>    texture {mat_white}
> }
> 
> #declare Obje7=
>  sphere {
>    <10.3806918518169,2.94789039307405,-0.216014449299679>
>    0.58309518948453
>    texture {mat_white}
>  }
> 
> #declare Obje8=
>  cylinder {
>    <10.4,1.47427676948369,-0.2>, <10.4,-0.125723230516308,-0.2>,
> 0.282842712474619
>    texture {mat_white}
>   }
> #declare Obje9=
>    box {<7.9,0,0.4>,<8.5,2,-0.4>
>    texture {mat_white}
>  }
> 
> 
> difference {
>  object {Obje1}
>  object {Obje2}
>  object {Obje3}
>  object {Obje4}
>  object {Obje5}
>  object {Obje6}
>  object {Obje7}
>  object {Obje8}
>  object {Obje9}
> }
> 
A slighr imporvement suggestion: when all elements of a CSG object share the same
texture, it's 
preferable to apply the texture to the whole rather than to each individual
components.
Tha advantages are that the texture deffinition is only present once, saving some
memory (this can 
prevent swapping in very complex scenes). It's also easier to maintain and make
cleaner code (easier 
to read). Can be somewhat faster to parse and render.

-- 
Alain
-------------------------------------------------
42.7 percent of all statistics are made up on the spot.


Post a reply to this message

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