POV-Ray : Newsgroups : povray.bugreports : sphere slicing problem : Re: sphere slicing problem Server Time
16 Apr 2024 03:41:30 EDT (-0400)
  Re: sphere slicing problem  
From: Bald Eagle
Date: 14 Oct 2019 12:15:00
Message: <web.5da49e3c401c58094eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> (replying to both you and Bald Eagle here)
>
> think BE is right in that it is probably a "small, simple" thing.  currently
> thinking it may be the camera.

Nope.  It's putting textures in too early.  The clear texture is what eliminates
the surface[s] of the slice.

I tried this and it looks ok to me.

try this fix, where I moved your sphere texture to the final object {} and
commented out the hollow and texturing of your slicing box.

In reality, nothing should have any textures normals or finishes, and you should
do it ALL in the final object {}.




#version 3.8;

// macro snipped from its .inc file.
#declare SR_EPS = 0.001;

#macro sr_slice(o_, r_, n_)
//  #if (sr_chk_res(r_))
//    #error "oops, bad resolution.\n"
//  #elseif (sr_chk_obb(o_))
//    #error "oops, bad object position/dimension.\n"
//  #end
  #local lb_ = min_extent(o_);
  #local ub_ = max_extent(o_);
  #local D_ = ub_ - lb_;
  /* oversize(d) slice */
  #local tx_ = D_.x * .1;
  #local tz_ = D_.z * .1;
  /* number slices + thickness + offset */
  #local N_ = int(D_.y * r_.y + .5);
  #local T_ = D_.y / N_;
  #local O_ = T_ * n_;
  /* verify {n_} is in range */
  #if ((0 > n_) | (N_ <= n_))
    #error "oops, bad frame/slice number.\n"
  #end
  #local S_ = box {
    <lb_.x-tx_, O_, lb_.z-tz_>-SR_EPS, <ub_.x+tx_, O_+T_, ub_.z+tz_>+SR_EPS
    no_reflection no_shadow
    //texture {pigment {colour srgbt 1}}
  };
  intersection {
    object {o_}
    object {S_}
  }
#end


/* environment */

global_settings {assumed_gamma 1}

background {colour srgb 0}


/* lights */
#if (1)
  /* white lights at corners of an imaginary cube */
  #local LD = 50;
  #local Lpos = array [8] {
    <-LD,LD,-LD>, <LD,LD,-LD>, <-LD,-LD,-LD>, <LD,-LD,-LD>,
    <-LD,LD,LD>, <LD,LD,LD>, <-LD,-LD,LD>, <LD,-LD,LD>
  };
  #for(I_,0,7)
    light_source {Lpos[I_] srgb 1 parallel shadowless}
  #end
#else
  /* white lights along axes */
  #local LD = 50;
  #local Lpos = array [6] {
    <-LD,0,0>, <LD,0,0>, <0,-LD,0>, <0,LD,0>, <0,0,-LD>, <0,0,LD>
  };
  #for(I_,0,5)
    light_source {Lpos[I_] srgb 1 parallel shadowless}
  #end
#end


/* object.
 * fully textured and scaled, its bounding box must run from origin
 * to positive, small-ish <x,y,z>.
 */

#declare Obj = sphere {0,1
  translate +1
};

//#debug concat("min: <",vstr(3,min_extent(Obj),",",0,6),">\n")
//#debug concat("max: <",vstr(3,max_extent(Obj),",",0,6),">\n")


/* cameras.
 * perspective for development, orthographic for slicing.
 */

#if (1)
  camera {
    orthographic
    location <1,5,1>
    look_at <1,0,1>
    sky <0,0,1>
    angle 50
  }
#else
  camera {
    perspective
    location <1,1,-5>
    look_at <1,1,1>
    up <0,1,0>
    right x * (image_width/image_height)
  }
#end

// only Y matters.
#declare Res = <10,100,10>;

//sr_feedback(Obj,Res)
object {sr_slice(Obj,Res,frame_number) texture {pigment {srgb <1,0,0>}} }


Post a reply to this message

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