Skip to content

lvrg12/WaterElevation

Repository files navigation

CS 5331-002 - Virtual Reality Project 3

Topic: Water Elevation

Proposal Phase

Descriptive Title:

  • Extended Water Elevation of Underground Water Project

General Discription:

  • We will autogenerate the terrain or add more cities. We will add the yearly saturated thickness data. We will add more prefabs to decorate the terrain. In addition, we will create new buttons to teleport to different wells. We will also add more facts about each city. In addition, we will also add music that people can hear while they are playing because that is an important aspect. The reason why VR is beneficial is that VR allows the user to get a firsthand perspective of the landscape of the city they choose, which fosters an immersive experience. In addition, users can feel a more real experience than looking at a 2D representation by using VR.

Hardware platform we will use:

  • PC, Oculus Rift

Software we will use:

  • Unity
  • Visual Studio
  • Visual Studio Code

Work Distribution

  • Wenhao's role: He will use prefabs to decorate the terrain and add some animations to GameObjects.
  • Kevon’s role: He will create several buttons to teleport to different wells and do other things.
  • Lino's role: He will do the terrain autogeneration

Video Demonstration

Screenshots

Project Report

Project Description

  • We autogenerated the terrain and added more cities. We added the yearly saturated thickness data. And we added a slider so that people can access the saturated thickness data from 1995 to 2014 by dragging the slider. We added more prefabs to decorate the terrain. In addition, we created new buttons to teleport to different wells. We also added more facts about each city. In addition, we also added the background music that people can hear while they are playing because that is an important aspect.

Functionality

If the user drags the slider from left most to right most, the saturated thickness data will change from 1995 to 2014.

If the user click the cities button, then choose a city and click start button, that city will be generated

If the user clicks the 'Toggle Terrain' button, the terrain disappears and user can see the underground water

If the user hovers the mouse over each well, information aboutparticular well will display.

Auto-Generation

As soon as the system starts, it starts reading, computing, and delivering data. Most of the objects in our scene are auto-generated by multiple c-sharp scripts. These scripts gather data from various csv files. The c-sharp scripts generate the wells, their depth, their saturated thickness in different years, aerial markers, and a water layer that spans the whole terrain. These scripts use multiple math operations to map the real life measurements to the unity measurements. In this manner, we were able to accurately place the wells where they are in real life and replicate the measurements of the underground water layer. In addition, we also accurately placed the water fountain inside each of the well. When people hover the mouse over each well, well-related information will show up.

Main Menu

This is the initial scene, a drop-down menu and three other buttons are in the main menu. The drop-down menu is called 'selection'. When people click it, there will be five cities for people to choose. After clicking the city people want to go, then click 'start' button, that city will be generated. After the new city is being generated, people can also click "main menu" button to go back to the main menu.

First Person Control

With a first person controller the user is able to navigate through the map; adding a realistic field experience. If the user aims the cursor to the auto-generated wells information is displayed. The user is also able to click on the provided bottons which are described in the next section.

We learned...

  • How to write Python code
  • How to read CSV files
  • How to calculate Water Elevation
  • How Water Elevation, Saturated Thickness, and LSD relate to one another
  • How to write script to make the panels appear and disappear according to some specific conditions
  • How to write script to make slider call different functions
  • How to make a drop-down menu
  • How to add the background music
  • How to write script to read the data from .csv files and display the information in the panels
  • How to write script to show different years when people drag the slider
  • How to add some dynamic pictures to the project report
  • How to write script to make different terrains generated according to which city user choose to generate
  • How to add the satellite map to the height map
  • How to write script to toggle the terrain
  • How to write script to toggle the water

Biggest Issues

  • Autogeneration
  • Script writing
  • Csv files data generation
  • Measurement type
  • Measurement congruency
  • Merging all project versions in Github

