Showing posts with label Computers. Show all posts
Showing posts with label Computers. Show all posts

Saturday, March 07, 2009

Sun TechDay at VIT University


Sun Microsystems recently came to our college to conduct a TechDay (also called: "SunDay", which co-incidentally was held in our college on a sunday too!) on March 1st, 2009. The event comprised of four workshops - on J2ME, Solaris, and JavaFX. We had to conduct two parallel sessions of J2ME instead of one (so J2ME counts for 2) because the response was so great -- we got double the no. of registrations we had expected! The expected nos. for each session was 70 which works out to 210 in total for the three sessions, but we registered 162 for J2ME, 85 for Solaris and 124 for JavaFX = 371 registrations!

The engineers who conducted the sessions were excellent, the sessions were really informative, and we're already receiving requests for another TechDay from those folks who missed out on the registrations as well as those who attended (for sessions on advanced topics). We're planning another version of this somewhere at the start of the next semester.

The task of organizing the entire show fell upon the Sun Open Source Community that me and Aditya had kicked off in December last year, and the team of 9 core members and 23 associates that was selected did an exceptional job! Frankly I gave a pretty conservative estimate to the Sun folks when asked initially about the participation, keeping in mind the previous events, and other issues like 1st being a sunday and the SEDS India National Conference happening at the same time. But the members of the Sun Core and the Sun Associates did a fabulous job in getting so many registrations, ensuring that all the ground-operations on 1st went smoothly and basically that everyone had a good time. Kudos to them!

Cheers

Monday, February 23, 2009

Google v2

Been a long time since I wrote, and as comments to my last post prove that I have a fan following of critics now, waiting for new posts, here it is:

The previous month has been really hectic, as we're working very hard (and at great speed) to complete our project for the finals of Google Product Prodigy '09. BTW, I should first inform you that we guys got selected to the finals of the Google Product Prodigy contest (again, for me) from the entire Asia-Pacific region! People who've read my previous blog (at awardspace.com, which seems to be dead now) would recall the post I made describing the fantastic experience I had at GooglePlex Bangalore last year. We're pretty excited at being able to go through that again!

The other interesting project me and my friends are working on presently are an Adaptive Web Search engine, that adapts to a user's search-usage pattern over a period of time, so that after a while, the search engine starts delivering results tailored to the trends the person has set over weeks.

We're also about less than a month now to the launch of Flare (our Google project), which will be launched as a web service! It will initially be invite-only. :-)

Cheers!
Shashank

Monday, December 29, 2008

LSJ: The Blue Screen of Megadeath


Shudder. For those of you who have used Microsoft Windows XP, be afraid, be very afraid. Because the British Navy has just upgraded its nuclear (powered and deterrent) submarines to the state-of-the-art control technology -- Microsoft Windows XP. A stripped down version of it, if that be any consolation, which it is not.

Check out the Linux Journal article: Blue Screen of Megadeath

"We can't speak for anyone else, but the thought that somewhere floating out there are two hundred nuclear warheads under the control of Windows XP scares the living daylights out of us. If anyone needs us, we'll be building a bunker in the back yard before one of the boom-boom boats throws a blue screen of death and blows us all to kingdom come."

Boo!
~Shashank

Mounting ext2/ext3 partition in Windows

Having no Linux disc at hand in order to live-boot and see my "Back2Basics" root filesystem files in X Windows (I removed X Windows as well, remember?), I found this interesting tool for accessing the Linux ext2/ext3 partitions from inside Windows. It works with almost all versions of Windows, but doesn't do reiserfs, and others.

Check this post out: Post
Download the tool from here: Download

Cheers
Shashank

Saturday, December 27, 2008

Real-time color scheme generator

Here's a very interesting and ingenious tool I found on the Internet: A real-time color scheme generator that does a Yahoo Image search for the term you search and returns the most prominent colors in the images returned.

Here's what they say:
"We take 5 related images from Yahoo Image Search and then show the most prominent 6 colors from each image. Each column of colors is taken from a single image."

Check it out: link

Cheers
Shashank
PS: Why the hell is Google displaying Visual Ads now? It is just going the same way as the other old internet-advertising agencies went - ugly, intrusive and heavy picture ads, and some of them even Flash-based! So much for light, elegant and unobtrusive text ads.

Friday, December 26, 2008

Day two: Back2Basics Linux


