Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 a519396593 · Jul 17, 2018 at 09:00 AM · animationcamerarenderinggraphics

Update Mesh immediately for rendering While changing blendshape

Hi guys, I change blendshape value of my fbx model at runtime, and placed a camera to render this model. For some purpose, I need capture the camera texture after changing blendshape of this model immediately.

However, The camera texture can only show the mesh before changing blendshape. I know this mesh will update in next frame, but I can't wait until that time. Is there any method to update this mesh for rendering right now?

 human.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(0, 100);            
 human.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(1, 100);
 CaptureCameraTexture();

this is my function for capture camera texture.

 public Texture2D CaptureCameraTexture(string path = null)
 {
       Texture2D camTex = new Texture2D(cameraWidth, cameraHeight, TextureFormat.RGBAFloat, false);
       RenderTexture rt = new RenderTexture(Screen.width, Screen.height, 1);        
 
       cam.targetTexture = rt;
       cam.Render();
       RenderTexture.active = rt;
       camTex.ReadPixels(new Rect(0, 0, cameraWidth, cameraHeight), 0, 0);
       Debug.Log(camTex.GetPixel(cameraWidth / 2, cameraHeight / 2));
       Debug.Log(camTex.GetPixel(cameraWidth / 2+1, cameraHeight / 2));
         
       cam.targetTexture = null;
       RenderTexture.active = null;
       UnityEngine.Object.Destroy(rt);
 
       SaveImg(camTex, path);
       return camTex;
   }
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 Bunny83 · Jul 17, 2018 at 10:26 AM

Well the skinning of a SkinnedMeshRenderer takes place during the animation update. You can try using SkinnedMeshRenderer.BakeMesh and use the baked mesh for rendering. However i'm not sure if blendshapes are baked as well with this method, though logically it should.

Comment
Add comment · Show 2 · 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
avatar image a519396593 · Jul 17, 2018 at 11:53 AM 0
Share

Skinned$$anonymous$$eshRenderer.Bake$$anonymous$$esh does work to get the mesh with blendshape. However, how can I put this mesh into the scene and let the camera can render it immediately?

avatar image a519396593 · Jul 17, 2018 at 12:04 PM 0
Share

I find it works. However, I need all this to become really fast. Because I need to change the blendshape thousand times. It there a more efficiency way? I just find my function to CaptureCameraTexture cost the most time, any advice to acquire this render results more efficient?

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

266 People are following this question.

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

Related Questions

Sun-shaft camera glitch 0 Answers

Problem of using multiple scripts attached to camera containing OnPostRender() for VR projects 0 Answers

Masking elements with non-rendered layers? Culling masks, camera, render textures 0 Answers

Can't draw renderTexture to screen 1 Answer

How can I make a quad render below absolutely everything else? 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