Unity3d with AR Foundation - How To Add Images And Textures For AR Image Tracking?

  Рет қаралды 14,834

Dilmer Valecillos

Dilmer Valecillos

4 жыл бұрын

Loading images at runtime was one of my questions before I started working with image tracking in AR Foundation, in this video, I provide you with a detailed example where we add multiple images, textures, and then use them to load them into the AR System by using Unity's job system.
Source Code:
github.com/dilmerv/UnityARFou...
** Support me by Subscribing to the channel as it will help me in bringing a lot more content and also as a way to show your appreciation for the free source code provided above **
bit.ly/2NmnFMu
** Find the source code in Patreon and support me if you can even if it is with one of the lower tiers as it helps me in bringing you more content - THANK YOU **
/ dilmerv
** EQUIPMENT USED TO RECORD THIS VIDEO **
- Rode Wireless Go - amzn.to/2J7RCw6
- Rode smartLav+ Omnidirectional Lavalier Microphone for iPhone and Smartphones - amzn.to/2LBQra6
- Rode SC7 3.5mm TRS to TRRS Patch Cable - amzn.to/2XTaYxv
- Blue Snowball iCE Condenser Microphone - amzn.to/2Ija0lo
- JOBY GorillaPod 3K Kit. Compact Tripod 3K Stand - amzn.to/2Xh4Bni
- JOBY GorillaPod 5K Kit. Professional Tripod 5K Stand - amzn.to/31Ew0yW
- Photography Photo Portrait Studio 600W Day Light Umbrella - amzn.to/2WwI0Tc
- AmazonBasics 60-Inch Lightweight Tripod with Bag - amzn.to/2Wd8utF
- Canon EOS Rebel T6 Digital SLR Camera Kit - amzn.to/2WcnRlV
Get realtime indie development tips from me in Twitter
/ dilmerv
Subscribe to my indie development videos & game releases newsletter
www.dilmergames.com
Blog about Indie development and startup
www.dilmergames.com/blog