Having vowed not to spend my 10-day winter vacation doing anything serious, I decided to play a bit with Linux, apart from reading the novel "She" by H. Rider Haggard (of Allan Quartermain fame) and revisiting the Beatles' album collection I got hold of just before setting off from college.

Anyhow, one of the first things I did when I got home was to strip off /everything/ from my ancient Ubuntu installation in the PC at my home, and essentially removed ALL the packages other than the important core and base and essential ones. This brought me down to the beautiful command line at the next reboot, and then I to do a little tweaking with the /etc/init.d/rc to display some messages and request for user login, instead of asking for root login (it was configured to spawn /sbin/sulogin, instead of login) and such. All this led to a cool "Back2Basics" Linux, which still takes around 800 MB because I haven't removed a LOT of unneccesary libraries incase I break something (I've done that once before). So I'll proceed to do the stripping work soon (hehe). I got hold of this O'Reilly book on Building Embedded Linux Systems sometime back and it lists this minimum required directory structure for the root (/) filesystem, and another book on Embedded Linux (whose publisher I cannot recall) which listed the bare essential binaries and the corresponding libraries required. So I'm planning to base the stripping-down on the guidelines in these books, and of course using the ldd command to find the dependencies of the desirable binaries incase I want something extra. I replaced the GNU utils with Busybox yesterday. My target is to just have the Kernel Image, Busybox, Perl, and Java. Lets see what comes of it. ;-)

Also, I'm working on a new categorized layout for this blog, something I'd developed two years back but never implemented. Its going to automatically pick the most popular categories and show posts filed under those in square boxes, and the more popular categories will be higher up in the boxed, 3-column layout.

Cheers
Shashank

Monday, December 22, 2008

Network scanner script

One of the more useless handiwork of a wasted 2 hour lab session:

A shell script for scanning the network with Class C IP Addresses from 192.168.0.1 to 192.168.255.255 and listing the active IP addresses. It writes it to a file called IP_list as well as echoes it.

ip_scan.sh:
-------------------------------------------------------------------
#!/bin/bash

# A Useless network scanner
# by Shashank Shekhar
# - Scans the Class C network from 192.168.0.1 to 192.168.255.255
# - Note: Ping doesn't always return the true state of a network node
##

for ((i = 1; i < 256; i++))
do
for ((j = 0; j < 256; j++))
do
ping -c 1 -w 1 192.168.$j.$i > opFile
cnt=$(grep -c -i " 0% packet loss" opFile)
if test $cnt -eq 1
then
echo "192.168.$j.$i is there" >> IP_list
echo "192.168.$j.$i is there"
fi
done
done
Cheers
~Shashank
PS: I was so bored.

Edit: Evil text-garbling spirits, Stay Away!

Saturday, October 18, 2008

Hello World! iPodLinux - Java style!


October's been a good month for me, and better for my iPod. iPodLinux.org is back online and they've released a couple of pretty neat tools, and updated builds. Loader 2 (the new bootloader) is great - no more messing around with complicated wheel/key combinations to select the boot OS. Loader 2 gives you a GRUB-like list of installed OS images on the iPod disk, and can read kernel images from ext2 and ext3 partitions, as well as FAT32 (W95). So this effectively removes the need to re-create the firmware each time a kernel update takes place. All you need to do is use ipodpatcher (which originally was used for installing Rockbox) and install Loader 2, which will now get merged with the Apple Firmware.

The Podzilla interface has been improved too, and lots of annoying little problems have been ironed out mostly. The text-input is (or atleast, feels) WAY better now, and I can actually input something meaningful in a meaningful amount of time. Here is the text file I "typed" (with awkward scrolling and tapping) on my iPodLinux's PodWrite with a "Scroll with Prediction" text-input mode:

first.txt : "This isn't bad at all. The prediction algo is pretty good as far as this text input session is concerned. Took me 10 minutes to input this on the iPod, but I'll improve I guess."

Then I finally got my first Java program running on the iPod! After encountering wierd errors and battling nasty iPod text-input mechanisms for months, things have finally come to a closure. The latest build of podzilla, makes things easier, and thus enabled me to run Java programs using the K Virtual Machine (kvm) by Sun Microsystems. I got hold of the kvm binary from some place, but I don't think its available on the Sun website anymore, which is pretty odd. But this is how I got my "Hello world" in Java working on the iPod:

