raylib-rs icon indicating copy to clipboard operation
raylib-rs copied to clipboard

vertexNormals are not getting set

Open 0x177 opened this issue 1 year ago • 2 comments

i have a vertex shader that passes the normal of the vertex to the fragment shader. i can confirm that whatever fragNormal is set do does get passed to the fragment shader. the problem is that all the normals are 0,0,0. here are the relevant parts of code:

drawing geometry:

let mut d2 = d2.begin_shader_mode(&shader);

d2.draw_plane(
    Vector3::new(0.0, 0.0, 0.0),
    Vector2::new(32.0, 32.0),
    Color::LIGHTGRAY,
);

d2.draw_cube(Vector3::zero(),2.0,4.0,2.0,Color::WHITE);

vertex shader:

#version 330

in vec3 vertexNormal;

uniform mat4 matNormal;

out vec3 fragNormal;

void main()
{
    fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
}

0x177 avatar Sep 12 '24 15:09 0x177

i am also experiencing this issue

RoseApollo avatar Oct 13 '24 16:10 RoseApollo

Can either of you reproduce this with the unstable branch on raylib-rs/raylib-rs (the repo where development happens more often), which adds a closure-based start_shader_mode?

IoIxD avatar Oct 29 '24 19:10 IoIxD