Workbench: Fix xray normal not being normalized.
This commit is contained in:
@@ -42,24 +42,26 @@ void main()
|
||||
vec2 uv_viewport = gl_FragCoord.xy * invertedViewportSize;
|
||||
vec3 I_vs = view_vector_from_screen_uv(uv_viewport, viewvecs, ProjectionMatrix);
|
||||
|
||||
vec3 nor = normalize(normal_viewport);
|
||||
|
||||
#ifdef V3D_LIGHTING_MATCAP
|
||||
bool flipped = world_data.matcap_orientation != 0;
|
||||
vec2 matcap_uv = matcap_uv_compute(I_vs, normal_viewport, flipped);
|
||||
vec2 matcap_uv = matcap_uv_compute(I_vs, nor, flipped);
|
||||
diffuse_light = texture(matcapImage, matcap_uv).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef V3D_SHADING_SPECULAR_HIGHLIGHT
|
||||
vec3 specular_color = get_world_specular_lights(world_data, vec4(material_data.specular_color.rgb, material_data.roughness), normal_viewport, I_vs;
|
||||
vec3 specular_color = get_world_specular_lights(world_data, vec4(material_data.specular_color.rgb, material_data.roughness), nor, I_vs;
|
||||
#else
|
||||
vec3 specular_color = vec3(0.0);
|
||||
#endif
|
||||
|
||||
#ifdef V3D_LIGHTING_STUDIO
|
||||
# ifdef STUDIOLIGHT_ORIENTATION_CAMERA
|
||||
diffuse_light = get_camera_diffuse_light(world_data, normal_viewport);
|
||||
diffuse_light = get_camera_diffuse_light(world_data, nor);
|
||||
# endif
|
||||
# ifdef STUDIOLIGHT_ORIENTATION_WORLD
|
||||
vec3 normal_world = normalWorldMatrix * normal_viewport;
|
||||
vec3 normal_world = normalWorldMatrix * nor;
|
||||
diffuse_light = get_world_diffuse_light(world_data, normal_world);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user