Tuesday, November 18, 2008

Picking - Harder Than It Seems

Picking isn't as easy as I thought it'd be. After further discussion and thinking about it, I've realize how big a project this. There is actually a lot more to it than just simple coordinate retrieving and coordinate conversions.

Now that I've done more reading and researching into this, there is a lot more work to do before I can complete this project. For example, from reading, I found out about the mathematics involved and the stages involved in 3D programming. The picture below shows the stages a 3D object needs to go through before it can appear as 2D object on our screen.


(Source from www.glprogramming.com)


With the vertices of a 3D object, it needs to go through the following transformation in order:
1) Viewing Transformation
2 & 3) Projection and Viewport (Any order)
4) Modeling Transformation

From understanding this, I would most likely need to go back to my 0.2 and fix some of the work. Because now that I understand these stages, I realize that what I have done, was just turned the windows coordinate of the mouse, and converted to perspective view (projection) but not 3D (modeling).

Now that I've understand theoretically what needs to be done, I need to go back, fix my mistakes, and put the rest to work.

Monday, November 17, 2008

Canvas 3D Picking 0.2 Release

So far, everything has been going smooth. The beginning was a bit slow due to understanding what's been done already and how the structure of the code works, but it's worth the time to spend on. Things that's been completed so far:
- Managed to catch the mouse click event when it's on the canvas
- Able to convert the mouse coord to be relative to the canvas (mouse coord is relative to the window browser, therefore it needs to be recalculated to be relative to the canvas)
- Converted the mouse coord to two 3D points in the canvas (near clipping plane and far clipping plane)
- Added function to Model class to return it's vertices
- Added function to return the bounding box's vertices (might need some more work)

The project details and updates can be found here

Now to continue pressing on hard and get that 0.3 done~!

Thursday, November 13, 2008

Project Changed: Canvas 3D - Picking

It's a little late in the term, but I've decided to change project. After discussing with Dave about how my previous project wasn't going anywhere, I've decided to make a switch.

I was looking through the remaining list of potential projects and unfortunately, none was appealing to me anymore. So I decided to talk with Cathy and see if there's any projects she has for Canvas 3D. Luckily, there's a project for Picking.

One thing I liked right away for this project is that I'm actually going to be doing lots of coding =) That was something I found lacking in my previous project.

To put the project description simply, what it does is that when you click in Canvas 3D, you will select the object that is in the most front in the current camera angle you are looking at.
So the details of this Picking project is this:
- Convert the mouse coord in Windows to Canvas coord
- In the current scene, find all objects that intersect where the mouse is clicked
- Find the object closest to the camera from the list of intersecting objects

So for my 0.2 Release, I will aim for the following:
- Make functions that will help complete the project
- Model.getVertices() which returns a reference of all the vertices in the object
- mouse coord convert: converting the mouse coord in Canvas coord
- other functions that might come up

And for 0.3 Release:
- Have the project working or at least close to working (with few minor bugs)

Wiki Page: Canvas 3D JS Library

Thursday, November 6, 2008

The 0.2 Release Hurdle

Just when I thought the work on 0.2 has been going smoothly, I've run into a bump now. So here's what's been going on with the 0.2 release.

- been following up on the suggestions posted on bugzilla
- tried using Process Explorer to track process spawned during mozilla build
- research other apps that can log (Process Explorer can't log)
- found Process Monitor
- logged process spawned during mozilla build
- updated bugzilla


At first, when I was trying out Process Explorer, it doesn't seem to do what I needed, but after a bit more tweaking, I finally got it to show the process name, pid, ppid, time, and duration. However, I couldn't find the most important function, which was logging. I mean, that was the main thing I was trying to get - a log of the processes and their info.

So then, I dug around the Internet, and stumbled upon a similar app called Process Monitor. The tool is great, it's the perfect thing I needed. It shows all the things I needed, and I can even filter out what I want to see. The best thing is, I could export the log out in different formats like CSV and XML. But then, the program always crashes whenever I track down the processes during firefox build. Of course, the first problem that came to mind was that maybe it's incompatible with Vista, which usually is the case I find. After doing some reading, found out that it wasn't the case, Process Monitor was are built to support the later platforms. Then suddenly, EUREKA~! I notice that it's trying to show Registry Activity, File System Activity, Network Activity, and Process And Thread Activity. So I thought, it must be lagging so much from all these info it's trying to show that it's crashing. I turned all the others and showed only Process and Thread Activity, tried recapturing during the build, and SUCCESS.

I've posted a brief description of this log on bugzilla (since the CSV log is about 112 MB), and have gotten reply from Benjamin asking for possibly more information in the log, or more accurate data.

So now, I've going back to try and find those data. Hopefully I won't need to find another app to do this.

Tuesday, November 4, 2008

0.2 Further Updates

After looking into Process Explorer even more, I found out that it pretty much does what I needed, it shows the process name, it shows the start time, it has the duration of the process, and it gives the PID. What it's missing and the most important part is that I need is logging. If only it can log and keep a history, then it'd be the perfect tool.

Maybe I can somehow capture the "kill process" event and log it manually. This will require some more investigation on my part. Maybe I'll find another app that will do the "magic" as I do more research.

Dive into Mozilla Modifying Firefox using Extension Lab

Since I don't work with extension much myself, I've taken the easy way and followed the instructions. At first glance at the instructions, I thought to myself, "Oh man...this is gonna be one long lab".

After finished reading the entire lab, I was still a little confused, so I talked w/ Scott and he help clear things up for me. And now, the lab is clear as day.

I simply had to create 4 files and the right directory structure, copy and pasted the code, and voila, the lab is done =)

Lab 8
|-install.rdf
|-chrome.manifest
|_chrome
|_content
|-addtabbeside.js
|-overlay.xul


Extension file can be found here

0.2 Update

After being able to identify where (which directories) time was spent during the build, now I am suggested to try figuring out what programs get executed during build and how much time they take up. An extra to that, I will try to log the pid, ppid, start time, end time, and process name during the build.

I've taken a look at Process Explorer and it doesn't seem to do what I need. So now I've been researching on what can get this job done.