materials, brick and nodes structure, preparing for world generation
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
point: Hit point
|
||||
view: View vector (camera ray)
|
||||
normal: Normal vector
|
||||
*/
|
||||
vec3 solve(vec3 hitPoint, vec3 view, vec3 normal, uint brick)
|
||||
{
|
||||
// Lighting
|
||||
vec3 light_color = vec3(1.0, 1.0, 1.0);
|
||||
vec3 light_dir = normalize(hitPoint-vec3(0.0, 1.5, 4.0));
|
||||
|
||||
vec3 ambient = light_color * 0.1;
|
||||
vec3 diffuse = light_color * max(1.0-dot(normal, light_dir), 0.0);
|
||||
vec3 specular = light_color * pow(max(dot(view, reflect(-light_dir, normal)), 0.0), 32);
|
||||
|
||||
// Combine colors
|
||||
vec3 object_color = _Materials[brick].albedo.rgb;//vec3(0.0, 0.1, 0.5);
|
||||
return (ambient + diffuse + specular) * object_color;
|
||||
}
|
||||
Reference in New Issue
Block a user