POV-Ray : Newsgroups : povray.text.scene-files : Source code for "AOI textures for isosurfaces" : Re: Source code for "AOI textures for isosurfaces" Server Time
28 Sep 2024 18:26:57 EDT (-0400)
  Re: Source code for "AOI textures for isosurfaces"  
From: Tor Olav Kristensen
Date: 5 Jun 2003 21:05:41
Message: <Xns9392209102AE3torolavkhotmailcom@204.213.191.226>
"Tek" <tek### [at] evilsuperbraincom> wrote in news:3edfca45$2@news.povray.org:

> Wow, that's a clever trick :)
> 
> Is it possible to rig up a function to use several slope maps (one on
> each axis) to get the surface normal? That way it could work on
> non-isosurfaces. 
> 
> Something like:
> (x-x0)*slope_x(x,y,z) + (y-y0)*slope_y(x,y,z) + (z-z0)*slope_z(x,y,z)
> 
> Would that work?
> I'd try it myself only it's getting kinda late...


I'm not quite sure if I understand what you mean here.

Are you suggesting to actually use the slope_map pattern modifier
or do you mean to use 3 slope functions (one for each component) ?

Please explain more.


Here's a little explanation in the meantime:

The GradX, GradY and GradZ parameters in the macro represents
the 3 components of a non-normalized normal vector of the
corresponding isosurface object.

This vector: <GradX, GradY, GradZ>/f_r(GradX, GradY, GradZ)
-would be the normalized normal vector of the isosurface.

And this vector: <DirX, DirY, DirZ>/f_r(DirX, DirY, DirZ)
- would be the normalized vector from the camera towards
each point on the isosurface.


The dot product of these two vectors is:

(GradX*DirX + GradY*DirY + GradZ*DirZ)
/f_r(GradX, GradY, GradZ)/f_r(DirX, DirY, DirZ)


As long as the primitive is identical to the isosurface formed by
a given function, then one can use the macro in textures and still
get accurate AOI controlled textures.

To see this you can replace the isosurface object in my code with
this:


torus {
  Rmaj, Rmin
  pigment {
    AOI_Function(TorusFn, pCameraLocation)
    color_map {
      [ 0.0 color rgb <2, 0, 0> ]
      [ 1.0 color rgb <0, 2, 0> ]
    }
  }
}


But the problems starts when one are using CSG.


Tor Olav


Post a reply to this message

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