1. Install iPodLinux by using the latest Podzilla and loader.
2. Download kvm from here. Put the kvm binary into your iPod's /bin folder and make sure it has execute permission.
3. Write your java code, but keep it simple. KVM just supports basic I/O, data types, Vector, Stack and a couple of other simple things. No graphics, gui etc. For e.g.:

Test.java:
public class Test {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}


4. Then compile the code to the JDK 1.4 format:

#javac -source 1.4 -target 1.4 Test.java

5. Finally, create a script file in gedit or vim called, say, Test.sh:

Test.sh:
kvm Test


6. Save the script file in the same folder as the Test.class file, and give both Test.sh and Test.class execute permissions:

#chmod +x Test.sh
#chmod +x Test.class


7. Put all these files in some folder in the iPod's Linux partition. I put it in "/home/shashank/java" (on the iPod partition, not your own system! Also avoid spaces in your folder path.). Then boot into iPodLinux and open the folder where you placed the files using the File Browser, and scroll to "Test.sh", and keep the "Select" button of the iPod pressed until the context menu shows up. Then select "Execute" and select "Read output". Voila! You should get the two words: "Hello World!" on your screen!

No cross-compilation, no recompiling of gcc to work with ARM7 processors (most iPods run on ARM7 processors, thus C code compiled on your PC will not work on the iPod). Life is easier with this if you want to do simple programming. Maybe if someone wrote an extended Virtual Machine, with more libraries, then it would make this a pretty solid platform.

BTW, the above steps have been written assuming you have a Linux/UNIX machine. If you have Windows, a VMWare or xVM VirtualBox image of some Linux distro on your Windows machine would make life tonnes easier compared to trying to use Windows' limited functionality with everything in life in general.

Cheers
Shashank

Friday, October 10, 2008

How to boot from USB in xVM VirtualBox


I've looked around the internet a lot and mostly didn't find any working solution apart from trying to make an image/virtualDisk from a raw physical disk (USB). I was basically experimenting with writing simple bootloaders in assembly language, and wanted to rapidly test and make changes to the code without rebooting my system again and again to try booting. The obvious solution is to use a Virtualization tool like VMWare or xVM VirtualBox by Sun (the latter is free), but the trouble is that neither of them support booting from pen-drives and I have long forgotten the existence of floppy drives, and have thus no way of directly writing to a disk and virtual booting straight-away, without creating an new image of the disk each time I make changes to it. So I decided to write to my USB pen-drive directly and try booting from it. It works when I boot the entire computer with it, but VMWare and VirtualBox do not have the option of booting from a USB device.

So messing around xVM VirtualBox 2.0.2 36488 for Windows yesterday, I was pretty surprised to find my USB Pen-Drive listed under the field of Floppies! That is,

a) Create a new Virtual "Machine"
b) Click on the "Floppy" link in the main screen (right panel)
c) Enable "Mount Floppy Drive", and from the drop-down list in "Host Floppy Device", select your USB drive's Drive Letter (haven't tried it in Linux, I guess you'll have to select the correct device like /dev/sdxx)

That's it. Try starting the Virtual Machine now.

Its quite wierd, and I'm still wondering why my USB drive gets listed under floppy, but it works for me! Neither VMWare Workstation, nor xVM VirtualBox permit booting directly from the USB otherwise.

Cheers
Shashank

Saturday, October 04, 2008

DMOZ Local Directories and BatchDMake


Today morning I finally settled in to perform a long-pending weekend house-cleaning job, except that the cleaning work was electronic, i.e. my computer. It is a common scenario to find your files so badly scattered around the hard-disk, inspite of some organization scheme that we all implement. Years ago, I saw a nice scheme Roshan, a friend of mine, implemented. He created directories and sub-directories based on topics and categories, like "Science", "Computers", etc, and Science would contain "Physics", "Chemistry" ... while Computers would contain "Programming", "Internet" and so on. It was a complete hierarchial structure, and I've been using it on my systems too ever since I saw it there.

