Are vertex normals not interpolated linearly across faces/edges? #19004
-
I'm not sure whether this question is best targeted at Bevy, WGSL, or even my GPU's driver. Please let me know if should be moved somewhere else. Using Bevy/bevy_pbr, I would expect vertex normals to be interpolated linearly across faces and edges. Specifically, for vertices A and B with normals In this reproducer [1], the bottom shape is created by subdividing the top shape in half. The normal vector for the middle-top vertex on the bottom shape is created by linearly interpolating between the normal of the top left vertex and the top right vertex. (The same for the middle-bottom vertex). Is there something wrong with my minimal reproducer, or is Bevy/WGSL/my GPU drivers/my GPU not interpolating the normal vectors linearly? If they are not interpolated linearly, how are they computed? For context, I am writing a geomorphing [2] shader and I want to create subdivided meshes that render exactly the same as the original meshes. [1] https://gist.github.com/evan-goode/0d6dba45abf0ee16bbbc97b1a3d21b56 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You need to normalize in the fragment shader, gpu interpolators do not automatically normalize normals, so you're getting non-unit-length normals at the inbetween values |
Beta Was this translation helpful? Give feedback.
You need to normalize in the fragment shader, gpu interpolators do not automatically normalize normals, so you're getting non-unit-length normals at the inbetween values