HIGH LEVEL 3D OBJECT SELECTION FOR THE UNICON LANGUAGE Jafar Al-Gharaibeh and Clinton Jeffery Iyad Abu Doush University of Idaho Yarmouk University Computer Science Department Moscow, Idaho 83843, USA Computer Science Department Irbid, Jordan jafara@vandals.uidaho.edu jeffery@cs.uidaho.edu Iyad.doush@yu.edu.jo ABSTRACT Most computer graphics applications depend heavily on user input. Within many games and virtual environments, for example, user input is essential to create and/or direct actions within a virtual world. Much of this input comes through direct interaction with the virtual world’s content, usually using a mouse. Most programming languages' graphics libraries provide low level APIs for 3D object selection, which makes the process of building interactive 3D graphics applications a challenge for programmers, especially beginners. This paper describes a high level 3D object selection model which greatly simplifies that process. The model is realized within a very high level programming language called Unicon. In this work, Unicon's high level API for 3D graphics programming is extended to support 3D object selection with very minimal addition to the language level so most of the implementation details are hidden from the programmer. The model adds a layer of abstraction to 3D object selection making it similar to common GUI environments, where the programmer doesn’t have to worry about how to make object selection work. The programmer writes event handlers and assigns them to 3D objects in the scene; the language automatically calls these handlers when an interaction happens with these objects. Keywords: 3D Object Selection, Picking, 3D Interface, Language Design, Unicon. 1. INTRODUCTION Most 3D applications such as collaborative virtual environments and games are interactive in nature. The user clicks on the 3D scene and picks objects. 3D selection plays a main role in some applications so that it is impossible to build such applications, without 3D selection support. Despite its importance, writing 3D selection code is not always easy. In OpenGL for example, it involves a lot of function calls and low level programming. The Unicon language has a powerful set of built-in 3D facilities that help programmers rapidly develop 3D applications [1], but it did not initially support 3D object selection. The relatively complicated and low-level object selection mechanisms used in OpenGL were inappropriate for a very high level language. Building the 3D selection mechanism into the VM runtime system makes it possible to hide all of the low level semantics from programs written in Unicon programming language. This paper describes the design, implementation and use of high level 3D selection facilities that were introduced to the Unicon language. Different programming languages and graphics libraries have various mechanisms to implement 3D object selection. These include, but are not limited to: Color-coding Ray tracing Special rendering modes. Color-coding involves rendering each primitive in a unique color in an off-screen window buffer so that the user does not notice this process, and then reading the pixel under the current cursor location. The color value of the pixel determines the primitive that the user selected. This technique provides good performance, especially with a small number of selectable objects. The drawbacks of this technique are: There is no depth information with the selected object. Only the closest objects to the cursor (camera) can be selected. Objects that hide under other objects cannot be selected. The system cannot support more selectable objects than there are unique colors. This limitation has grown less onerous over time since most systems support millions of colors. The unique color must be the same when it was rendered and when it was read back; lighting, dithering or any other setting that might affect how the system interprets the color could affect selection. Ray tracing selection works by generating a pick ray from the mouse location to the far z-plane and testing if this ray intersects with objects in the scene. Special rendering modes like the OpenGL selection mode work by making a separate rendering pass over the scene and restricting the viewing volume to a small area around the cursor. Objects that happen to fall within this viewing volume are considered to be selected. 2. RELATED WORK Most of the programming languages that have 3D graphics APIs support mouse interactions and 3D object selection. Some of these languages provide very low level APIs that directly reflect functionalities in the underlying graphics libraries. A popular