But, its hard to maintain my directory, as creating such a structure is a rather tough task. You could either create an entire directory structure before-hand, with empty folders waiting to be filled, or you could create new folders as and when you require, in the correct category of course. The latter option obviously seems more efficient, as you don't have an empty mammoth directory structure, but a dynamic and to-your-taste structure. But after several years of trying out both, I have found that the first approach is much better. When you are, say, saving a file from the Internet, you often don't have the patience to ponder over the hierarchial relationship between "Geese Hunting" and "Duck Hunting", and whether you should create a new directory for each, or just club them into one single directory called "Bird Hunting". This inherent impatience of people when using files, as understandable and natural it is, is THE reason why files are scattered and chaotic. Thus I have concluded that people need an existing order to follow, that is as extensive and accomodating as it can be, but also flexible in order to allow people to delete and modify and create new topics and directories.

With this long discourse on the philosophy of file management in mind, I sat about thinking! :-D

This is what I came up with: Why not use an existing MASSIVE topic-wise directory structure, which has been developed and nurtured for about a decade by tens of thousands of people across the world? That directory structure is the DMOZ Open Directory Project (http://www.dmoz.org) by the Mozilla Foundation (of Firefox fame). It forms the backbone of Google Directory and several other places on the internet, and is a collaborative and open effort at building efficient web directories. My interest, however, is not in the links to websites that is provides, but the topic-based organizational structure. And as luck has it, they offer a downloadable plain-text file containing the ENTIRE folder structure. Perfect. Its available at:
http://rdf.dmoz.org/rdf/categories.txt (57.4 MB)

Then I wrote a simple tool in Java called "BatchDMake", which will read a given text-file line-by-line and create the folders listed in it. Each folder path is listed in a separate line. For example, this is from the DMOZ dump:

Arts
Arts/Movies
Arts/Music
Computers
Computers/Artificial Intelligence
Computers/Games


The syntax for operating it is:

java BatchDMake [filename] [root folder]

The filename parameter is obvious, the root folder is the folder name relative to the current working directory in which it should create the folders listed in the text file. For e.g. using the downloaded DMOZ categories file:

java BatchDMake categories.txt dmozRoot

The source code for BatchDMake is available here, and the executable .class file is here.

I just created the ENTIRE folder structure of DMOZ on my hard-disk, it has about 770,000 directories & sub directories. A lot of them are useless ones, so I'll go about pruning the tree to come up with the most useful structure for normal users. Will post that one soon. In the meanwhile, you could try the DMOZ structure and use BatchDMake to create it on your system!

Cheers!
Shashank
PS: I even found the place I'm currently in!
root\Regional\Asia\India\Tamil_Nadu\Districts\Vellore
This is like exploring an uncharted world in your hard-disk! :-P

Tuesday, September 23, 2008

SFW & WTF ...

Note: The following post is organized into five sections: Boring, Bad, Interesting, Personal, TechNotes. Pick the kind of news that you dig into most!

Boring Stuff:

Although the official date of my appointment as the Campus Ambassador in VIT for Sun Microsystems is August 1st, I officially was handed the reins from September 1st, and real work started off on September 8th, the day I returned from the Sun Induction & Training programme, Noida. The task at hand, the first order of business, was the "Software Freedom Day" that each CA had to organize in their respective colleges and universities and spread awareness about Open Source and impart knowledge etc.

Organizing large scale events at short notice is a rather dangerous thing to do, especially when you have an elephantine "bureaucrazy" ready to thwart every move of yours.

Bad Stuff:

We had a pretty bad false start in our Software Freedom Week where the administration decided to, without fore-warning, re-allocate the venue of our "Inauguration & Intro to Open Source" event to some Embedded Systems class, and we had thus move event to another timing. This was indeed frustrating and embarassing, but we explained the deal to the assembled audience and informed them of the revised schedule.

Interesting Stuff:

We had a great installfest today, and the revised Open Source introductory session. The folks turned up and were real innocent about Linux & Open Source, and we had a nice time explaining to them the difference between Open Source and Freeware, and so on. I probably did get a little emotional about Open Source at one point when a guy asked me, "Why do we need Linux when we have Windows which fulfils all our requirements". Imagine that. Any person reading this who doesn't see this question as absurd, is pretty seriously naive!

We also showed people "Big Buck Bunny", a short animated movie made using Blender, and was a great hit among people. The movie is absolutely hillarious!

Personal Blabberings:

Anyhow, this was Day 2 of the "Software Freedom Week" here at VIT University, and battling new catastrophic problems everyday and nearly ruining events and then miraculously managing to pull off a great show is something that is now something really really very familiar and all-in-a-day's-job occurance for me and my friends. Can't say I really enjoy this kind nerve-wrecking event management anymore -- am quite a veteran now, after 2 years at it; but I have better and newer plans for getting Open Source a greater reach among students out here, instead of just organizing Plain-Jane events like today's. This is the Participation Age, not the age for delivering sessions and telling people how and what to do. More about this unconventional idea in my next blog post!

Tech Notes:

On the other hand, my messing-arounds with my iPod hacks (here) has been getting more productive. I recently got some nice programs of mine running on Rockbox, and have decided I like iPodLinux once again! :-) Nothing wrong with Rockbox as such, but I feel that with iPodLinux having the comfortable "Linux structure", it makes more sense porting the nicer features of Rockbox to Podzilla and maybe in the process bring some things back to Rockbox as well. The other major interesting iPod-related thing is the in-depth reading-up I've been doing about the "Apple Accessory Protocol" (AAP), the set of commands iPods use to communicate and allow the world to control the iPod remotely through the Data Connection Port. This makes the critical part of my iPodMouse project pretty easy! :-)

