Log in or register to post comments

How to make an augmentation coming out of the floor

January 26, 2016 - 7:45am #1

Hello,
Please forgive me if this sounds ridiculous. I am a graphic designer, with very little programming skills, but a desire to learn, who used Metaio for AR nd am now trying to learn Unity and Vuforia.
I am trying to re-create an AR scene I had origianlly created in Metaio's Creator.
In this scenario, I have a trigger image that is the botton portion of a poster that stands upright on the floor.
When the camera tracks the image, a 3D "Monster" appears to come up out of the floor and grab a 3D person who is also in the scene.

I was able to do this successfully in Metaio's Creator Studio.

In Unity, I have the tracking image in place at a 90degree angle to my 3D models. I have the 3D models positioned in front of the tracking image as children of the trackng image.
The models were supplied to me as one .FBX file, with 2 animations Take001 and Take002.
I have placed what I'd like to call an "occlusion plane" <-- this maynot be the correct terminology, but essentially it should be invisible to the viewer, but at the same time hide the monster until the animation is played and the moster rises out of the floor to grab the 3D person.

My problem is:
The plane that I have placed bretween the 3D person and 3D monster IS VISIBLE to the user through the iPad camera. I want it to be INVISIBLE to the camera, so the viewer only sees the flor until the animation starts, and the augmentation appears.

I have been experimenting with depth-shaders, transparencies and the like, but with no success. I have also bee searching Google and YouTube for help without success.
I did find this article: https://developer.vuforia.com/library/articles/Solution/How-to-Use-an-occlusion-model
Unfortunately, I don't quite understand it and I've read and re-read it quite a few times. I'm sure this is what I need to do, but I don't understand the steps.

I have drawn a sketch of what it should look like.

I'd appreciate it if someone could help me out in plain Enlgish - I am a newbie, but like I said I want to learn.
Thankyou kindly for your time.
Kimber

AttachmentSize
Image icon help.jpg69.26 KB

How to make an augmentation coming out of the floor

January 26, 2016 - 2:08pm #7

@dpizzle

In answer to your questions, I am using Unity 5.3.1f1 and Vuforia... I'm not 100% sure, I don't think it's the latest and greatest.
No, the plane is not visible in the Scene view, and the Game view is entirely black, so I couldn't tell.

However, I do have a solution:

I have added the Depth Mask material from the Qualcomm Augmented Reality folder to my plane.
I have also added the Video Material material from the Qualcomm Augmented Reality folder to my plane.
Then, under the Video Material, I chose Customer > Video Background in the Shader dropdown.

My issue was that I was unaware that you can add more than one material to a given object.

Now, when I play the scene in the Unity player, the moster is hidden until it pops out from the "floor" and grabs the guy and pulls him down. Exactly as intended!

I really appreciate your time and effort.
I know it's difficult to help someone when you're not exactly sure of all the circumstances surrounding their project.
Hopefully, someone in the future may also be able to benefit from this posting.
Respect,

Kimber
 

How to make an augmentation coming out of the floor

January 26, 2016 - 1:26pm #6

Are you on the latest version of Vuforia and Unity?

Does the black plane show when you are in the editor (either scene view or game view) before pressing play?

Does the issue happen on a brand new blank project with just dragging in the ARCamera prefab and the depth mask plane?

 

How to make an augmentation coming out of the floor

January 26, 2016 - 12:35pm #5

@dpizzle,

I appreciate your time, and I'm sorry if my inexperience is exhausting.
I have followed your instructions, starting several times over, with the same results.

I am attaching a screenshot:
When my AR starts, and the trigger image is detected, and animation begins in which a person walks into the scene and is pulled below the floor by a monster.This screenshot shows the point at which both the monster and the person are "under" the floor.

It shows the plane (visible as a black rectangle).
This should not be visible as an object, but rather show the camera's view of the floor.

For testing, I am using Unity's player witht he camera on my Mac. Therefore, for this test, it wouldn't exactly show the floor, but it should show my lovely smiling face ;)

Do you have any idea what I may be doing incorrectly?
Again, I am thankful for your help and again, I apologize for being tedious.

Kimber
 

How to make an augmentation coming out of the floor

January 26, 2016 - 11:47am #4

This issue is a Unity issue and not related to AR.  Consider watching some tutorials on youtube to help you get started learning Unity or ask in the Unity forums.

In the mean time try this:

Create a new scene.

Menubar->Gameobject->3D Object->Plane

Right click in project window->Create->Material

Right click in project window->Create->Shader->Standard

Double click shader just created

Delete all and Paste in code

Save

Go back to editor

Drag created Material onto plane in either scene window or hieerachy window

Drag created Shader onto material in project window

 

 

 

 

 

 

 

 

How to make an augmentation coming out of the floor

January 26, 2016 - 11:23am #3

Thankyou, @dpizzle I appreciate your help.

I have done that - I used the DepthShader code supplied by Vuforia, which is the same as you have provided (thankyou).

The thing is, when I preview my scene in the Unity player, the plane does not appear invisible, but rather shows up as a flat, black rectangle.
It does hide what's underneath, but it is visible as an object.

Does that make sense?

Kimber.

How to make an augmentation coming out of the floor

January 26, 2016 - 11:08am #2

Not totally sure what you are doing, but if you want to hide a model from a user and have it bust out of the floor you'll want to use a depth mask shader.  Something like this:

Shader "DepthMask" {   
    SubShader {
        Tags {"Queue" = "Geometry-10" }
        Lighting Off
        ZTest LEqual
        ZWrite On
        ColorMask 0
        Pass {}
    }
}

Put that on a material on a plane.  Make the invisible plane big enough and anything behind the plane will also be invisible.

 

 

Log in or register to post comments