the return of the Fade into history

| No Comments
I was prepping the Fade Into History filter that I had written as a tutorial here for the Pixel Bender Exchange. I realized how much the language had changed since I first wrote it. So in addition to having it on the exchange, I thought I'd post the updated source here, so that you could have it. Also, I'm including the .pbj version (Pixel Bender Bytecode for Flash) in case you are looking for something to play with in the Pixel Bender Demo for Astro. Here's the source:
<languageVersion: 1.0;>

kernel FadeToHistory
< namespace : "Kevin's Tutorial Filters"; vendor : "Kevin's Filters, Inc"; version : 1; description : "Fade from color to B&W to sepia"; > { parameter float crossfade < minValue: 0.0; maxValue: 2.0; defaultValue: 0.0; >; const float3 lumMult = float3(0.3, 0.59, 0.11); input image4 src; output pixel4 dst; void evaluatePixel() { dst = sampleNearest(src,outCoord()); float luminance = dot(dst.rgb, lumMult); float3 sepia = float3( dst.r * 0.4 + dst.g * 0.769 + dst.b * 0.189, dst.r * 0.349 + dst.g * 0.686 + dst.b * 0.168, dst.r * 0.272 + dst.g * 0.534 + dst.b * 0.131 ); float3 startMix = dst.rgb; float3 endMix = float3(luminance); float mixValue = crossfade; if ( crossfade > 1.0 ) { // normalize mix value to the range of 0-1 mixValue -= 1.0; startMix = float3(luminance); endMix = sepia; } dst.rgb = mix(startMix, endMix, mixValue); } }
Download the pbj file

Leave a comment

About this Entry

This page contains a single entry by Kevin Goldsmith published on May 20, 2008 11:32 AM.

The Pixel Bender Exchange is now live! was the previous entry in this blog.

Pixel Bender HTML formatter is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.