Basic Texture Map
eharetea

A basic texture map in VEX.

A .vfl file that creates a basic texture map shader.

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

Basic Texture Map - test.3daet.com


/*
*
* Author: Dan Lynch
*
*/

#pragma hint Ka color
#pragma hint Kd color
#pragma hint Ks color
#pragma hint map image
#pragma hint uv hidden

#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"

surface
bd_map
        (
        vector Ka=1Kd=1Ks=1;
        float roughness .1;
        export vector uv 0;
        string map "Mandril.pic";
        )
{
        float u 0;
        float V 0;
        if (!isbound("uv")) {
                s;
                t;
        }
        else {
                getcomp(uv,0);
                getcomp(uv,1);
        }

        vector Nn normalize(N);
        vector In normalize(I);

        //colormap() is similiar to texture()
        //vector tmap = vector (colormap(map,u,V, "mode", "clamp"));

        vector tmap vector (texture(map,u,V));

        Cf ambient(Nn,In)*Ka;
        Cf += diffuse(NnIn)*Kd;
        Cf += specular(Nn,-In,roughness)*Ks;
        Cf *= tmap;
}



Downloads:
Download: basic_texture_map.vfl 1 KB

Please login or Click Here to register for downloads
Creative Commons License
Basic Texture Map by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com