light
shadowpoint(
    float intensity = 1,
    color lightcolor = 1,
    point from = point ("shader", 0,0,0),	/* light position */
    string    sfpx    = "",
    string    sfnx    = "",
    string    sfpy    = "",
    string    sfny    = "",
    string    sfpz    = "",
    string    sfnz    = "",
    float width      = 1.0,
    float samples    = 16.0
)
{
    float    attenuation = 0.0;
    float    Lx, Ly, Lz, AbsLx, AbsLy, AbsLz;
    vector   Lrel;

    emit( from ) {

        Lrel = transform("world", L);

        Lx = Lrel[0];
        AbsLx = abs(Lx);
        Ly = Lrel[1];
        AbsLy = abs(Ly);
        Lz = Lrel[2];
        AbsLz = abs(Lz);

        if((AbsLx > AbsLy) && (AbsLx > AbsLz)) {
            if((Lx > 0.0)&&(sfpx != ""))
		attenuation = transmission( Ps, from, "samples", (int)samples );
            else if (sfnx != "")
		attenuation = transmission( Ps, from, "samples", (int)samples );
	}
        else if((AbsLy > AbsLx) && (AbsLy > AbsLz)) {
            if((Ly > 0.0)&&(sfpy != ""))
		attenuation = transmission( Ps, from, "samples", (int)samples );
            else if (sfny != "")
		attenuation = transmission( Ps, from, "samples", (int)samples );
	}
        else if((AbsLz > AbsLy) && (AbsLz > AbsLx)) {
            if((Lz > 0.0)&&(sfpz != ""))
		attenuation = transmission( Ps, from, "samples", (int)samples );
            else if (sfnz != "")
		attenuation = transmission( Ps, from, "samples", (int)samples );
	}

        /* calculate light contribution  distance square fall off */
        Cl = attenuation * intensity * lightcolor / dot(L,L);
    }
}