Cheers!
Shashank

Friday, August 29, 2008

Upgrade to a dial-up!


Well, here it is finally. Internet in my hostel room. And man, is it fast? I rejoiced when my download speed finally managed to reach 10 KBps at 2 in the morning, and average far worse during regular "earthly" hours. Yet, adaptation is the key to survival. After having paid a substantial amount for this wireless datacard (Reliance NetConnect), I am finally on the internet which is a highly liberating experience, regardless of the speed of connection. Hard to describe in words! :-)

I've been messing around a lot with Rockbox, another OS-type thing for an iPod, and was thrilled to see real video files being played on my ancient iPod Mini 2G (4 GB)'s tiny, monochrome screen. Who said that video was the domain of expensive iPod videos only?! Take an iPod nano or something with a color screen, install Rockbox and BANG! you have excellent videos being played, and with capabilities of extending the codec base. I've been trying to get hold of the various components required for compiling for ARM6-processors, which is rather hard to do without a proper source of unrestricted fast internet. Rockbox allows you to write your own "viewers", which are programs that can process specific types of files, like associating .mpeg files with the mpeg-Viewer, .txt files with the text_editor viewer etc. You can also write plugins to provide new applications. Once my development environment for ARM6 (and Rockbox specifically) gets set I can work on some of the interesting stuff I think can be put in. I would rather like some simple HTML viewers, and a Java virtual machine on it. KVM (released by Sun microsystems) does something of that sort, but hasn't been running all that well for me. Infact it has run at all.

Then I also got this idea of controlling my iPod through my PC, maybe write a simple mouse controller program in Rockbox, which can take inputs from the data-cable connecting it to the PC, and therefore permit me to move my real physical mouse of the PC to control the cursor on the iPod screen. This could later be expanded upon to eliminate the PC by writing mouse-drivers in Rockbox and then using a USB mouse and connecting it directly to the iPod via the iPod data-cable. That would make life tonnes easier for using advanced applications in iPodLinux/Rockbox.

Anyhow, more later. I am too busy sitting idle, waiting for "Google.com" to open. (*rolls* eyes).

Shashank

Saturday, August 16, 2008

I had hair...


Don't mistake me. I still have hair, albeit, 8 inches shorter. Farewell my dear long locks. At my prime, I had hair till my shoulder-blades. Now they barely are an inch long. Two and a half years without paying a visit to a barber; feels like I've lost an arm or something. But anyway, why am I boring you with my story of locks lost behind?

I've been studying. No really, I finally have been studying new stuff. Not academic stuff related to what's taught at University (who cares?!) but new interesting stuff. More specifically, I've been enjoying myself by playing around with Mandelbrot sets, Julia sets etc. With the result that I've started manufacturing a sequence of rather spectacular wallpapers by applying various color filters and mapping different parts of the above mentioned sets.

The other things include a compulsary mini-project as a part of our 5th semester curriculum, and we're working on simulation of artificial personality in software bots. You can poke, hit, pat, feed bones etc to an artificial dog and view its responses according to the selected personality, and it will vary over time depending on the past interactions. I'll post on some demos once we have a decent build ready. This time, as it is compulsary and there is a strict deadline, I will finally actually complete something rather than touching it and leaving it to bide time once the interesting parts are done.

