Alpha Para-Perp

Some VEX utilizing the para and perp parameters within a surface shader.

A .vfl file that creates an alpha para-perp effect for a surface shader.

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Tuesday July 29th, 2008 09:38 PM

Alpha Para-Perp -

Alpha Para-Perp -

* Author: Dan Lynch

#pragma hint Ka color
#pragma hint Kd color
#pragma hint Ks color
#pragma hint map file

#pragma group Color Ka Kd Ks roughness
#pragma group Texture map

#pragma label map "Texture Map"
#pragma label Ka "Ambient"
#pragma label Kd "Diffuse"
#pragma label Ks "Specular"
#pragma label roughness "Roughness"

        vector Ka=1Kd=1Ks=1;
        float apara=1aperp=0aroll=1roughness .1;
        string map "Mandril.pic";
        export vector uv=0;

        vector Cd 1;
        float  Alpha 1;
        vector rest 0;

        float u 0;
        float V 0;
        if (!isbound("uv")) {
        } else {

        vector Nn normalize(N);
        vector In normalize(I);
        vector Nf frontface(Nn,In);

        if (map != "") {
                vector tmap vector (texture(map,u,V));

        float alpha=0;
        if (apara || aperp 1)
             alpha lerp(aperpaparapow(dot(Nf,-In), 1.0/aroll));
        else alpha 1;

        alpha  *= Alpha;
        Cf Cd;
        Cf += ambient(Nn,In)*Ka;
        Cf += diffuse(NnIn)*Kd;
        Cf += specular(Nn,-In,roughness)*Ks;

        if (map != "") {
                Cf *= tmap;

        if (!isshadowray()) {
                Of 1;
                Cf += (Af);
                Af += (Af);

        Of *= alpha;
        Cf *= alpha;
        Af *= alpha;

Download: alpha_para-perp.vfl 2 KB

Please login or Click Here to register for downloads
Creative Commons License
Alpha Para-Perp by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at