[英]How to get previous position of a mesh
I'm trying to write a shader for doing the motionBlur effect in WebGL using three.js frameworks.我正在尝试编写一个着色器,用于使用three.js 框架在WebGL 中实现motionBlur 效果。 I'm trying to adapt this tutorial for WebGL: http://john-chapman-graphics.blogspot.fr/2013/01/per-object-motion-blur.html and getting the velocity value with GPUComputeRenderer.
我正在尝试为 WebGL 调整本教程: http ://john-chapman-graphics.blogspot.fr/2013/01/per-object-motion-blur.html 并使用 GPUComputeRenderer 获取速度值。
But i have problem for this line :但我对这条线有问题:
Position = uModelViewProjectionMat * gl_Vertex;
vPrevPosition = uPrevModelViewProjectionMat * gl_Vertex;
How can i get or calculate the PrevModelViewProjectionMat ?如何获取或计算 PrevModelViewProjectionMat ? I know it's projectionMatrice * modelViewMatrix * vec4(position, 1.0) but don't know how to get the previous projMatrix or previous modelViewMatrix.
我知道它是projectionMatrice * modelViewMatrix * vec4(position, 1.0) 但不知道如何获得以前的projMatrix 或以前的modelViewMatrix。 Can someone help?
有人可以帮忙吗?
The previous projection matrix is probably going to be the same unless you modified the camera (near,far,fov).除非您修改了相机(near、far、fov),否则之前的投影矩阵可能会相同。
The previous modelView matrix you need to calculate or save from the previous frame.您需要从前一帧计算或保存的前一个模型视图矩阵。 Then provide it to the shader as a uniform, and do the transformation.
然后将其作为统一提供给着色器,并进行转换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.