데탑에서 돌아가던 똑같은 코드를 내 노트북에서 돌리니까 안나왔었는데
셰이더에서 변수순서 바꾸니까 잘나옴
Vertex shader 전문
#version 430 core
in vec3 position;
in vec3 normal;
in vec2 texture_coords;
uniform mat4 model;
uniform mat4 projection;
uniform mat4 view;
out vec3 surface_position;
out vec3 surface_normal;
out vec2 pass_texture_coords;
void main()
{
const vec4 world_position = model * vec4(position, 1.0);
pass_texture_coords = texture_coords;
surface_position = vec3(world_position);
surface_normal = mat3(model) * normal;
gl_Position = projection * view * world_position;
}
결과
fragment shader에서 아웃풋칼라로 디버깅해본 결과
텍스쳐 uv좌표가 들어가야 할 pass_texture_coords.xy 값에 surface_normal.xy의 값이 들어가있었고
surface_normal은 zero vector로 세팅되어있었음
그런데 메인함수에서의
pass_texture_coords = texture_coords;
surface_position = vec3(world_position);
surface_normal = mat3(model) * normal;
이부분을 첫째줄을 마지막으로 서순만 아래처럼 바꾸니
surface_position = vec3(world_position);
surface_normal = mat3(model) * normal;
pass_texture_coords = texture_coords;
기네요 - dc App
? - dc App