Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JesseJoudrey · Jan 11, 2013 at 01:21 AM · editor-scriptingrendertextureskinned-mesh

How can I force a skinned mesh to update it's vertices from it's pose?

I need to render a skinned mesh to two different render textures in script. Both images should have the skinned mesh in different locations, orientations, and poses. Currently I am posing the mesh by sampling an animation, setting to the target texture to a pre-positioned camera and calling Render on this camera, then repeating with a second pose and a second target texture.

The result I get is a pair of images of the skinned mesh in the position that it was before my script was called.

My guess is that the bones are being correctly set by the SampleAnimation call, but that the skinning is not being recalculated because the rendering is happening in a script (an editor script at that). Is there a way to manually cause the skinning to be calculated on the skinned mesh? Or is there a way to have a scripted camera generate all the proper events so that the verts are skinned the normal way?

I appreciate that there are work-arounds possible (have two models, have multiple cameras in scene and let the game render them, etc) but the solution I'm looking for must work in a script I can trigger from a menu, and it must not be in a coroutine or involve other delays such as setting state and waiting for the next game frame.

Thanks

Jesse

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by JesseJoudrey · Jan 16, 2013 at 07:28 AM

With the help of Michael Nicolella I got this working and here's how.

  1. Instead of rendering the one game object into two views I cloned the game object and all it's children using GameObject.Instantiate().

  2. I iterated through each renderer in the new GameObject's heirarchy and set the GameObject containing it's layer to a special purpose layer so the camera rendering the render textures would not pick up both the clone and the original

  3. I pose the clone and call render on the camera.

  4. I DestroyImmediate() the clone game object.

  5. I repeat the above for the second view.

This actually fixed another issue, in that rendering a single game object in two poses moved it to the second pose and lost the pose it was originally in. Now that the posing is done in a clone the original object's pose is left intact.

Thanks All

Jesse

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Saving texture of selected GO (Editor Script) 2 Answers

When and how to take a screenshot of a particle system from the editor? 0 Answers

Do you know of any advanced custom editor examples? 1 Answer

How to include custom art/styles in editor scripts 1 Answer

Detect when project is saved 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges