I want to create a simple AR application using unity3d, vuforia package and opencv. Normally in unity AR app, selected 2d target is found and virtual 3d object is projected.
I want to change these scenario.
Open AR camera
Get frame from camera
Process the frame using opencv functions(maybe opencvsharp)
Find marker and project virtual object
To do this task, I did below steps :
create a new project in unity
import vuforia package
delete main camera
add AR camera
The AR camera has 3 c# files, I open and look them. But I don't see any code open camera and get frame. The screenshot is below :
EDIT
Accepted answer helps load user defined marker.
This is the basic workflow of Vuforia using Unity.
Start from License Manager
On the License Manager page go to Add License Key
bPut in your details and if you don't plan to use a paid version in the Select Plan option click None
Now go to Target Manager
First Add a Database (if you don't have one already) and give it a Name, add License Key and click Create
Now inside your Database click Add Target and again put in all the details and upload your image.
Now Download Database and make sure you've set it's usage to Unity Editor
Now within Unity
Add your ARCamera
Import the Database you downlaoded into Unity through Assets - Import Package - Custom Package
Now in your Inspector Panel of ARCamera, you'll see Data Set Load Behaviour has your unity package name. Check it, and check Active as well
Now in Assets, Go to Qualcomm - Prefabs - ImageTarget and drag Image Target onto the scene.
In the ImageTarget Inspector you'll find ImageTarget behaviour and you can set the values to your Image.
From here on, what you do is completely up to you. You can add a Model or animate over is as you would on normal Unity applicatoins.
User Defined Targets can be found at: https://developer.vuforia.com/library/articles/Solution/Unity-Load-DataSet-from-SD-Card
Hope this helps.
Related
I am currently using the NVIDIA FleX package in Unity3D to create soft-bodied, jelly objects. I'm using Unity for animation only, not game dev.
What I am aiming to make is a transparent, jello sphere that retains its spherical shape with elasticity.
The first way I've tried to achieve this is using Flex Array + fluid setting. I've been playing with the settings but I can't get it to remain a sphere, it just becomes a more/less viscous fluid blob.
The second way is using the Flex Soft + fluid setting. It is much better in terms of physics but even with "draw particles" off, but the water droplets are each separated and not one jelly sphere.
This is what it looks like before hitting play, where the left is with Flex Array and the right is Flex Soft. The particles for Array are visible but not for Soft.
This is after hitting play, where the Array becomes one viscous fluid, but not a sphere, and the Soft is very jello-like but the water droplets are all separated.
A solution for either of the two ways would be much appreciated!
the standard approach is to create an Nvidia Flex Controller first...
Then you should also create a Flex Soft Asset...
Then you should create or select a game object and through the Add Component tab in the game object's inspector, find the Flex Soft Actor component [see it loaded up in the image below]...
Ensure your Soft Actor Asset mentioned previously has your required mesh type selected in the inspector option [I chose sphere in the image here] and check to see it looks something like the image below to be sure...
So after that, hopefully, you can just press play and see it in action as it drops and contorts for you.
If not, I have created a quick example for you to download as a unitypackage.
It may still require further resolution with the package manager as the Flex plugin is already inside the package I'm providing here[Using Unity 2020.3.5f1]
Flex in unity package
Anyway, hope this gets you started and somewhere towards your goal with Flex.
As a bonus, I've added a small script to move the flex object as this is outside of the usual approach as we have to call to the NVidia Flex component class of choice and invoke the ApplyImpulse method.
Cheers :)
Edit: There are a small 3 set of tutorials from NV Gameworks on integrating the plugin with Unity and exampling some stuff - this "stuff" is included in my downloadable package provided above.
Here is the youtube link to the 3 set:
Nvidia Gameworks FleX tutorials on Youtube
Edit 2: rereading your question made me think I hadnt really given you the definitive answer as to using a cloth actor and having the mesh renderer deform via the flex cloth deform component.
I am providing another link to another unity package here that will show this in action also allowing you to see the game object and how the cloth component from NVIDIA Flex works with the standard mesh filter and mesh renderer. Hope this more accurately answers your question :)
Example also using Cloth Actors as well as Soft Actors in NVIDIA FleX
I am making a game in unity and I want to add motion blur visual effect. Which components are required to do that and is any scripting required? If yes, can anyone give an idea?
Also, I need to know how to toggle it through UI.
Go to your package manager in unity, add Post-Processing.
After that create a new post processing profile in the assets and add motionblur to that. Create a post processing volume in ur scene, set it to global and select the posyprocessing profile. Finally place a post processing layer on your camera and set the layermask to everything.
[Unity Post-Processing Documentation]https://docs.unity3d.com/560/Documentation/Manual/PostProcessing-Stack-SetUp.html
This may be a dumb question but what the hell. So I understand Vuforia Reco targets auto find the target based on your targets defined via dev portal.
How do you define which cloud reco target is assigned to a given ImageTarget? Mainly just for reference on scale and position!! Thanks Guys!!
You won't need to put multiple ImageTarget prefabs in the scene. and, you won't have any option to select a target from the inspector as you get in ImageTarget component.
Normal ImageTargets: Multiple imageTarget prefabs in the scene.
Cloud-reco: One cloud-reco gameobject in the scene.
While the ImageTarget component returns whether it has been scanned or not, the cloud reco gameobject will return the name of target if its available on vuforia cloud.
I have followed this particular tutorial: https://www.youtube.com/watch?v=ir9Rvi1QG8Y to add a particle system effect on a UI panel. It works well in scene mode and game mode but when built for android no particles are shown. I have tried tweaking the particle shader, material etc.. but to no avail. What do you recommend please? Thanks.
Unity version: 2018.2.11f1
Screenshot1
Screenshot2
After recreating the project myself I've found out that its because of a sloppy code in UIParticleRenderer class.
Shader foundShader = Shader.Find("UI/Particles/Additive");
in line 79
when you try the game in Editor "Find" method works correctly, but when you want to publish it to a device (android) it won't include "UI/Particle/Additive" shader so the shader won't be found.
there are 3 solutions to this problem as described for Shader.Find class in Unity documentation :
reference it from some of the materials used in your scene
add it under "Always Included Shaders" list in ProjectSettings/Graphics
put shader or something that references it (e.g. a Material) into a "Resources" folder.
I used the 2nd solution (which is easier to do) and it solved the problem. so you can go to Edit->Project Settings->Graphics and under "Always Included Shaders" section Add "UI Particles Add", then build and run your project.
Everyone.
Vuforia Camera does not work, but only black screen on Android 6.0+ versions.
Vuforia Version is 6.2.2 and Unity version is 5.4.4
But vuforia camera works on less than android 5.0
How can I fix this issues?
I hope you to teach me about this.
This is an interesting problem I have and there is an unacceptable temporary fix I am using while testing this system out. For the iPhone 7, to get past this suspend the app and then return to it. After about 2 seconds the camera will work. I am guessing it will work similar for android. I will update with a better fix if I come by a real fix after my testing if I decide to use this system.
Edit:
Short answer:
Delete the meta data for any pre-existing custom camera controller script. If you are using your own camera controller you need to disable the vuforia one and delete the meta for that. You are basically hijacking the camera feed after it starts.
long: I began this application by building out my own system and to test vuforia I disabled these items (like the camera feed). I went through the logs and saw that even with these items disabled the camera feed was still running and this feed started AFTER the vuforia camera so basically my own start() methods (even though they were disabled) were hijacking the camera from vuforia. It turns out that my meta data for my camera controller script was still poised to run the script even though everything was disabled. After deleting my camera controller script meta data it worked fine. You can also just delete the camera controller and it will delete the meta. By camera controller I mean my custom written camera controller that was built before I added in vuforia. This is a hard to find fix because it works fine in unity, but not when you build out to a device. The meta doesn't seem to update for the device, just the unity engine.
If you are using the vuforia camera make sure you either use the vuforia plane that comes as a child of the camera or delete the meta data to whatever camera script you wrote. You should get camera feed in a new empty project just by dropping in the vuforia camera, there is no need to build your own script and if you do, make sure one isn't overriding the other like mine was.
If you want to simply test to make sure it isn't your device or code create a NEW empty unity project, import vuforia (no need to import the database, just the sdk) and then drop the vuforia camera into the project and test it. Don't add anything extra or do any image recognition. If this works, it's your code somewhere.
I am using Vuforia 6.2.10, Unity 5.4.4.f(64 bit) and a Nexus 7 Android 6. I had the same issue where the camera was black. I started over, adding one component at a time. The AR Camera alone worked fine. Adding a Target Image also worked. I added a plane and image to the TI and the camera failed to work. Setting the image texture type to Sprite 2d and ui seemed to help.
I discovered that by deleting the app from the device and creating a apk file each time it worked.
I am not sure I'd count on Vuforia in the near term.