pixelshader_for_newbies

01 Introduction

This tutorial is for newbies in the shader business and not for the pros. That means, we have a brief look at the pixelshader aspect and keep everything more or less simple.
Hopefully there is soon a tutorial for the vertex part of shader programming.
Pixelshaders are much more easy to understand than Vertexshaders, so for the beginning pixelshaders should be your choice ...

01.1 Why should I use a shader?

First it's just a performance thing: shaders are fast. these small prgramms run "independently" form the rest of your patch in your graphic card. But the main reason of course is: you can do a lot of new things!

01.2 How to insert an effect in your patch

Effect nodes/shaders are programmed in (HLSL "high level shader language") but are represented within vvvv as normal nodes. The main difference between shader nodes and other nodes is, that you can look into them by right clicking on the node. A window will open that contains the shader code.

vvvv comes preloaded with some shaders that have the extension ".fx" can be found in the "effects" directory. If you create a new effect or download one from somewhere, simply place it there. After rescanning for externals (Alt+E) they will show up in the nodelist (Middleclick in a patch window), like any other node or you can simply open in patch with (Shift+Ctrl+O).

All the shaders we do in this tutorial are based on the node "template" (guess why this node is named template) ... this node is always a good starting point to write your own shaders.

Please note: For the examples in this tutorial you need a graphic card capable of using Pixelshader Version 2.0 (PS 2.0)!

01.3 The 4 parts of an effect file

PARAMETERS // create input pins and define variabels
VERTEXSHADERS // vertex effects
PIXELSHADERS // pixelshader effects (we work mainly here in this tutorial)
TECHNIQUES // specify PS version and technique


Some important hints before we start programming: :
write col.r = (col.r > threshold)

But for now: Enough theory! let's start programming our first shader!
And don't forget to share all the cool new shaders you will do!

Before you start with the tutorials, you should download package of all patches & shaders used form here:
pixelshader_for_newbies_20050922.zip


02 "hello world in pink"

03 thresholding Colors

04 Difference between 2 Textures - aka good for Tracking

05 lovely Neighbours - let's do a simple Blur

06 more lovely Neighbours - Kernel Filters

07 Textur Coordinates & Textur Lookup

08 Feedback & Cellular Automata - Game of Life



links:
just google for "morphologic filter" or "kernel filters" there are plenty sites

if you wanna post shader code in the tiki be aware: you have to replace < with ~lt~ and > with ~gt~

greetings MrBenefit
elkallemajor, 21:45 UTC, 08.02.10: found a solution and posted it in the forum.
joreg, 17:32 UTC, 08.02.10: works fine for me on 7. please start a forumthread describing your problem in detail.
elkallemajor, 16:28 UTC, 08.02.10: addflow in windows 7 not working. has anyone ideas?
aivenhoe, 16:06 UTC, 08.02.10: hello dieterbohlen. unfrotunately again, im not there.. :-(
sven, 15:55 UTC, 08.02.10: [Link]
manuel, 20:36 UTC, 07.02.10: http://vimeo.com/8837024
tonfilm, 04:25 UTC, 07.02.10: [Link]
skyliner, 21:37 UTC, 06.02.10: :)
fibo, 19:41 UTC, 06.02.10: @skyliner: enjoying pistacccccioo :)))
zoph, 18:13 UTC, 06.02.10: Ive an odd Timeliner problem. See forum, would appreciate if anyone could help me soon


Read More…