POV-Ray : Newsgroups : povray.general : texture cross dissolve Server Time
29 Nov 2024 11:28:06 EST (-0500)
  texture cross dissolve (Message 1 to 4 of 4)  
From: Paul Bourke
Subject: texture cross dissolve
Date: 31 Oct 2005 02:44:37
Message: <pdbNOSPAM-BED860.18442631102005@news.povray.org>
How does one do a cross dissolve between two image based textures 
based upon the clock variable say. I have applied textures for example
{details removed)

  mesh2 {
      vertex_vectors { 4, <>, <>, <>, <> }
      uv_vectors { 4, <,>, <,>, <,>, <,> }
      face_indices { 2, <0,1,2>, <2,3,0> }
      uv_mapping
      texture { texture00 }
      scale <>
      translate <>
   }

Earlier I have defined texture00 and texure01 something like

   #declare texture00 = texture { 
      pigment { image_map { tga "textures/tex00.tga" once } } 
      finish { texfinish } 
   }

So between two time periods I want to cross fade between texture00 
and texture01 dependent on the clock variable.

Certainly reply to this group but an email is good also.

-- 
Paul Bourke
pdb(NOSPAM)swin.edu.au


Post a reply to this message

From: Mike Williams
Subject: Re: texture cross dissolve
Date: 31 Oct 2005 03:08:47
Message: <+bec5CAg$cZDFwY7@econym.demon.co.uk>
Wasn't it Paul Bourke who wrote:
>How does one do a cross dissolve between two image based textures 
>based upon the clock variable say.

Use an average texture_map, with the weights of each texture derived
from the clock variable, something like this

texture {
 average texture_map {
  [1-clock texture00]
  [clock   texture01]
 }
}
-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Paul Bourke
Subject: Re: texture cross dissolve
Date: 1 Nov 2005 02:48:42
Message: <pdbNOSPAM-BC6F84.18483901112005@news.povray.org>
> Wasn't it Paul Bourke who wrote:
> >How does one do a cross dissolve between two image based textures 
> >based upon the clock variable say.
> Use an average texture_map, with the weights of each texture derived
> from the clock variable, something like this
> texture {
>  average texture_map {
>   [1-clock texture00]
>   [clock   texture01]
>  }
> }

Thanks, seems to work a treat.

FYI, I'm putting together an animation flying through the latest release of
the 6dF galaxy survey, 3D positions of 100000 galaxies in the southern
hemisphere. At the start of the animation I will fade from plain soft edge 
white representations of the galaxies to sexy textureed versions
(all aligned with the camera view direction). Near the end of the
animation when we're back out of the southern hemisphere I will 
transition back to white blobs.

Now I currently have perhaps 35 high resolution textures, texture00
is the white blob for the start and end. The textures will be randomly
scaled and rotated to avoid the appearance of duplicates. I've posted
a midframe example to povray.binaries.images with the subject heading 6dF, 
this is one from from a fast (hopefully dramatic) flight of abut 2000 
frames....oh yes, it will in stereoscopic3D as well.

My question now is how can I automate this texture handling without the 
tedious in the way I'm doing it now, just repeating each declaration. 
In the end I hope to have "hundreds" of textures.

So I will have one of these for each texture

#declare texture01 = texture { pigment { image_map { tga "textures/tex01.tga" once } }
finish { texfinish } }
#declare texture02 = texture { pigment { image_map { tga "textures/tex02.tga" once } }
finish { texfinish } }
   :
   :
   etc, 35 times

Then 

#declare TRANS1 = 0.0;
#declare TRANS2 = 0.2;
#declare TRANS3 = 0.8;
#declare TRANS4 = 1.0;

#declare texturemap01 = texture {
   #switch (clock)
   #range (TRANS1,TRANS2)
      average texture_map {
         [ 1-(clock-TRANS1)/(TRANS2-TRANS1) texture00 ]
         [   (clock-TRANS1)/(TRANS2-TRANS1) texture01 ]
      }
      #break
   #range (TRANS3,TRANS4)
      average texture_map {
         [   (clock-TRANS3)/(TRANS4-TRANS3) texture00 ]
         [ 1-(clock-TRANS3)/(TRANS4-TRANS3) texture01 ]
      }
      #break
   #else
      texture01
      #break
   #end
}

-- 
Paul Bourke
pdb(NOSPAM)swin.edu.au


Post a reply to this message

From: Christoph Hormann
Subject: Re: texture cross dissolve
Date: 1 Nov 2005 07:54:50
Message: <dk7odk$nbh$1@chho.imagico.de>
Paul Bourke wrote:
> 
> My question now is how can I automate this texture handling without the 
> tedious in the way I'm doing it now, just repeating each declaration. 
> In the end I hope to have "hundreds" of textures.
> 
> So I will have one of these for each texture
> 
> #declare texture01 = texture { pigment { image_map { tga "textures/tex01.tga" once }
} finish { texfinish } }
> #declare texture02 = texture { pigment { image_map { tga "textures/tex02.tga" once }
} finish { texfinish } }
>    :
>    :
>    etc, 35 times

Use arrays:

#declare Textures=array[35]

#local Cnt=0;

#while (Cnt<35)
   #declare Textures[Cnt] =
     texture {
       pigment {
         image_map {
           tga concat("textures/tex",str(-2, 0, Cnt),".tga")
           once
         }
       }
       finish { texfinish }
     }
   #local Cnt=Cnt+1;
#end

(Untested - could contain errors)

Note you should be careful with using all lower case custom identifiers 
- if future versions of POV-Ray introduce keywords with the same name 
your scene will get incompatible.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 31 Oct. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

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