Oh, and I finally got iPodLinux installed on my ancient iPod Mini 2G, and it is really great and Awful. Great because it is Linux running on an iPod, and all the cool demos and stuff that can be done with it. Awful because the input method is limited to a dumb touch-wheel, so to input text, I have to circle through a list of alphabets each time. Use it, and you'll know how painful that extra-sensitive touch-wheel is. Another reason it is awful is because it is difficult to program for it as I have to use ARM6-gcc for it. And there is no Java on it. And arm6-gcc is hard to install correctly on my openSUSE machine back at the hostel because I have no internet which effectively makes installing any package with millions and zillions of cross-linking dependencies a nightmare.

Finally, I'm planning to take an internet connection at my hostel room, which will make life "normal" for me again. I have been selected as the Campus Ambassador for Sun Microsystems, which means that I represent Sun in our University, and had to go through a rigorous process of interviews etc. Anyhow, I am supposed to promote Open Source and Sun stuff in our campus, which should be fun I guess. And I get a stipend for it too! :-)

Shashank
PS: The image at the start of the post is from a specific region of a Julia set.

Sunday, June 08, 2008

Back to the 'Drawing Canvas'


I've been checking out the new canvas tag that's scheduled to be a part of HTML 5, the next specification of the web markup language. And I'm pretty impressed. The Mozilla guys have been doing some neat work with the Canvas and have a nice documentation ready for Canvas 2D: here. If you're reading this in Opera, Safari or Firefox, you've already got Canvas supported and running in your browser! Internet Explorer, of course, doesn't have it. But the folks at Google have written a neat thing called Ex Canvas, which allows you to just include an extra javascript file and have your code running in Internet Explorer too! I think the Canvas tag has some potential of being really accepted and supported by all the browsers, which means that its good for developers like us who crave for atleast ONE technology supported properly across all the browsers, apart from the standard (or rather, now not-so-standard) 'b'; tags etc. :-) So I think developers can actually put their money on the Canvas tag and not worry too much about support and implementation across browsers. Face it: three out of the four 'major' browsers have Canvas already running. And there is a Google hack that lets you run it in the fourth (now) so-called 'major' browser.

The other (really) interesting thing I've been checking out is the next-step: Canvas 3D! The guys at Mozilla have been working out the basics of a simple 3D library and have so far adopted a wait-and-watch strategy i.e. have implemented a basic library (which is scheduled to be shipped with the Firefox 3 release) that exposes the API of the OpenGL ES specification and makes use of hardware acceleration where possible and are watching what kind of uses the developers put it to, in order to determine the next features to add. Now this is really interesting news, as OpenGL ES is something I've been looking into for the past few days, and find it a tad better for me than the standard OpenGL implementation, as it is lighter and more streamlined. OpenGL ES by the way is OpenGL for Embedded Systems, which means that all the extra bloated code and old deprecated methods and fat around the OpenGL standard has been stripped off, leaving a light API for systems with limited resources. The guys at Opera have been working on a different approach however. They too have implemented a Canvas-3D implementation, but they don't make use of OpenGL bindings, instead provide a higher-level of abstraction allowing platform neutrality, i.e. permit non-OpenGL programmers to be able to use it too. While this is a nice idea, trouble will arise if the two major browsers decide to implement their own versions of Canvas 3D. And where does Microsoft fit in? I think they'll be willing to Open Source all their Windows code before they will ever think about implementing OpenGL (arch rival to their proprietary Direct3D) in their browser. So they might either make D3D bindings, or adopt a 'high-level/neutral' approach similar to Opera. Which essentially means that Canvas3D, as such, is still volatile and is a high-risk platform to develop for. But it is the most promising of the upcoming technologies as it incorporates hardware acceleration which will make life tonnes easier.

For instance, I wrote a simple z-buffering system in Javascript for a non-canvas based experiment, and it simply is TOO slow as the DIV hacks, as I mentioned in a previous post, are just not feasible for even a thousand triangles. Z-buffering, however, can be made to run really well in the Canvas2D platform. The Useless Pickles 3D demo crawled to a halt (0.4 fps) when I fed it with objects with slightly over 200 triangles, which is peanuts. And that 3D library/demo is the best attempt I've found so far on the internet. Agreed that when I looked under its hood, it didn't make use of anything other than simple backface culling for optimization, but even if approaches like BSP Tree with front-to-back rendering or Octrees for optimizing Frustum Culling etc are applied, there is only so much that you can do. The potential for the sort of things that can be done with Canvas & Canvas3D is far greater and I think its better to push with new technology than be really clever with the old one and remain at the stage of just proof-of-concepts.

