Pixel-Composer/shaders/sh_d3d_geometry/sh_d3d_geometry.fsh

20 lines
488 B
Text
Raw Normal View History

2023-08-30 16:40:45 +02:00
varying vec2 v_vTexcoord;
2023-08-28 12:56:00 +02:00
varying vec4 v_worldPosition;
varying vec3 v_viewPosition;
varying vec3 v_vNormal;
2023-08-30 16:40:45 +02:00
uniform int use_normal;
uniform float normal_strength;
uniform sampler2D normal_map;
2023-08-28 12:56:00 +02:00
void main() {
gl_FragData[0] = vec4(v_worldPosition.xyz, 1.);
gl_FragData[1] = vec4(v_viewPosition, 1.);
2023-08-30 16:40:45 +02:00
vec3 normal = v_vNormal;
if(use_normal == 1)
normal += (texture2D(normal_map, v_vTexcoord).rgb * 2. - 1.) * normal_strength;
gl_FragData[2] = vec4(normalize(normal), 1.);
2023-08-28 12:56:00 +02:00
}