• 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
1
Question by Yuzuke · Jun 06, 2017 at 08:44 AM · augmented reality

Is This Client's Request Possible? ( AR, facial recognize / tracking)

we make AR apps. and here's a request:

1,we need to put a 3D wig model on some customer's head...

2,this wig can rotate / and obscured by the head properly when the customer's head rotates.

3,Is This Client's Request Possible?

many apps could do facial recognize/tracking, and 2D overlay. we do that too.

but 3D wig...yes we can do an AR 3D wig model over your head, but the part behind the head...how to make that obscured? I don't have any clues right now. maybe vuforia's smart terrain?? any comment is appreciated.

Comment
Add comment · Show 5
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 NoBrainer-David · Jun 06, 2017 at 09:23 AM 1
Share

In general, you would do stuff like obscuring with the help of a depth buffer. The idea is to render the entire wig into its own frame and before mixing with the camera image, you compare the depth buffer values and only apply the wig-pixels, where the depth is less than that of the cameras image.

avatar image Yuzuke NoBrainer-David · Jun 07, 2017 at 12:17 AM 0
Share

thank you! I think I got your idea, and I think you need to write your own shader to do that? but what if I can't find someone who could write a custom shader... is there any workaround?

avatar image JonPQ Yuzuke · Jun 07, 2017 at 01:13 AM 0
Share

there is a depth buffer shader on unity wiki website

Show more comments
avatar image TeohRIK · Jun 07, 2017 at 12:50 AM 0
Share

I remember there is a plugin at asset store called openCV will do the face tracking for you

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by JonPQ · Jun 09, 2017 at 08:59 PM

if you can track where the face is, and the orientation... you could calculate roughly center of head position from that, and hence where to place your wig. typically the back faces of any 3D model won;t be drawn anyway, so you'd be ok there. If you need to do a cutout geometry... there are a few shaders around (there is one on the unity wiki) that can render an invisible object.... it just renders the Z-buffer only as if there was an object there.... for example a head shape... This can be useful to cut holes in geometry... which might be useful to you. but you might not need it if the back face culling is enough.

might be good to know a little extra info... like how far head is expected to turn ?

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
avatar image
1

Answer by Cornelis-de-Jager · Jun 07, 2017 at 02:23 AM

That can actually be done fairly easily. What you do is use a plane to display what the camera sees. Then position the center of the 3D wig so that the plane/screen cuts the wig in half. That way when you rotate half of the wig will be made invisible.

The down side is if the algorithm determining the head location is not spot on, you can get the effect where the wig is much bigger or smaller than the persons head.

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 Yuzuke · Jun 07, 2017 at 02:43 AM 0
Share

I think it is not what I wanted, the wig is an AR model, not by simply 'put' on the screen, it needs to be generated by a recognized AR target and scaled properly/rotate properly due to the target distance/rotation like any other AR apps do. thanks for the tip anyway. it may be useful in other situations.

avatar image Yuzuke · Jun 07, 2017 at 02:52 AM 0
Share

on second thought, I think I could try out your approach, and see how it goes. thank you!

avatar image
0

Answer by Yuzuke · Jun 07, 2017 at 02:35 AM

I think this approach need some extra work like:

1,I need to know the customer's head's geometry in runtime every frame.

2,AND THEN I could attach depth mask shader to it so it could obscure the wig behind.

so, now you give me 2nd step solution, how to do the 1st step? @DerDude87 , @JonPQ

Comment
Add comment · Show 3 · 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 Cornelis-de-Jager · Jun 07, 2017 at 06:17 AM 0
Share

Continuing only solution said earlier. If you have a algorithm, preferbally a Neural Net that can regocnise ears and nose bridge, and shin, you should be able to find rations of the persons head.

If you need more info on this Google facial recognition via ratios.

Hope this helps

avatar image Cornelis-de-Jager · Jun 07, 2017 at 06:17 AM 0
Share

Chin not shin

avatar image JonPQ · Jun 07, 2017 at 04:29 PM 0
Share

You mentioned in the question above that you already track face and do 2D overlay... So you must already have eye positions, and maybe nose/mouth. ...and possibly orientation of eyes/face.... This is where some tricky math would come in... IF you have eye positions in 3D space, and orientation, you can calculate center of head pretty easy with some vectors and anatomy.... center of head is usually mid point between the eyes, and take vector directly backwards from there about same distance as distance between eyes... you can experiment with multiplier to get the right distance back.

If you don't have any 3d positional info... it would get a lot harder... You'd have to calculate same 3D info from the 2D eye positions, combined with camera position.... and take a few things for granted... such as a known hard coded fixed distance between the eyes. Don;t know how you'd get face orientation though unless the existing software provides it.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

71 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

Related Questions

Augmented Reality for desktop app 3 Answers

Display 3d model after removing focus from image target 0 Answers

Need Help To Show Unity UI on Vuforia 2 Answers

Control Unity Scenes with Android studio button click(Intents)... 0 Answers

Augmented Reality Reverse Engineering 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