PS: The picture at the start of the article is the Apple Mac OS X Webkit's icon. The entire concept of Canvas started with them.

Edit: I have been trying out the Google Ex-Canvas that enables code written for the Canvas tag to run in Internet Explorer too, and all I can say is: It is SLOW! Just to warm up the testing, I made it draw 60,000 (i.e. canvas size = 300 x 200) single black pixels at each position in order to fill the canvas block entirely with black (yes I know it can be done with a single fillRect command, but I'm testing things here remember?), and Firefox 3 (rc2) did it within 400 milliseconds, while Internet Explorer 6 took almost 7-8 seconds, not to mention hung while doing it. Can't expect much out an emulation, can you?

Wednesday, June 04, 2008

Weekly round-up


Here's a round-up of the things that I've been working with a great deal over the past one week:
  • Google Sketchup
  • BSP Trees & 3D Rendering
  • Javascript
  • SDL & Projective Geometry
I might have something pretty interesting coming up within a few days, so if anybody who's into this stuff reads this, come back in a few days for an interesting Proof-of-Concept demonstration on this blog. It might be really dumb, but it does look pretty good to me.

Also, I was looking up into hacks of Nintendo Wiimote (thanks to my friend Roshan Shariff who got me interested into this - he's doing some pretty interesting Wiimote hacks too), and I think I'll get a Wiimote sometime soon when I save up enough for it. Till then, I'm looking into the sensors and libraries for interfacing it, and being a gamer myself AND a programmer, I can think of really nice things to use it for. :-)

Also, me and Roshan got into discussing how iD software's new game "Rage" implements the Megatexturing feature for rendering and texturing such HUGE landscapes etc, and found it to be an application of "Clipmaps", that are (as far as I understand, I'm still figuring it out), a way to use the Mipmaps concept (see below) and clip a cubical region from the Mipmap pyramid to get a series of landscape textures of decreasing quality (i.e greater zoom out).

So in effect, the "MEGA" Texture, often reaching into dimensions of 128000 x 128000 (which is really big), is used to construct the clipmap stack:
[Texture 1]
[Texture 2]
[Texture 3]
.
.
[Texture 'n']

In this, 'Texture 1' will be a say, 512 x 512 texture of the segment of texture (from the original 128000x128000 texture) that is right in front of the viewer. This one has no zoom effect, and is of therefore the best (original) quality. Then next texture, Texture 2 will also be 512 x 512 in size, but will be a "compressed/zoomed out" version of 1024 x 1024 segment of what is front of the viewer from the original texture, so this would be a 2x zoom out. Then Texture 3 would be another zoom out and so on.. and by Texture 6 (I think), the entire 128000x128000 texture will be compressed and represented by a 512 x 512 texture. Now, the renderer will just interpolate between the textures at the various levels the stack to render portions of the texture and show the required Level of Detail only. This also enables parts of textures to be streamed from an external disk when required, instead of loading the ENTIRE texture into the memory (which is dumb, not to mention almost impossible if your texture is 128k x 128k). I posted this here in order to make sure I understand properly myself, so there might be loopholes.

Useful resources:
Shashank
PS:
The picture at the start of the article is a screenshot of iD software's RAGE game, demonstrated at QuakeCon 2007 by John Carmack.

Friday, May 30, 2008

3D in Javascript? Kidding me?


Yeah.. well. That's definitely true for now, I mean that's definitely NOT easy to do with the current libraries and existing frameworks. With the "Canvas" project still chugging to completion and wide-spread implementation, we seriously don't have any proper 2D & 3D drawing libraries. Sure there are some really good libraries developed by some smart people, like the Ajax3D and the Triangles Method at UselessPickles but neither of those are true 3D engines capable of seriously importing and simulating objects with even, say, thousands of triangles at real-time, which is what even basic 3D games would require.

The most bugging thing is the lack of any sort of hardware acceleration available for drawing in the browser. Wait a minute! The Most Bugging Thing is the lack of ANY standard means of drawing at all in the browser! Well, as I see it, the graphic potential for rendering 3D objects using Javascript today lies somewhere close to the graphics prevalent in the year 1995, and is in a sense, actually worse. This is because not only is the triangles rendering capability sorely limited, the overheads involved in basic Input/Output is far higher, as it passes through several layers of application layer before it reaches the Javascript layer.

Well, I did write a basic 3D proof-of-concept type script that can simulate a rotating sphere with 300 odd triangles at pretty good speeds in my system. I'm still optimizing it. I find the task of writing this 3D engine in Javascript a lot more fun as compared to writing it in C++, because its like the old days when you had to squeeze out every little bit of speed from your code and run it in really restricted capability environments.

Sunday, May 25, 2008

TerraGen 2 : First looks

TerraGen 2 is really cool. They've released the "Technology Preview Edition", which is not a beta, but just a preview of the cool technologies that will form the next version of TerraGen, which was years in coming. But better late than never, this edition is really good, and incorporates Procedural generation of content into its grand scheme of things, and also has the Node Network that can be used to view the overall graph of the scene. Another interesting feature is the ability to do animations, so you can view the entire scene change over a period of time, instead of the static images its predecessor generated.

So much for the pros. The one thing I found troublesome is that it is really SLOW. But its a Preview Edition right, so can't say much.

Anyhow, here are my first drawings with Terragen 2 : Technology Preview Edition, and I think I'm getting better with each drawing! :-) The interface is completely new so I've gotta completely relearn how things are done.



Something chilly! :-)




