Table of contents
- Background
- Creation of applied AR
- Execution of the game
- Next Step
I will develop AR Game with Unity, AR foundation and so on. To learn AR development, I am researching about AR and the software related it. This blog shows the research and the process of developing AR game. If you have a question, I am happy to answer it.
This post will show the implement of AR game, which is named memorial world. I referenced the below course to learn how to create the AR game.
https://www.udemy.com/course/build-augmented-reality-ar-apps-with-arfoundation-unity/
If you want to create the similar game, you should check it out.
Game Mechanics
In this game, your memories are displayed in an AR space. You can see photos that remind you of your memories in the AR space, and seeing them in places that remind you of your memories will bring back even more memories.
Technology
In this game, while players can see pictures when they enter the AR entrance, player can not see them when they are out of the AR entrance. Therefore, it is necessary to change how to draw objects depending on the player’s position. To change it, these below functions will be used in this game.
- Shader
- Stencil Buffer
- Stencil Test
- Culling
Shader
This is the program that writes the way to draw. This allows objects to show on scenes. It can shows various expressions on objects such as shade.
Stencil Buffer
Shader and Stencil are similar and determine how objects are displayed. Stencil makes it possible to change the visibility of objects from certain areas and show pictures only at the entrance of the AR, which is what we want to do this time.
Stencil Test
Each pixel on the screen has a Stencil buffer value and the object has a Reference value. The stencil test uses these values to determine whether the object is allowed to be drawn.
Culling
The process that prevents Unity from performing rendering calculations for GameObjects that are completely obscured (occluded) by other GameObjects. In this game, it is used for being able to see real world from the inside of AR room.
https://docs.unity3d.com/Manual/SL-Cull.html
At this time, I displayed free images related anime OnePiece in the AR space for the purpose of introduction. You can actually your memory images. Also, I deployed it to my iOS device and confirmed to display AR objects. Please watch the video below.
If you have any questions about Unity and AR, I’m happy to answer them.
I will research APIs related AR and location information to use them for my game.