Пікірлер: 31
@franciscocriscuolo6350
@franciscocriscuolo6350 4 жыл бұрын
Thank you for experiment and explain to us the easy way to do this things so we can develop new things
@dilmerv
@dilmerv 4 жыл бұрын
You are welcome Francisco and thanks for your feedback, if there is anything I am missing as far as content let me know :)
@franciscocriscuolo6350
@franciscocriscuolo6350 4 жыл бұрын
@@dilmerv Now that you say that... i was wondering if you can explain clouds anchors. I like to make a game where two players battle against each other in the same "battle board".
@ericgroz
@ericgroz 3 жыл бұрын
Thanks for the great video, I was really looking for something like this! I just found one line of code I am not sure about. Why do you create an XRReferenceImage in TrackedImageInfoRuntimeSaveManager on line 92. After creating it you never use it again and later on you start the Job "ScheduleAddImageJob" with only the texture2D. Is it necessary for something else?
@SurajKumar-gc3kg
@SurajKumar-gc3kg 4 жыл бұрын
System.InvalidOperationException: The texture must be readable to be used as the source for a reference image. At UnityEngine.XR.ARFoundation.MutableRuntime . I was trying to add image from photos folder of gallery dynamically . Is there any possible way to convert texture image readable for ARFoundation dynamically from gallery images of a phone .
@rjclark730
@rjclark730 2 ай бұрын
I appreciate the videos and they are useful, I just wish you would indicate what previous videos. Its not easy to find them since there is no series numbers and the titles are not really connected. Just a thought, don't take it as a complaint.
@Hugop_arts
@Hugop_arts 4 жыл бұрын
Thanks for all that info! My main struggle at the moment is trying to swap the prefab depending on what image is being tracked; meaning assigning a specific prefab for each image. I know I could reference the image's name and depending on the name instantiate a specific prefab, and leave a the string for the name and the prefab as public variables, but my struggle is to find WHERE in the original AR Foundations code the instancing of the prefab is happening, to be able to edit it. I guess my workaround could be on the prefab itself have some sort of check, to see which image it is being spawned from, and depending on what image it is, it does something different... Maybe its easier this way? Would love to hear your thoughts
@dilmerv
@dilmerv 4 жыл бұрын
I did an example of exactly what you are looking for here it is: github.com/dilmerv/UnityARFoundationEssentials/blob/master/Assets/Scripts/TrackedImageInfoMultipleManager.cs
@Hugop_arts
@Hugop_arts 4 жыл бұрын
@@dilmerv Thanks! I ended up doing something on my own but your code looks cleaner than what I did. Essentially I created two public arrays - one of game objs and one of strings. You add the game obj to the index of its array that matches up with the index of the string on the other array that is the same as the name of the image that is supposed to instantiate it. It just runs a for loop through the String Array and checks if it matches the ImageTracked.name and if it does, it instantiates the gameObject[i] that matches up and adds to a private list of spawneditems. A little messy but I am still learning haha
@rafaelladeia7278
@rafaelladeia7278 2 жыл бұрын
Man, really thank you so much! Yours content made me possible to develop something that I believe will gonna be powerful! Absolutely I wish to retribute you in the future for all this! I still have one question: how can I allow to the user pick local image file and put this as an augmented object during runtime? Thank you, again!
@dilmerv
@dilmerv 2 жыл бұрын
Thanks for your nice comment and about your question, here is a video showing you exactly how to add images at runtime kzbin.info/www/bejne/bKbEimmlbbWnsMU Best !
@rafaelladeia7278
@rafaelladeia7278 2 жыл бұрын
@@dilmerv thanks!!
@aiadtariq9964
@aiadtariq9964 4 жыл бұрын
Thanks a lot for all these great info .That's exactly what I was looking for .I want to ask how can we take screenshots from the camera live feed and and convert it into an image that can be instantly tracked .
@dilmerv
@dilmerv 4 жыл бұрын
That’s a video I am working on :) I will make it available in a few days.
@aiadtariq9964
@aiadtariq9964 4 жыл бұрын
@@dilmerv Awesome ,thanks a lot I also want to ask you about ARReferencePoint .I noticed that when I create an reference point with some prefab and then move around with the phone and go back to that reference point ,the game object will be drifted in most of the time .However ,only when the reference point gets updated ,it will stick back to its original location ,so the only way I could see was to wait until the system gets more familiar with the environment with some internal criteria ,it would then update the position of the reference point back to where it was places/created .Is there a way to externally trigger that update ? If not ,how can we control that shift ,is there something we can do ? In the blog below from unity : unity3d.com/how-to/create-best-AR-experiences It mention in blog that “if things start to drift and wobble in your scene that’s because your frame rate dropped” Would like to hear your thoughts on that .
@sh4rky70
@sh4rky70 4 жыл бұрын
​@@dilmerv I am interested in this implementation as well. Being able to use any image as an anchor has lots of possibilities. I noticed that to use an image as a tracker, it needs to be read/write enabled. I suppose accessing read/write capabilities on a Texture2D object that is created at runtime is the difficulty here.
@Hugop_arts
@Hugop_arts 4 жыл бұрын
@@sh4rky70 I just worked on it and simply running: "SpawnedItem.transform.position = trackedImage.transform.position; SpawnedItem.transform.eulerAngles = trackedImage.transform.eulerAngles;" makes sure whatever item I've spawned uses the specific image as its anchor. You could just equate the transforms, but I wanted to leave my scale somewhat independant (tho it will resize if the tracked image gets bigger or smaller - still unsure why)
@vikramreddyjali917
@vikramreddyjali917 4 жыл бұрын
Hi Bro Nice videos can you do one video on ARKit image tracking one image and 2 prefabs in run time need to switch between prefabs with single image target.
@dilmerv
@dilmerv 4 жыл бұрын
Sure I can do that thanks for your time and suggestion.
@inbasatfiza9040
@inbasatfiza9040 4 жыл бұрын
Hi.. Can we upload an image at run time to the database? For example, we select which image to track while the application is running and show the target image against it??
@dilmerv
@dilmerv 4 жыл бұрын
Yes I have many videos about this in my AR Foundation playlists.
@inbasatfiza9040
@inbasatfiza9040 4 жыл бұрын
Do you upload that image from the gallery at the runtime of application? Can you share that specific link, please?
@dilmerv
@dilmerv 4 жыл бұрын
Here is the video showing you how to do it :) kzbin.info/www/bejne/l5eQp4xoh9N8otU
@inbasatfiza9040
@inbasatfiza9040 4 жыл бұрын
@@dilmerv Thank you so much :)
@chakravarthye
@chakravarthye 3 жыл бұрын
Hi Dilmer, I have been following your tutorial and am using Unity 2019.4.9f, with ARFoundation 3.0.1 and ARCore 3.0.1. I get the below error when buiding the app. Do you have any pointers that can help me. I am fighting deadlines along with this tech hurdle. . . . Any help would save me. Failed to generated ARCore reference image library 'RuntimeImageLibrary' UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() BuildFailedException: Failed to generate image database. Output from arcoreimg:
@Tester13565
@Tester13565 3 жыл бұрын
I think Some Image cant use ImageLibrary to build, and I convert file type to jpeg.
@chakravarthye
@chakravarthye 3 жыл бұрын
@@Tester13565 thanks for replying. I did solve the problem by the by making it jpg, checking the read write option to true as well. Lots of delicate things need to fit together for these to work 🙂
@ayhansakarya2637
@ayhansakarya2637 4 жыл бұрын
Is there a way to test this inside the editor?
@dilmerv
@dilmerv 4 жыл бұрын
No currently but I know Unity is working on a remote that will allow us to do so.
@SurajKumar-gc3kg
@SurajKumar-gc3kg 4 жыл бұрын
System.InvalidOperationException: The texture must be readable to be used as the source for a reference image. At UnityEngine.XR.ARFoundation.MutableRuntime . I was trying to add image from photos folder of gallery dynamically . Is there any possible way to convert texture image readable for ARFoundation dynamically from gallery images of a phone .
@hammedarowosegbe5708
@hammedarowosegbe5708 3 жыл бұрын
Watch 2:00 - 3:00, Dilmer stated it :p
Now THIS is entertainment! 🤣
00:59
America's Got Talent
Рет қаралды 38 МЛН
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 165 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 58 МЛН
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 7 МЛН
How Bugatti's New Electric Motor Bends Physics
9:25
Ziroth
Рет қаралды 77 М.
I Melted Wood With Friction
8:44
The Action Lab
Рет қаралды 942 М.
Get Started with AR in Unity in 6 minutes!
6:59
Novaborn
Рет қаралды 130 М.
Crowdstruck (Windows Outage) - Computerphile
14:42
Computerphile
Рет қаралды 119 М.
KeyShot Quick Tip - How to Deliver AR with QR Codes
3:11
KeyShot
Рет қаралды 53 М.
Augmented Reality Tutorial | Gaze Interaction in Unity
17:18
Third Aurora
Рет қаралды 62 М.
Now THIS is entertainment! 🤣
00:59
America's Got Talent
Рет қаралды 38 МЛН