Font size: +
1 minute reading time (222 words)

eclipse_pattern.vfl

/* 
 * Name : eclipse_pattern.vfl
 *
 * Produced By :  Miho
 * Modifed By : 정현준
 *
 * Shader 소개 : eclipse의 과정을 보여주는 듯한 Shader 입니다.
 *
 */

#include <prman.h>
#include <vexnotes.h>

surface regular(float Ka=0.5, Kd= 0.5; float Ks=0.5, roughness= 0.16; 
                color specular_color=1;)
{
 color surface_color, layer_color;
 color surface_opac;
 float layer_opac;
 color sky = {0.09,0.09,0.35};
 float fuzz = 0.05;
 float ss,tt;
 float a,b;
 float freq =5;
 float row,col,num; /* num = number of the tile */
 point center;
 point Nf, V;
 float moon, shad;
 float radius , d;
 float shif, wax; /* shif = shadow shift, wax = ratio of waxing */

 shif = .21; wax = .059;
/* back ground layer */

 surface_color = sky;

/*repeat*/

 ss=repeat(s,freq);
 col=whichtile(s,freq);
 tt=repeat(t,freq);
 row=whichtile(t,freq);
 num=row*freq+col;

/* layer 1 moon */

 layer_color={1,0.91,0.4};
 center = { 0.5, 0.5 ,0};
 radius = 0.35;
 d = distance(center,set(ss,tt,0));
 moon = 1-smoothstep(radius-fuzz, radius,d);
 layer_opac=moon;
 surface_color=blend(surface_color, layer_color,layer_opac);

/* layer 2 shadow */

 layer_color=sky         ;
 center = set(num*wax  -shif,0.5,0);
 d = distance(center,set(ss,tt,0));
 shad = 1-smoothstep(radius-fuzz, radius,d);
 layer_opac=shad;
 surface_color=blend(surface_color, layer_color, layer_opac);

/* shading */

 Nf = faceforward(normalize(N) ,I );
 V = -normalize(I);
 surface_color = surface_color* (Ka * ambient() + Kd * diffuse(Nf)) + specular_color*  Ks * specular (Nf, V, roughness);

/* output */

Ci =              surface_color;

}
 
leafveins.vfl
jellysurf2.vfl
 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Saturday, 11 July 2026