Replies: 1 comment 1 reply
-
Transformations are applied to meshes. Think of your head as a camera, if you turn it to the left, that is like applying a view transform that rotates it to the left. Now bring your head back to the centre and hold your hand up in front of your face. Turn your head to the left again. Your hand was in front of your face, now it is to the right of your face. So from the point of view of the camera, rotating your head to the right (multiplying the camera position by the view transform) looks the same as rotating your hand to the right relative to your head. This is equivalent to applying the inverse view transform to the model’s vertex world position. The view_proj matrix is projection * inverse_view. |
Beta Was this translation helpful? Give feedback.
-
The following code shows different ways to compute clip position in vertex shader:
It use the build-in shader struct defined in
bevy/crates/bevy_pbr/src/render/mesh_view_types.wgsl
Lines 3 to 13 in 681c9c6
In practice, the Method 1 and Method 3 are work, and Method 2 is not work.
It seems that the function of
view.view
andview.inverse_view
is not consistent with their naming.Can someone explain this to me?
Beta Was this translation helpful? Give feedback.
All reactions