您的意思是您正在使用“SkeletonRenderTexture”示例组件正常渲染“SkeletonAnimation”游戏对象,然后想使用例如第二次绘制它。 灰色覆盖层来渲染阴影?
如果是这样,那么您可以创建 SkeletonRenderTexture
示例脚本的副本并对其进行修改,以便它创建两个游戏对象而不是仅一个来渲染 RenderTexture
,然后只需在以下位置分配相同的 Mesh
和 RenderTexture
两者都创建了游戏对象,并在新的阴影游戏对象上使用灰色叠加着色器。
或者,您可以创建一个类似于相当简单的“RenderExistingMesh”示例脚本的 scipt,您将主要需要调用类似“ownMeshFilter.sharedMesh = referenceMeshFilter.sharedMesh;”的内容来为每个帧分配另一个“MeshFilter”的网格。 然后你还需要在你自己的 MeshRenderer
中分配其他 MeshRenderer
的 material.Texture
。 基本上这应该是所有必要的。
Do you mean that you are using the SkeletonRenderTexture
example component to render the SkeletonAnimation
GameObject normally, and then want to draw it a second time using e.g. a gray overlay to render a shadow?
If so, then you could either create a copy of the SkeletonRenderTexture
example script and modify it so that it creates two GameObjects instead of only one to render the RenderTexture
, then simply assign the same Mesh
and RenderTexture
at both created GameObjects, and use a gray color overlay shader at the new shadow GameObject.
Alternatively, you could create a scipt similar to the rather simple RenderExistingMesh
example script, you will mostly need to call something like ownMeshFilter.sharedMesh = referenceMeshFilter.sharedMesh;
to assign the mesh of the other MeshFilter
every frame. Then you also need to assign the material.Texture
of the other MeshRenderer
at your own MeshRenderer
. That should be all that's necessary basically.