In C# functions expalined below, the following variables are used to explain how the data is being read from the .csv files and the variables are also used to explain how did we write the script to generate different terrains when people choose different cities. ... C#...

   TextAsset txtAsset = (TextAsset)Resources.Load("coordinates", typeof(TextAsset));
    string[] lines = txtAsset.text.Split('\n');
    

    txtAsset = (TextAsset)Resources.Load("currentCity", typeof(TextAsset));
	city = "" + txtAsset.text[0] + txtAsset.text[1];

    string[] coords;

    if(city == "Lu")
    {
        terr = Instantiate(lubbock_map, new Vector3 (0,-2.0f, 0), Quaternion.identity);
        datafile = "Lubbock_optimized_May";
        coords = lines[1].Split(',');
    }
    else if(city == "Am")
    {
        terr = Instantiate(amarillo_map, new Vector3 (0,1.9f, 0), Quaternion.identity);
        datafile = "Randall_optimized_May";
        coords = lines[2].Split(',');
    }
    else if(city == "La")
    {
        terr = Instantiate(lamesa_map, new Vector3 (0,-5.4f, 0), Quaternion.identity);
        datafile = "Dawson_optimized_May";
        coords = lines[5].Split(',');
    }
    else if(city == "Mi")
    {
        terr = Instantiate(midland_map, new Vector3 (0,-5.0f, 0), Quaternion.identity);
        datafile = "Midland_optimized_May";
        coords = lines[3].Split(',');
    }
    else if(city == "Pl")
    {
        terr = Instantiate(plainview_map, new Vector3 (0,-3.0f, 0), Quaternion.identity);
        datafile = "Hale_optimized_May";
        coords = lines[4].Split(',');
    }
    else
    {
        terr = Instantiate(lubbock_map, new Vector3 (0,1.9f, 0), Quaternion.identity);
        datafile = "Lubbock_optimized";
        coords = lines[1].Split(',');
    }

The following functions are used to explain how did we write script to let each well display the information when the mouse hovers over well. ....C#...

void OnMouseOver()
{
    CanvasObject.enabled = true;
    t.enabled = true;
    t2.enabled = true;

    t.text = i1+i2+i3+i4;
    string i8All = "Saturated Thickness\n";

    for (int i = 0; i<i8.Length; i++)
    {
        i8All += i8[i];
    }

    t2.text = i8All;
}

void OnMouseExit()
{
    CanvasObject.enabled = false;
    t.enabled = false;
    t2.enabled = false;
}

The following functions are used to explain how are different years being displayed when peope slide the slider ...C#...

 Text percentageText;

void Start()
{
    percentageText = GetComponent<Text>();
}

public void textUpdate(float value)
{
    percentageText.text = (Mathf.RoundToInt(value) + 1995).ToString();

}

The following functions are used to explain how did we add background music and also explain why does the music last forever. ....C#....

public class DontDestroy : MonoBehaviour {

 void Awake()
{
    DontDestroyOnLoad(transform.gameObject);   
}
}

The following functions are used to show how did we write scripts to toggle the terrain and toggle the water

public void ToggleTerrain()
{
	if(visibleT==true)
	{
		runner.GetComponent<GenerateWells>().SetTerrainVisibility(true);
		visibleT = false;
	}
	else
	{
		runner.GetComponent<GenerateWells>().SetTerrainVisibility(false);
		visibleT = true;
	}
	
}

public void ToggleWater()
{
	if(visibleUG==true)
	{
		runner.GetComponent<GenerateWells> ().SetUGVisibility(false);
		visibleUG = false;
	}
	else
	{
		runner.GetComponent<GenerateWells> ().SetUGVisibility(true);
		visibleUG = true;
	}
	
}

Contributors

  • Lino Virgen, Wenhao Ge, Kevon Manahan

Dynamic features/interactables

There's a main menu when you begin the game that allows the player to select which city will be used. Whenever you hover the mouse over the well from within the game, it will display the information about each well. Also there is a User Interface which allows the player to cycle between cameras(Main Menu, Elevation, Aerial, Slider, ToggleTerrain) by clicking each button respectively.

Work Distribution

  • Wenhao Ge's part:

    • Wrote the phase proposal
    • Created a sider and wrote script to show different years when the slider is being slided from left to right
    • Wrote script to make slider control many functions. When people drag the slider, different functions will be called according to the specific value of the slider
    • Made a drop-down menu and created five choices in the drop-down menu
    • Wrote script to control two panels to appear when the user hovers the mouse over the wells and let two panels disappear when the mouse leave the wells
    • Made two panels
    • Wrote script to read the data from .csv files
    • Added the background music
    • Changed the terrain coordinates to a more apropriate position
    • Wrote a big part in the project report
    • Wrote C# script to display all the well-related information in two panels when the mouse hovers over each well
  • Kevon's part:

    • Relearned Python
    • Wrote script to find Water Elevation for each year in each each city
    • Wrote script to find Saturated Thickness for each year in each city
    • Added lighting to all cities
    • Edited the Main Menu
  • Lino's part:

    • Gathered height maps for Amarillo, Midland, Plainview, and Lamesa
    • Introduced satelite map of mentioned cities to height maps
    • Revised c-sharp script to be more efficient
    • Added function to generate city automatically
    • Added function to change saturated thickness and water elevation to different years
    • Made models of 5 different cities for autogeneration purposes
    • Rewrote formula to translate real coordinates to unity coordinates
    • Introduced new color code for unknown well data
    • Oversaw github repository and merges

References

About

This is the third project for CS 5331 - Virtual Reality. It provides data visualization of water wells and underground water in West Texas.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published