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
2
Question by temptest123 · Mar 26, 2014 at 01:10 PM · mobileskinnedmeshrendererskinningvertexshader

custom vertex shader that works with skinned mesh

The two Mainquestions:

  1. Can I - in the vertex shader - access the ORIGINAL, UNTRANSFORMED vertex position of a skinned mesh? (additionally to the already skinned vertex position, which is streamed in vertex : POSITION)

  2. How can I access the blendweights of a vertex in the vertexshader, and are these also accessible if the game object has a normal mesh renderer applied instead of a skinned mesh renderer?

background:

I need to write a custom shader that works with a skinned mesh on mobile platforms. It wouldn't be actually a very complex shader, just calculating some texture coorinates in the vertex shader, and displaying a texture in the fragment shader.

The problem: The calculated texture coordinates depend upon the original vertex position BEFORE the skinning transformation is applied. They are also not constant for each vertex, as they also depend on camera position (in particular, the texture coordinates represent a flat camera projection onto the untransformed mesh).

I read (https://docs.unity3d.com/Documentation/Components/class-SkinnedMeshRenderer.html) that on mobile devices the Skinning transformation happens on the cpu or on the floatingpoint coprocessor respectively - so I assume that the position sream that the vertexshader receives already contains the transformed vertex coordinates instead of the original positions.

So - how can I achieve what I need? How can I access in the vertex shader the original vertex position?

If this is not possible I will try to do the skinning transformation myself in the vertex shader - in this case, how can I access the skinning weights of the vertices in the vertexshader and circumvent the transformation on the coprocessor?

thank you for the help!

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 pcpc33 · Oct 02, 2014 at 08:07 PM

For your second question.

2) I don't think you do have access in shaders. BUT, you can write a c# script to that generates textures from the skin weights. You could do this a number of ways, but I'm currently working on this: skin weights are stored as a 1channel texture where value 1.500 encodes joint 1 at 50% weight, and 2.1 encodes joint 2 at 10% weight.

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

22 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

Related Questions

Changing skin weights in maya destroys character prefab 0 Answers

Skin weights in build being set to 100 on single bones 3 Answers

Skinned models look different when building the game to both Oculus&HTC Vive 0 Answers

How to calculate nearest bones, weights and bindposes programmatically? 0 Answers

Problem with exporting skinning-data from 3ds Max to Unity 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