Build a 3D Aquarium Using WebGL
Tags: webgl, 3d, tutorial, unity3d
Published: 2022-05-13 05:33:55

<center>[![equariumgif.gif](https://i.postimg.cc/vTLfCzGJ/equariumgif.gif)](https://postimg.cc/2Ly1ZnbG) </center>

This digital "Equarium" loads its decorations and fish at runtime using Unity, the [**echo3D**](http://www.echo3d.co/) API and WebGL. The echo3D platform allows the app to select and display multitudes of different fish types without requiring any asset bundling or inclusion in the app build itself. New critters can be added by uploading to your echo3D project without increasing the app footprint. The full demo can also be found on echo3D's [GitHub](https://github.com/echo3Dco/Unity-WebGL-echo3D-Aquarium/blob/main/README.md).

Because fish are randomly selected, scaled and textured no two aquariums will ever be exactly the same!

Register
========

Don't have an API Key? Make sure to register for FREE at [echo3D](https://console.echo3d.co/#/auth/register)

Setup
=====

1.  Clone this [project repository](https://github.com/echo3Dco/Unity-WebGL-echo3D-Aquarium) locally
2.  Also [download Unity](https://unity3d.com/get-unity/download/archive) (2020.3 LTS version strongly recommended) if you don't have that yet!

> Two projects are required so create one additional project after signing in via the console (one project is created upon sign up).

Upload models to echo3D
-----------------------

1.  From the project root, open the Models/Critters folder and upload all files to one project. This will be your 'fish' project.
2.  From Models/Decor, upload all files to your other project. This will be your 'Static models' Project

Populate Globals.cs
-------------------

1.  Enter the API and security keys for each project within the `Globals.cs` file located in Assets/Scripts/
2.  Enter the entry IDs for the hammerhead shark and all static models. You can find the entryIDs via the echo3D web console.

Running the app
===============

After completing setup, open the project with Unity. Follow the instructions on our [documentation page](https://docs.echo3d.co/unity/adding-ar-capabilities) to [set up your API key](https://docs.echo3d.co/unity/adding-ar-capabilities#3-set-you-api-key) in Unity. Run the editor or build the app (WebGL is the only tested build target for this app!). Within a browser sounds will not play until you interact with the window. Increase the music volume with "P" and decrease with "L". Reload the page / re-run the editor app to load different fish and try to see them all! 

***

<center> ![](https://miro.medium.com/max/1154/1*u2dy3JM7swgXi6dPSoCXEA.png)**Scan this QR code or click this** [**link**](https://go.echo3d.co/vvSH) **to see it in AR!**  </center>

***

Notes
=====

Due to browser limitations models loaded via this app will not respond to changes in metadata made via the echo3D platform (Scale, rotation etc.). Refreshing the app will re-fetch models with reflected changes.

Credits
=======

This demo implements features or assets from the following Unity Asset Store packages:

*   [Thalassophobia: Stylized Oceans](https://assetstore.unity.com/packages/3d/environments/landscapes/thalassophobia-stylized-oceans-192227)
*   [Everloop](https://assetstore.unity.com/packages/audio/music/everloop-nonlinear-soundtrack-45205)

A big thanks to mdsn and their terrific [aquarium gurgle sound!](https://freesound.org/people/mdsn/sounds/175274/)

Learn More
==========

Refer to our [documentation](https://docs.echo3d.co/unity/) to learn more about how to use Unity and echo3D.

Support
=======

Feel free to reach out at support@echo3D.co or join our [community channel on Slack](https://go.echo3d.co/join).

More Tutorials
==============

To learn how to make other similar projects, try one of these:

*   [Make a Valentine's Day Slideshow in AR (No code)](https://medium.com/echo3d/make-a-valentines-day-slideshow-in-ar-free-and-no-code-c1e35a4206d4)
*   [Get a Quarantine DogΓÇªin AR! (No Code and Free)](https://medium.com/echo3d/get-a-quarantine-dog-in-ar-8383ea55376b)
*   [Quick and Easy AR Retail Apps with echo3D!](https://medium.com/echo3d/quick-and-easy-ar-retail-apps-with-echo3d-12640e21e5d9)
*   [How to Create 3D Content and See It In AR (No Code and Free)](https://medium.com/echo3d/how-to-create-3d-content-and-see-it-in-ar-free-no-coding-required-369e5b4a4b3e)

***

> _**echo3D** ([www.echo3D.co](http://www.echo3d.co/); Techstars 19') is a cloud platform for 3D/AR/VR that provides tools and network infrastructure to help developers & companies quickly build and deploy 3D apps, games, and content._

![](https://miro.medium.com/max/1400/1*cNrRDT0JEpkcy-zG6KBNgw.png)