3D Model Construction and Viewing, an Update, pt. 2

In my initial post on this subject, I finished by constructing a test house in Sketchup, and importing that into a basic Unity game, with typical FPS (first person shooter) style controls- moving with WASD, jumping with space, and looking around with a mouse. Since then, the project has advanced in both of those ways: the house and the game.

As previously discussed, while other 3D model viewers already exist, none that I found allowed you to walk through them akin to a game, which I consider to be significantly more immersive than simply viewing it. Thus, I decided to make my own. Since the last post, the basic coding hasn’t changed- movement and vision work the same.

However, I decided to add a new feature- when you looked at a mosaic, I wanted to be able to pop up a screen, displaying both the mosaic from a head-on perspective, and also information about it- such as its name and current location.

A screenshot of the info display within the Model Viewer

This took quite a long time.

In my first attempt, I used the built-in Unity functions of OnMouseEnter() and OnMouseExit() to determine when the cursor was looking at the mosaics- when the mouse entered the confines of a mosaic, code would begin to run, checking to see if the user pressed the “e” button. If they did, then the desired info would all pop up. Once the user pressed “e” again or moved their mouse outside the confines of the mosaic, the information would disappear.

However, while this worked in testing, it didn’t work once the program was built in WebGL and uploaded to the site. This is because for security reasons, browser games can’t move the cursor- thus, the in-game crosshair and the actual mouse didn’t line up, so when the crosshair was hovering over the desired mosaic, the mouse wasn’t, so the code didn’t execute as desired.

To fix this, I had to implement my own method of detection, which was Ray casting. This continually drew a ray from the center of the camera out into the world. I could then detect when that ray hit objects, and which object it hit. Once I knew that, I could check if the object was a mosaic, and if so, it would pull up the info as desired.

The code that displays and hides the Info Display on a key press
The code that handles the ray casting, and general logic of the system

After this, a smaller problem remained- the images and text didn’t scale properly with window and screen size, but this was easily fixed with a settings change.

However, there is still work that can be done. The exact method of embedding the program in the website is still to be decided. Verge3D, an extension for WordPress, allows for direct hosting of the application, as well as easy full-screening. However, so far, I haven’t found out how to host it without the game being partially cut off. Hosting on simmer.io and embedding using <iframe> allows for a cleaner appearance, but may have legal issues of publicly hosting content including non-public images of mosaics, and doesn’t seem to allow for full-screen.

Additionally, further features could potentially be added, allowing for time, such as recreating the real topography of Antioch within the game, so the house would be positioned as it was in real life.

BB

3D Model Construction and Viewing, an Update, pt. 1

In my initial post on this subject, I finished by constructing a test house in SketchUp, and importing that into a basic Unity game, with typical FPS (first person shooter) style controls- moving with WASD, jumping with space, and looking around with a mouse. Since then, the project has advanced in both of those ways: the house and the game.

As the entire purpose of this project is to allow the viewer to experience an ancient house and their mosaics, recreating a real ancient house is of utmost importance. However, as no ancient Antioch houses exist beyond their floorplans, any recreation needed to be based on a floorplan recorded by the original expedition. Additionally, not many houses had their mosaics’ positions recorded, so only those few houses can be recreated for our purposes. Finally, several of those specific houses have already been recreated by other scholars in this field, so those couldn’t/shouldn’t be made either. After all of these requirements, one house was found: The House of Menander. The floorplan with the mosaics in place was found in The Fate of Antioch Mosaic Pavements: Some Reflections by Claudia Barsanti in Journal of Mosaic Research 5.

Floor Plan of the House of Menander, with Mosaics inserted in proper locations.

The first step of recreation was to as accurately as possible recreate the floor plan in SketchUp. This was done by taking a screenshot of the floor plan and opening it up in GIMP. Then using the Measure Tool, I measured the length (in pixels) and angle of each individual line segment on the floor plan, and in SketchUp, drew a line segment of the correct length using the Line Tool, and then rotated it to the proper rotation using the Rotate Tool. While this wasn’t completely accurate, I attempted to get within 1-2 pixel accuracy, and within .1˚ accuracy.

The Floor Plan recreated in SketchUp

Once this was done, I turned the project over to Marina to build the floor plan into an actual house so I could focus more on the house viewing program, which I will discuss in my next blog post.

BB

3D Model Construction and Viewing, a Progress

In general, my focus has been on the public-facing side of research. As the website is currently functional, my focus has shifted to our desire to construct a 3D model of an ancient house in Antioch, with its actual mosaics placed properly.

The two necessary components for this project are a program to create the house, and a program to display it. For the first, Sketchup was chosen, both for its free cost, and its focus on architectural 3D modeling. For the second, Unity was, at least for now, chosen. Both for its free cost, as well as my desire to improve the viewing experience. While free 3D model viewers would be by far the simplest option, I don’t believe that viewing a model in that model is conducive towards actually experiencing mosaics as they were designed to be displayed, which is the entire idea of constructing the model. While they may be in the proper places in the house, you still wouldn’t be looking down at them, as instead you’d be zooming and spinning around the model from above. Thus, I feel that the only way to fully see the mosaics in a new way would be to embed the whole house into a more traditional first-person perspective, common in games.

By following some tutorials, this simple test house was constructed in Sketchup Free. The tools available in this program seem adequate for the level of detail we can conceivably get in our model, so from that perspective no other modeling software seems necessary. Some issues did arise when transporting this model into Unity, however:

Because of limitations in Sketchup Free, when exporting the model into Unity, the textures become lost. Thus, unless other solutions are found, we will need to either purchase an upgraded form of Sketchlab, or simply do the texturing within Unity. Unlike Unreal Engine, Unity doesn’t seem to come with built in first-person controls, so those needed to be constructed from scratch (also from a tutorial).

The left image is the code for movement throughout the ‘game’, and the right image is for looking around the ‘game’. Next, a sample terrain, along with a sample stone brick texture were downloaded from the Unity Asset Store, and the result follows:

Finally, this program was built, and imported into this website using the Verge3D plugin. It can be tested, in its extremely prototyped stage, at antiochrecoveryproject.org/gametest.

Next steps: Most importantly for the success of the project is the fixing of the texture issue. As free solutions are always best, I’ll be looking into possible methods of properly importing textures into Unity or learning how to manually import desired textures into Unity for texturing within the program. Also necessary is the construction of the actual model, as true to life as possible, using archaeological drawings as reference.