Changeset 2149


Ignore:
Timestamp:
Dec 18, 2012, 11:10:15 PM (7 years ago)
Author:
touky
Message:

specular on cube light. Not the correct effect.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/easymesh/shiny.lolfx

    r2148 r2149  
    5454//Cube Light
    5555vec4 in_Light3_Pos = vec4(-10.0, 10.0, 5.0, 1.0);
    56 vec3 in_Light3_Size_Inner = vec3(1.0, 1.0, 1.0);
    57 vec3 in_Light3_Size_Outer = vec3(10.0, 10.0, 10.0);
     56vec3 in_Light3_Size_Inner = vec3(3.0, 1.0, 3.0);
     57vec3 in_Light3_Size_Outer = vec3(15.0, 15.0, 15.0);
    5858vec3 in_Light3_diffuse = vec3(0.4, 1.0, 0.4);
    5959
     
    117117        else
    118118        {
    119                 new_LightDir = (in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz;
    120                 sdotn = max(dot(normalize(new_LightDir), pass_TNormal), 0.0);
     119                new_LightDir = normalize((in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz);
     120                sdotn = max(dot(new_LightDir, pass_TNormal), 0.0);
     121            r = reflect(-new_LightDir, pass_TNormal);
     122                if (sdotn > 0.0 && light_radius_mod > 0.0)
     123                        specular += specular_color * min(specular_reflect, light_radius_mod)
     124                                         * pow(max(dot(r, v), 0.0), specular_power);
    121125        }
    122126    diffuse += in_Light3_diffuse * min(sdotn, light_radius_mod);
Note: See TracChangeset for help on using the changeset viewer.