POV-Ray : Newsgroups : povray.binaries.images : Galactic Apples (or "Using perspective in cel shading") Server Time
15 Aug 2024 18:20:58 EDT (-0400)
  Galactic Apples (or "Using perspective in cel shading") (Message 1 to 1 of 1)  
From: Batronyx
Subject: Galactic Apples (or "Using perspective in cel shading")
Date: 2 May 2002 00:30:55
Message: <3cd0c0ff@news.povray.org>
I've been catching up on some of my newsgroup reading tonight and noticed a
few large cel-shading threads. Someone mentioned the need for an orthographic
camera when using slope pattern as the method. I thought I would share the
following ( not cel shaded ) as a workaround. I figured this out some months
ago when I was playing with cel-shading and used the technique in this idea
I was toying with -- but never fully developed -- for the World Within Worlds
round of the IRTC Stills Comp.

Basically the way to use perspective is to align the slope direction vector
to point from the center of the object back to the camera, and avoid extreme
wide-angle shots ( i.e. smallish 'angle' values or longer 'direction' vectors)

Some snippets of code from this image:
<SDL>
camera {
  location  <-2.0, 0.5, -20.0>
  //direction 10.5*z
  up y
  right     x*image_width/image_height
  angle 37
  rotate <30,0,0>
  /**/
  aperture 0.40
  blur_samples 250
  focal_point <4,0,5>
  confidence 0.99
  variance 1/200
  look_at   <2.0, 0.0,  4.0>
}
#declare CamPos = <-2.0, 0.5, -20.0>;
#declare CamPos = vrotate(CamPos,<30,0,0>);
.
.
.
textures, objects, etc.
.
.
.
#declare o=<0,0,0>;
#declare Count = 0;
#declare MySeed = seed(13);
#while ( Count < 20 )
   #local ThisApple = object{apple }//object apple declared without a texture.
   #local This_Rot = transform { rotate <0,rand(MySeed)*360,0>}
   #local This_Trans = transform {translate
<int(rand(MySeed)*20)-5,0,int(rand(MySeed)*30)-4>}
   #local This_Pt = vtransform(o,This_Trans);
   #local This_tx = texture {Tx_apple_outer rotate <0,rand(RotSeed)*360,0>}
   #declare ThisApple = object{ThisApple
      texture{slope {-(CamPos - This_Pt)}
         texture_map {
            [0  pigment {transmit 1}]
            [.27 pigment {transmit 1}]
            [0.33 This_tx ]
            [1.0 This_tx ]
         }
      }
      interior_texture { pigment {  Zstars}}
      Align_Trans(ThisApple, -y, -1*y)
      transform {This_Trans}
   }

   object{ThisApple}
   object {stem
      transform {This_Rot}
      Align_Trans(stem, -y, (max_extent(ThisApple).y - .15))
      transform{This_Trans}
   }
   object {arGx[mod(Count,5)]
      scale 2.5
      Reorient_Trans(-z,This_Pt-CamPos)
      transform {This_Trans}
   }

   #declare Count = Count +1;
#end
</SDL>

As you can see here, for this to work I have to apply the textures _after_
the object is located, here implemented in a loop. Notice that I use the
declared camera position and precalculated object location both in the
slope pattern and to align the galaxy objects to the camera.

Of course even this won't work in _every_ instance. You'll have to use some
other technique to create cartoon edges on something like looking up at a
skyscraper.

--
light_source{0,1}#macro c(J,a)sphere{0,1pigment{rgb z}scale a translate J+O}
#end#macro B(R,V,O)c(0,4)intersection{c(V,R)difference{c(-z*4x+10)c(-z*4.1x+
10)c(0<7.5,45,5>)}}#end B(12,0z*25)B(8y*4<0,12,50>)          // Batronyx ^"^


Post a reply to this message


Attachments:
Download 'GalacticApples1.jpg' (122 KB)

Preview of image 'GalacticApples1.jpg'
GalacticApples1.jpg


 

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