Nevada? Chambal? Looks like some place that really needs those clouds to rain!




The Edge of the World! :-)

Enjoy.

Shashank
PS: TerraGen2 is available for free download from here.

Implementation of the 'Threshold Whole Square Method'

So here's the 'C' implementation of the 'Threshold Whole Square Method' I talked about (here). This one is only for 'long' data-type, but I've written a generic one that can deal with float types too, but I'll post that one later.

Code:

long lsqr(long n) {
if (n > 1)
{
long twoBase = 1, i;
for (i = 1; twoBase <= n; i++)
{
twoBase <<= 1;
}
twoBase >>= 1;
long k = (long)(n - twoBase);
long sqrN = (long)(twoBase << i - 2);
return (k == 0 ? sqrN : sqrN + lsqr(k) + ((k * twoBase) << 1));
}
else
return n;
}


Basically, the variable twoBase is the nearest threshold which is a power of 2, so that it can be used as 'n' in the formula mentioned in that other post. This is done as the whole square of this number can be calculated very cheaply by a simple left shift operation. After that, the difference between the given number and this threshold is calculated to determine 'k', i.e. the offset. Then a simple application of the formula gives the result. The advantage of this method is that the we need to effectively calculate the whole-square of just a very small number (the offset 'k'), instead of the conventional calculation of the entire number 'n'. This make this method marginally faster than the compiler's method, but this one can only be used for 'long' data types and should be used carefully.

Saturday, May 24, 2008

Squack3D


Alright, hence starts my first Technical project for the vacations. For those interested, my internship is now officially "Work-from-home" status, so I need not go to office everyday, but just pop in now and then for reviews. :-)

This project I'm embarking on is basically just a learning-experience type thing, don't really think it has much value as such. Anyhow, the project is called "Squack3D" (for lack of a better name), and is a very very stripped-down elementary 3D engine, that tries to offer the simplest 3D functionality for games that could be incredibly large to incredibly small. But the point is that the graphic needs of those games will have to be really basic, with no fancy effects etc. The second objective is to have the engine run at super-lightning speed, so that its really good at whatever limited functionality it gives. The third objective is to incorporate Procedural development techniques right into the basic fabric of the 3D engine which will reduce a lot of effort on the part of the game developers to develop stochastic algorithms etc for basic things.

Let me summarize the objectives:
  1. A highly stripped-down engine focusing on very basic graphics and primitives giving games and applications with low-fi graphic expectations a very small and suitable 3D engine
  2. Super-fast rendering and processing
  3. Inherent support for Procedural generation of content
  4. Ready-made templates for basic applications and games
  5. Free! In all the senses.
Shashank
PS: The scene in the picture is NOT from my engine however! :-) Its from a software called Terragen.
PPS: Your browser isn't rendering my blog incorrectly, I have indeed stripped all styling and graphics from my blog for simplicity and elegance with this new design. :-)