===== Freitag, 27. Juli 2007 18:33 Uhr Europe/Berlin ===== GLSL GHash init Compiled with Python version 2.5.1. Checking for installed Python... got it! GLSL Supported ARB_fragment_program is supported. ALU instructions: 4096 texture instructions: 4096 texture indirections: 4096 local parameters: 1024 env parameters: 128 temp registers: 32 attributes: 16 ARB_vertex_program is supported. ALU instructions: 0 texture instructions: 0 texture indirections: 0 local parameters: 1024 env parameters: 256 temp registers: 65535 attributes: 32 GLSL GHash init GLSL deactivated. GLSL Light created. GLSL Light created. GLSL Light created. GLSL Material created. GLSL MaterialTree created. GLSL Program created. GLSL Shader code writing... GLSL Shader Compiled. GLSL Shader Compile Error Code: struct light{ vec3 loc; vec3 vec; vec3 color; float dist; float energy; float att1; float att2; float att3; float att4; float gamma; float area_x; float area_y; float sphere; float square; float area_type; float layer; mat4 mat; float areasize; float k; float spotsize; float spotblend; }; varying vec3 vert_color; varying vec3 normal, pos; varying vec4 realcolor; uniform vec3 eye; uniform vec3 amb_color; uniform float amb_exp, amb_range;uniform vec3 u_mat_0_diff_color; uniform vec3 u_mat_0_spec_color; uniform vec3 u_mat_0_normal; uniform float u_mat_0_alpha; uniform float u_mat_0_diff1; uniform float u_mat_0_diff2; uniform float u_mat_0_diff3; uniform float u_mat_0_spec1; uniform float u_mat_0_spec2; uniform float u_mat_0_spec3; uniform float u_mat_0_amb_fac; uniform float u_mat_0_emit; uniform float u_mat_0_hard; uniform light lights[4]; float lambertdef(light l, vec3 vnormal, float unused1, float unused2){ vec3 lightVec = normalize(l.loc - pos); return(max(dot(lightVec, vnormal), 0.0)); } float lambertsun(light l, vec3 vnormal, float unused1, float unused2){ vec3 lightVec = normalize(l.vec); return(max(dot(lightVec, vnormal), 0.0)); }float lamberthemi(light l, vec3 vnormal){ vec3 lightVec = normalize(l.vec); return(0.5 * dot(lightVec, vnormal) + 0.5); }float lambertarea(light l, vec3 vnormal, float unused1, float unused2){ vec3 lightVec = normalize(l.loc - pos); vec3 vect1, vect2, vect3, vect4; vec3 cross1, cross2, cross3, cross4; float rad[4]; float fac; vect1 = normalize(pos - vec3(l.mat[0][0], l.mat[0][1], l.mat[0][2])); vect2 = normalize(pos - vec3(l.mat[1][0], l.mat[1][1], l.mat[1][2])); vect3 = normalize(pos - vec3(l.mat[2][0], l.mat[2][1], l.mat[2][2])); vect4 = normalize(pos - vec3(l.mat[3][0], l.mat[3][1], l.mat[3][2])); cross1 = normalize(cross(vect1, vect2)); cross2 = normalize(cross(vect2, vect3)); cross3 = normalize(cross(vect3, vect4)); cross4 = normalize(cross(vect4, vect1)); rad[0] = dot(vect1, vect2); rad[1] = dot(vect2, vect3); rad[2] = dot(vect3, vect4); rad[3] = dot(vect4, vect1); rad[0] = acos(clamp(rad[0], -1.0, 1.0)) * (1 - floor(clamp(rad[0], 0.1, 1.0) + 0.00001)); rad[1] = acos(clamp(rad[1], -1.0, 1.0)) * (1 - floor(clamp(rad[1], 0.1, 1.0) + 0.00001)); rad[2] = acos(clamp(rad[2], -1.0, 1.0)) * (1 - floor(clamp(rad[2], 0.1, 1.0) + 0.00001)); rad[3] = acos(clamp(rad[3], -1.0, 1.0)) * (1 - floor(clamp(rad[3], 0.1, 1.0) + 0.00001)); fac = rad[0] * dot(vnormal, cross1); fac += rad[1] * dot(vnormal, cross2); fac += rad[2] * dot(vnormal, cross3); fac += rad[3] * dot(vnormal, cross4); fac = max(pow(-fac * l.areasize, l.k), 0.0); return(fac); } float cooktorrdef(light l, vec3 vnormal, float hard, float unused){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + (l.loc - pos)); float nh = max(dot(vnormal, h), 0.0); float nv = max(dot(vnormal, view), 0.0); return(pow(nh, hard) / (0.1 + nv)); } float cooktorrsun(light l, vec3 vnormal, float hard, float unused){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + l.vec); float nh = max(dot(vnormal, h), 0.0); float nv = max(dot(vnormal, view), 0.0); return(pow(nh, hard) / (0.1 + nv)); } float cooktorrhemi(light l, vec3 vnormal, float hard){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + l.vec); float nh = 0.5 * (max(dot(vnormal, h), 0.0)) + 0.5; return(nh * pow(nh, hard)); } float cooktorrarea(light l, vec3 vnormal, float hard, float unused){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + (l.loc - pos)); float nh = max(dot(vnormal, h), 0.0); float nv = max(dot(vnormal, view), 0.0); return( pow(nh, hard) / (0.1 + nv)); } float visibility_lamp(light l){ float visifac = 1.0; vec3 lv = (pos - l.loc); float dist = sqrt(dot(lv, lv)); visifac = l.dist / (l.dist + (l.att1 * dist)); visifac *= (l.dist * l.dist) / ( l.dist * l.dist + (l.att2 * dist * dist)); visifac = max(visifac * l.att3, l.dist / (l.dist + dist) * l.att4); float m = max(l.dist - dist, 0.0); return(visifac * max(m / l.dist, l.sphere)); } #define MATERIAL_ID 0 #define MATERIAL_FUNC material_0 vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, int hard){ vec3 diff_rslt = vec3(0.0, 0.0, 0.0); vec3 spec_rslt = vec3(0.0, 0.0, 0.0); vec3 amb_rslt = amb_color * amb_fac; float vis = 0.0; #define LIGHT_CALCULATIONS 1 #define LIGHT_ID 0 #define VISIBILITY visibility_lamp #define CALC_DIFFUSE 1 #define DIFF_SHADER_ID lambertdef #define CALC_SPECULAR 1 #define SPEC_SHADER_ID cooktorrdef #ifdef LIGHT_ID vis = VISIBILITY(lights[LIGHT_ID]); #endif #ifdef CALC_DIFFUSE #ifdef LIGHT_ID #ifdef DIFF_CB_TYPE #ifdef HEMI float rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], normal); #else float rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff2, diff3); #endif #if DIFF_CB_TYPE == 0 float diff_fac = rslt1; #else #if DIFF_CB_TYPE == 1 float diff_fac = 0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b; #else float diff_fac = dot((eye - pos), normal); #endif #endif vec3 diff_col = (rslt1 + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color); vec4 diff_cb = texture1D(DIFF_CB_TEX, diff_fac); diff_rslt += DIFF_CB_BLEND_FUNC(diff_col, diff_cb.rgb, DIFF_CB_FAC) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else #ifdef HEMI diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], normal) + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff2, diff3) + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #endif #ifdef CALC_SPECULAR #ifdef LIGHT_ID #ifdef SPEC_CB_TYPE #ifdef HEMI float rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], normal); #else float rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec2, spec3); #endif #if SPEC_CB_TYPE == 0 float spec_fac = rslt2; #else #if SPEC_CB_TYPE == 1 float spec_fac = 0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b; #else float spec_fac = dot((eye - pos), normal); #endif #endif vec3 spec_col = rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color); vec4 spec_cb = texture1D(SPEC_CB_TEX, spec_fac); spec_rslt += SPEC_CB_BLEND_FUNC(spec_col, spec_cb.rgb, SPEC_CB_FAC) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else #ifdef HEMI spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, hard) * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec2, spec3) * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #endif #undef VISIBILITY #undef LIGHT_ID #undef CALC_DIFFUSE #undef CALC_SPECULAR #undef DIFF_SHADER_ID #undef SPEC_SHADER_ID #undef HEMI #undef DIFF_CB_TYPE #undef SPEC_CB_TYPE #undef DIFF_CB_BLEND_FUNC #undef SPEC_CB_BLEND_FUNC #undef DIFF_CB_TEX #undef SPEC_CB_TEX #undef DIFF_CB_FAC #undef SPEC_CB_FAC #define LIGHT_ID 1 #define VISIBILITY visibility_lamp #define CALC_DIFFUSE 1 #define DIFF_SHADER_ID lambertdef #define CALC_SPECULAR 1 #define SPEC_SHADER_ID cooktorrdef #ifdef LIGHT_ID vis = VISIBILITY(lights[LIGHT_ID]); #endif #ifdef CALC_DIFFUSE #ifdef LIGHT_ID #ifdef DIFF_CB_TYPE #ifdef HEMI float rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], normal); #else float rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff2, diff3); #endif #if DIFF_CB_TYPE == 0 float diff_fac = rslt1; #else #if DIFF_CB_TYPE == 1 float diff_fac = 0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b; #else float diff_fac = dot((eye - pos), normal); #endif #endif vec3 diff_col = (rslt1 + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color); vec4 diff_cb = texture1D(DIFF_CB_TEX, diff_fac); diff_rslt += DIFF_CB_BLEND_FUNC(diff_col, diff_cb.rgb, DIFF_CB_FAC) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else #ifdef HEMI diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], normal) + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff2, diff3) + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #endif #ifdef CALC_SPECULAR #ifdef LIGHT_ID #ifdef SPEC_CB_TYPE #ifdef HEMI float rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], normal); #else float rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec2, spec3); #endif #if SPEC_CB_TYPE == 0 float spec_fac = rslt2; #else #if SPEC_CB_TYPE == 1 float spec_fac = 0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b; #else float spec_fac = dot((eye - pos), normal); #endif #endif vec3 spec_col = rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color); vec4 spec_cb = texture1D(SPEC_CB_TEX, spec_fac); spec_rslt += SPEC_CB_BLEND_FUNC(spec_col, spec_cb.rgb, SPEC_CB_FAC) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else #ifdef HEMI spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, hard) * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec2, spec3) * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #endif #undef VISIBILITY #undef LIGHT_ID #undef CALC_DIFFUSE #undef CALC_SPECULAR #undef DIFF_SHADER_ID #undef SPEC_SHADER_ID #undef HEMI #undef DIFF_CB_TYPE #undef SPEC_CB_TYPE #undef DIFF_CB_BLEND_FUNC #undef SPEC_CB_BLEND_FUNC #undef DIFF_CB_TEX #undef SPEC_CB_TEX #undef DIFF_CB_FAC #undef SPEC_CB_FAC #define LIGHT_ID 2 #define VISIBILITY visibility_lamp #define CALC_DIFFUSE 1 #define DIFF_SHADER_ID lambertdef #define CALC_SPECULAR 1 #define SPEC_SHADER_ID cooktorrdef #ifdef LIGHT_ID vis = VISIBILITY(lights[LIGHT_ID]); #endif #ifdef CALC_DIFFUSE #ifdef LIGHT_ID #ifdef DIFF_CB_TYPE #ifdef HEMI float rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], normal); #else float rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff2, diff3); #endif #if DIFF_CB_TYPE == 0 float diff_fac = rslt1; #else #if DIFF_CB_TYPE == 1 float diff_fac = 0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b; #else float diff_fac = dot((eye - pos), normal); #endif #endif vec3 diff_col = (rslt1 + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color); vec4 diff_cb = texture1D(DIFF_CB_TEX, diff_fac); diff_rslt += DIFF_CB_BLEND_FUNC(diff_col, diff_cb.rgb, DIFF_CB_FAC) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else #ifdef HEMI diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], normal) + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff2, diff3) + emit) * diff1 * diff_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #endif #ifdef CALC_SPECULAR #ifdef LIGHT_ID #ifdef SPEC_CB_TYPE #ifdef HEMI float rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], normal); #else float rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec2, spec3); #endif #if SPEC_CB_TYPE == 0 float spec_fac = rslt2; #else #if SPEC_CB_TYPE == 1 float spec_fac = 0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b; #else float spec_fac = dot((eye - pos), normal); #endif #endif vec3 spec_col = rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color); vec4 spec_cb = texture1D(SPEC_CB_TEX, spec_fac); spec_rslt += SPEC_CB_BLEND_FUNC(spec_col, spec_cb.rgb, SPEC_CB_FAC) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else #ifdef HEMI spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, hard) * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec2, spec3) * spec1 * spec_color * vec3(lights[LIGHT_ID].color + vert_color) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #endif #undef VISIBILITY #undef LIGHT_ID #undef CALC_DIFFUSE #undef CALC_SPECULAR #undef DIFF_SHADER_ID #undef SPEC_SHADER_ID #undef HEMI #undef DIFF_CB_TYPE #undef SPEC_CB_TYPE #undef DIFF_CB_BLEND_FUNC #undef SPEC_CB_BLEND_FUNC #undef DIFF_CB_TEX #undef SPEC_CB_TEX #undef DIFF_CB_FAC #undef SPEC_CB_FAC #ifdef LIGHT_CALCULATIONS return(amb_exp * (1.0 - exp(diff_rslt * amb_range)) + spec_rslt + amb_rslt); #else return(vec3(0.0, 0.0, 0.0)); #endif } #undef MATERIAL_ID #undef MATERIAL_FUNC void main(void){ vec3 norm = normalize(normal); vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; int hard = u_mat_0_hard; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard); gl_FragColor = vec4(result, alpha);} GLSL Program removed. GLSL MaterialTree removed. GLSL Material removed. GLSL GHash init GLSL Light removed. GLSL Light removed. GLSL Light removed. GLSL deactivated. GLSL GHash init GLSL activated.