YOUR FEEDBACK
IBM Buys Its Way Out of Antitrust Trouble
Plato wrote: L.L.Bean was never actually a customer of PSI. At most, they we...


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
MXDJ TOP LINKS YOU MUST CLICK ON !


Visual Debugging Tools for Shockwave

Digg This!

Recently, I have been working in Shockwave3D in Lingo and JavaScript syntax. Regardless of what I am writing, I keep running into issues that can be summed up by the following phrase: I don't know exactly what I'm doing. More precisely, I don't know exactly what I am doing when I am doing it. I'm figuring it out. And that's what programming interactive things is all about: finding a way to do what you need to do, such that the user has the experience you want them to have. Unfortunately it is sometimes difficult to tell exactly what your code is doing, and this is particularly true in 3D environments.

So with these issues in the back of my mind, I was working on my lightmap generation tool, and I was really getting stuck. A "lightmapper" is a tool that pre-generates, through raytracing or other means, a series of maps that represent the lighting in a 3D scene as textures on the individual objects. This is a very popular technique in game-level design, as Brian Robbins noted at MAX, and as several authors have noted in the game development community. Figure 1 shows a few sample renders from my tool in progress.

The problem I was having was in projecting the shadows, particularly in figuring out the angle to each light from the points along the surface. I was never really "sure" of exactly where the ray was that I was checking against. This is relatively easy to figure out for a single light, but I was getting very confused when calculating multiple light sources (see Figure 2). In order to figure out just what was going on, I used a strategy that I have used in the past: build a visual "prop," or "stand-in" of the ray itself. The only complication is that Shockwave3D has no #line primitive. No problem! Just make a very long, skinny triangle. Listing 1 shows a Lingo handler that creates a "connector" object: it has a triangle that it uses as a "line," which it can snap between a beginning and end point. Additionally, it can color each end of the "line" a different color, and blends the two together along the triangle face.

Using these lines, I was able to trace out each and every light path in the scene, and get a sense of whether or not it was doing what I wanted it to do (see Figure 3). This was very handy, but this tool isn't limited to that specific use. I've used it in the past to represent surface normals (something I wish S3D had a #debug flag for), direction vectors, a "point at" vector between two objects, and even rotational axes when I haven't been able to see the ones drawn through the #debug flag. (For some reason, the axes generated by Director are all black when drawn with the DirectX7_0 renderer on my nVidia cards). Because each end of the "line" can be colored separately, they can be used to represent directional vectors, rather than just a straight connection between two points.

In order to get the "lines" to show up well in a debug environment, I generally create a custom shader that ramps up the emissive and ambient qualities (and sets some flags so that the vertex colors actually have an effect). For the script in Listing 1, I used the shader props set in Listing 2. I've also used "lines" in a similar way in JavaScript syntax.

Being able to "see" what is actually going on has proved invaluable for this and several other projects. Using color and shape makes it much easier to tell what the code is doing than an iterative Orun and see' approach. By thinking of debugging visually, tools can be constructed that make it easier to see just what is going on. If you have either already built tools, or are thinking of writing some after seeing these simple examples, I encourage you to share them with the community as you are able, to build up a library of visual aids that help us in our daily work.

About Andrew M. Phelps
Andrew M. Phelps, a member of the Editorial Board of Web Developer's & Designer's Journal, is in the Information Technology Department at the Rochester Institute of Technology in Rochester, NY (http://andysgi.rit.edu/).

LATEST FLEX STORIES & POSTS
Adobe's Kevin Lynch and Microsoft's Scott Guthrie to Keynote AJAX World RIA Conference & Expo
Two of the biggest launches in Rich Internet Application history took place in 2007/2008 when Adobe launched AIR 1.0 in February '08 and Microsoft launched Silverlight (September '07). At the 6th International AJAXWorld RIA Conference & Expo in October SYS-CON Events is delighted to be
Google and Yahoo Can X-Ray Your SWF Now
Adobe announced a collaboration with search industry leaders to dramatically improve search results of dynamic Web content and rich Internet applications.
DreamFace Interactive Delivers Mashup Kit: DreamFace-Fx for Adobe Flex
Following the private Beta release last month, DreamFace Interactive announced the general availability of the DreamFace-Fx Mashup Kit for Adobe Flex. As promised, DreamFace-Fx is the first Mashup Kit to reach developers in a comprehensive roadmap which will extend the DreamFace Open S
Integration between Flex and AJAX made easy
Flex is a great way to introduce rich Internet applications in your enterprise. But in the real world, you often have to do it gradually. Majority of the business units of any enterprise who are sold on RIA would prefer adding Flex-based components to their old but working Web 1.0 app
AJAX and Enterprise RIA Tools - JSF, Flex, and JavaFX
2008 is going to be an important year for Rich Internet Applications. Most organizations are delivering or planning to deliver Rich Internet Applications; however, at the same time, most IT managers are facing a dilemma: which Rich Internet Application technology and platform to use? T
Adobe Releases Significantly Enhanced LiveCycle ES
Adobe has released a substantially enhanced BPM/RIA solution. While LiveCycle suite isn't new software, its popularity increased in June of 2007 when the entire suite started to run on the same J2EE server and the RIA components were introduced. Today, over 5,000 enterprises use LiveCy
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE