POV-Ray : Newsgroups : povray.binaries.scene-files : Simple Slideshow Server Time: 19 Dec 2018 07:05:49 GMT
  Simple Slideshow (Message 1 to 3 of 3)  
From: Dave Blandston
Subject: Simple Slideshow
Date: 26 Nov 2018 08:10:02
Message: <web.5bfba9e2f87b8c8779416a1f0@news.povray.org>
Hi friends,

Here's the code for a very simple slideshow. It doesn't have very many settings.
It's excerpted from a more complex animation that I'm working on. It displays
any number of slides with a fade-out and fade-in between each one. It starts and
ends with slides faded all the way in.

The .zip file contains the slideshow POV code, three sample slides, and an .ini
file suitable for a five second, thirty-frame-per-second animation.

I hope someone finds this useful!

Regards,
Dave Blandston


Post a reply to this message


Attachments:
Download 'slideshow.zip' (259 KB)

From: Dave Blandston
Subject: Re: Simple Slideshow
Date: 26 Nov 2018 17:40:01
Message: <web.5bfc2ec91e20253b79416a1f0@news.povray.org>
Oops, both planes should have the "no_radiosity" attribute.

Regards,
Dave Blandston


Post a reply to this message

From: Dave Blandston
Subject: Re: Simple Slideshow
Date: 27 Nov 2018 22:05:01
Message: <web.5bfdbede1e20253b79416a1f0@news.povray.org>
Well, the fading could have been done in a better way. I doubt anyone will ever
use this but just in case here's a better version:

-------------------

//-f

#version 3.7;

global_settings {assumed_gamma 2.2}

#include "colors.inc"

#local CameraZ = 1;

camera {
   location <0, 0, -CameraZ>
   right (16/9) * x //Use 16:9 aspect ratio
   direction <0, 0, 1>
   look_at <0, 0, 0>
} //camera

background {DarkOliveGreen}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */
/* *
                                    * */
/* *
                                    * */
/* * SLIDESHOW SETTINGS
                                    * */
/* *
                                    * */
/* *
                                    * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */

#local NSlides = 3;
//Number of slides (should all be the same dimensions, named "Slide_00.png"
"Slide_01.png" etc.

#local NSeconds = 5;
//Total time in seconds the slideshow will last. Render NSeconds * (number of
frames per second) frames.

#local SlideFadeRate = .5;
//Amount of time in seconds for a new slide to fade in or out.
//Note that each slide transition will take 2 * SladeFadeRate seconds (one slide
will fade out, then the
//next slide will fade in.)

#local FadeColor = Red * .45;
//Color to fade to and from.

#local SinusoidalTransition = yes;
//Set to "yes" for a sinusoidal transition rate, "no" for a linear transition
rate.

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */
/* *
                                    * */
/* *
                                    * */
/* * SLIDE SHOW
                                    * */
/* *
                                    * */
/* *
                                    * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * */

#local CurrentClock = clock * NSeconds;

#local TransitionTime_Total = SlideFadeRate * 2 * (NSlides - 1);
#local NonTransitionTime_Total = NSeconds - TransitionTime_Total;

#if (TransitionTime_Total > NSeconds)
   #error "Transition time exceeds total slideshow time. Increase the length of
the slideshow (NSeconds) or decrease the transition time (SlideFadeRate.)"
#end //#if

#local TransitionTime_FadeIn = array [NSlides]
#local TransitionTime_None = array [NSlides]
#local TransitionTime_FadeOut = array [NSlides]

#for (I, 0, NSlides - 1)
   #local TransitionTime_None [I] = I * NonTransitionTime_Total / NSlides + I *
SlideFadeRate * 2;
#end //#for

#for (I, 0, NSlides - 1)
   #local TransitionTime_FadeOut [I] = TransitionTime_None [I] +
NonTransitionTime_Total / NSlides;
#end //#for

#for (I, 0, NSlides - 1)
   #local TransitionTime_FadeIn [I] = TransitionTime_None [I] - SlideFadeRate;
#end //#for

#for (I, 0, NSlides - 1)
   #if (CurrentClock >= TransitionTime_FadeIn [I])
      #local CurrentSlideNumber = I;
      #local FadeRatio = (CurrentClock - TransitionTime_FadeIn [I]) /
SlideFadeRate;
   #end //#if
   #if (CurrentClock >= TransitionTime_None [I])
      #local FadeRatio = 1;
   #end //#if
   #if (CurrentClock >= TransitionTime_FadeOut [I])
      #local FadeRatio = (TransitionTime_FadeOut [I] + SlideFadeRate -
CurrentClock) / SlideFadeRate;
   #end //#if
#end //#for

#local SlideFileName = concat ("Slide_", str (CurrentSlideNumber, -2, 0),
".png")
#local SlideImagePigment = pigment {image_map {png SlideFileName gamma 2.2
map_type 0 interpolate 2 once}}
#local SlideColor = texture {SlideImagePigment finish {emission 1}}
#local SlideImageResolution = max_extent (SlideImagePigment);
#local SlideScale = CameraZ / max (SlideImageResolution.x,
SlideImageResolution.y);

#if (SinusoidalTransition)
   #local Angle = FadeRatio * 180 + 180;
   #local FadeRatio = (cos (radians (Angle)) + 1) / 2;
#end //#if

#local TransitionColor = texture {pigment {color FadeColor} finish {emission 1}}

#local XColor = texture {
   average
   texture_map {
      [FadeRatio SlideColor]
      [1 - FadeRatio TransitionColor]
   } //texture_map
} //texture

#local Slide = object {
   #local W = SlideImageResolution.x;
   #local H = SlideImageResolution.y;
   plane {
      z, 0
      clipped_by {box {<0, 0, -.1> <1, 1, .1>}}
      texture {XColor}
   } //plane
   scale <W, H, 1>
   translate <-W / 2, -H / 2, 0>
   scale <SlideScale, SlideScale, 1>
} //object

object {Slide}


Post a reply to this message

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