Magic Windows & Comp. Typo | AR Typographic Sculpting
Concept
https://www.hafiyyandi.com/single-post/2018/11/27/Magic-Windows-Final-Idea
https://www.hafiyyandi.com/single-post/2018/12/04/Magic-Windows-Comp-Typo-Final-Pt1
How the App Works
Setup: a server that serves default drawing commands from LeagueGothic-Regular.otf. Based on Allison's modify every glyph example.
App is initialized
Get device's location name, detect plane, check database
Draw location name on top of detected plane using spheres & lines.
User can select a sphere and move it around the physical space via moving the device.
The app auto-saves each sphere new coordinate, specific to the location name. When the user or another user opens the app in the same space, they will see the previously morphed letterforms.
VIEW MODE: the letters are drawn little by little using neon colored lights.
** Github: https://github.com/hafiyyandi/ar_typo_sculpt **
Server
Server-side script (http://68.183.20.22:8080). Has 3 functionalities:
Serve the default drawing commands of LeagueGothic-Regular.otf (/api/glyphs)
Check if location name is already in database. If yes, send the record. (/api/coords)
Save the translations of each point modified in the AR app (/api/save)
Unity Scripts


# Start
Get the default drawing commands from server.
Get location (lat,lng) using Unity's Location service. Feed it into Google Maps Reverse Geocoding to get location's Name / Address.
Check if location already exists in database. If yes, parse & store each point-translations.
Once plane is detected, initialize letters (drawLetters(Vector3 v)).
# Initialize Letter
Get default drawing commands of each character in location's Name.
Only store the points (x,y of non-Z commands). Scale down the points, and translate the points by (a) detected plane's location, (b) index of character and line, (c) translation data from database
Initialize sphere prefab at each point of each character.
For each sphere, use the coordinate as points for white LineRenderer (lRend)
# EDIT/VIEW Mode
Toggle is controlled by an instantiated GUI button.
If in EDIT mode, render sphere and white line.
moveLine: called whenever a sphere is released from selection. It updates white LineRenderer's array points according to the new sphere location.
If in VIEW mode, render animated line (animLines):
Initialize: hide all spheres and white line, reset all animLines' lists.
Store spheres' positions as point-pairs: starting & destination.
Instantiate LineRenderer for each point-pair.
For each point-pair, get points in between using Lerp. Cycle through the points in between.

Raycast from point of touch
If the ray hit an object tagged "sphere", call the function GetHit of the hit sphere.

Once initialized, sphere stores:
detected plane's location
the index of the character
default coordinates from default drawing command
If sphere is hit by Raycast, lock sphere to a child of the Camera object so that sphere always follow the camera.
Once hit sphere is hit again, release the sphere.
Parse the new coordinate, get translations for x,y,x to be stored in database. Formula : translations = current position - plane's position - default coordinate
Upload translations to server (/api/save) along with location name & index of character within name string.
planeChecker.cs & planeCount.cs Basically just makes sure that the letters are only drawn on top of the first plane detected.
#MagicWindows #computationaltypography #Unity #ARKit #opentypejs