Wednesday, April 11, 2007

3D world in browser... just like that

You can get the pdf version with images here

The world is xmlizing... I say. Every data type on the web got to be in XML. That is good, that means open data, human readable data, more accessible for society in all fields, wherever XML is used. XML is ubiquitous these days.
3D in internet has a long and interesting story, it has started with VRML technology. Plenty of companies were making their own plug-ins, selling, showing their enormous functions, but there was no standard. It was hard to think of it, while the OpenGL support was barely standing and HTML was exploding on the net. People started talking how buggy and not efficient that kind of solution is. So VRML stayed in a shadow. That was years ago, some people had this dream about 3D worlds in a browser, true 3D API with decent data for it. Years passed and a successor of VRML came into stage, X3D.
X3D is a ratified standard from Web3D Consortium, it grew up to become next child to fight its way with browsers. X3D is XML based, it includes old parts of VRML such as H-Animation, GeoVRML or Nurbs. It replaces VRML while providing compatibility which VRML existing content (VRML content can be read by X3D reading applications). It was developed so that it is extensible and shrinkable as well. It consists of profiles, which include components. Components are collections of specific features. For instance we have Geo component. The reason of such a construction here is that some companies wouldn’t like to support all of the features available with X3D, so they shrink X3D to their specific X3D data. They can also create new profiles and components. The solution is universal as you can see. There is another very popular XML data for 3D representation – the Collada file (DAE extension). They are very similar as it comes for construction. Both the Web3D and Khronos Group (actual owner of Collada - originally was made by Sony) are collaborating so that they can specify fields where each of them will find its piece of land, they also want to make some of their parts the same (animation etc.) so that the open source society will have more profits. So if both are XML can we...? yes, we can make translations between them. There are XSLT transformations available, free of charge of course. However, in big outline... Collada is considered as a interchange format for standalone DCC (Digital Content Creation) applications, while X3D is focused on web issues. If you want to have a broader view on X3D/Collada there’s a fresh whitepaper from Tony Parisi [1] on this subject. So we have X3D, why I find it so important for GIS Web 3D. Primarily, because it is a standard, a good stable standard, with really some time spent on developing its flexibility. Secondly it has a working group X3D Earth working group which vision is to create X3D representation of the world, I know that’s a big challenge, but they have some serious reinforcements as well (NASA). Anyway, there are also some other non-standard technologies that have something to say if it comes to GIS data. There is very nice cityGML which has some cities already implemented in it (www.cityGML.org), but it’s not yet a standard. At the moment it’s on its way of achieving that with Open Geospatial Consortium. However for web purposes X3D should take the lead. Heh, again cityGML is XML so yes, again XSLT to X3D is possible. More on that topic is covered in Kiwon Lee document[2] about literally speaking cityGML to X3D transformations and mobile GIS 3D. So we are here at the point where we have data type X3D which is supporting our GIS and what is more is web focused, but what about the viewer?
The Web3D Consortium provides us with some free X3D viewers. But all of them are required as new plug-ins for our browsers in case we want to view something, and that’s a bit of a problem. Because a good stable player is also very important if it comes to Internet society, in some way standardized player. I know that if someone really would like to use 3D in web he would download the player and play it. But as far as I know reality, people are not keen on installing new plug-ins, most of them don’t know how to do it (despite it is automated these days). That’s life. My point here is that the 3D that we have to offer should be playable just like that, when opening the web page. Like google maps, that’s why they are so popular. There is NASA WorldWind and Google Earth as well (the standalones), but the usability is what counts nowadays and what makes people speak about it. The practical usage of solution.
There is one plug-in however that is available among society, yes, exactly... Flash Player. Everyone has Flash Player. To be more concrete I will recall the chart from www.adobe.com (Fig.1)

Fig. 1 : The Adobe Flash Player statistics show that Flash content reaches more than 98% of users.

Yes I know that can be a bit exaggerated (those are Adobe statistics), but It’s hard to admit that the Flash Player is not ubiquitous.
So Flash, Flash, wasn’t that just for 2D vivid graphics? Yes it was, it is, and it’s evolving. But in the mean time we want to get started here with new Adobe Flex 2.0 technology which also uses Flash Player as a run-time environment. I gave you before an example what Flex ArcWeb Explorer is, and how ESRI was fascinated about it. Imagine now connecting 3D options to it. Well I believe it’s fully applicable. As I said before, we want to create very portable and practical solution. The point I’m making here is that in my opinion the X3D, Flex + Papervision3D bundle gives as a gate to develop really nice looking environments in a really fast way. There are many gaps still to be filled with some coding, but the outline is there, steady and ready. Ok so are we ready to show some graphics? what else do we need? ... Rationality! and again the practical attitude. I’m going to keep repeating that till the end of my days. The public destination of that solution and the availably for everyone is a really important issue. People are creating standards these days, not companies. So which part of our gate needs to be replaced?... what about X3D, do we have some data implemented in it? is it really in practical, wide usage? No it isn’t. My sentiment about X3D is similar to this expressed by French president Charles De Gaulle about Brazil: It has a great future … and always will. We need something practical, what is already in wide use, and its growing in the hand of the users, and moreover we need it now. X3D is supported by NASA and it maybe going to be a standard but nowadays we need to pick up something reasonably, that will strongly support us with existing data. The best way to see what I mean is to compare NASA World Wind and Google Earth. Google Earth is starting to be created by users for users, and that is what I call a standard. So what I advise to myself, is to use the kind of data that is using Google Earth to represent environment. So here we are now with KML (it seems that we are going through all the alphabet +ML extension). You see, the easiness with I am switching the data types is also because of the fact that all of them are XML based and its possible to make translations between them, we are not risking much. So again,my target is the type of that data that will be most suitable for wide audience providing ease of use and data creation perspectives. So what about this KML you ask?

KML stands for KeyHole Markup Language. The word Keyhole is an earlier name for the software that became Google Earth. The software was produced in turn by Keyhole, Inc, which was acquired by Google in 2004. The term "Keyhole" actually honors the KH reconnaissance satellites, the original eye-in-the-sky military reconnaissance system now some 30 years old. At the moment it is a standard of representing data for Google Earth apps. It is constructed with really simple structure. Let’s say we want to mark a point on Google maps. The KML file would be as follows :

example in pdf version;

That gives us points, nothing special. But the KML can support us with polygons descriptions :

example in pdf version;

Fig. 2 : Different types of polygons in KML, opened and placed on a specific location in Google Earth.

What is more, we can use Google Earth to create that kind of polygons using real world raster map as a drawing layer. So that way we can acquire polygon boundaries created on real world blue prints with real world coordinates. That is kind of fun. I wouldn’t lie if I say that starting from now, with no experience in Google Earth, I can create in few hours an outline of a small city and export it to KML files, or create KMZ archive (collection of KML files). Just like that, that is what I call simplicity. Ok let’s go further. Starting from KML version 2.1 Google made a big step towards 3D worlds, we have a support for intermediate 3D modeling file format, guess… yes, our gaming friend Collada (thought about X3D, huh?).

So… plenty of new possibilities now open. Game creators can move their actual work to Google Earth engine. Anyone can model buildings in his favorite application save it to Collada file and place it in the Earth on a specific coordinates. I don’t have to tell what kind of options it gives. Can you imagine games in real 3D environment or millions of people creating 3D models of their homes? Well, it’s going to happen faster than we think, I think. In the mean time… where were we with our lounge of chosen technologies?

Fig. 3 : The KML file with a Collada .dae model attached to it, opened in Google Earth.

Our gate for creating 3D worlds, based on true Geographical data, open for everyone in a common browser is : Flex with PaperVision3d + KML file format which includes Collada files. In my opinion that could be a really interesting solution solver for Web based GIS 3D. It is really easy to develop, and if you take a deeper insight on options which each of these technologies give, you will see that you can create some really fresh outlook of content in a web browser… just like that.

By Marcin Czech


References :
[1] ”Developing Web Applications with COLLADA and X3D” by Dr. RĂ©mi Arnaud and Tony Parsi
[2] “Prototype Implementations for Multi-typed 3D Urban Features
Visualization on Mobile 3D and Web 3D Environments “ by Lee Kiwon

Thursday, March 22, 2007

GIS 3D, data support

GIS systems are based on the vast amount of data. And we are talking here about maintaining enormous databases which eventually have to be updated as well. However, still there is a lot of static-data, based on offline sources - CD’s for instance. We have to bear in mind that when it comes to decisions or visualizations made in GIS, we got to keep that data as fresh as possible in order to make GIS and our work valuable. And I’m not talking here about putting it into fridge, but about feeding it with newly comers, as soon as they pop up. The very nice option appeared some years ago, Web Services, which seems to fix the problem. All we need is internet connection and bought/free access to such resources. After that we will be getting most updated data that is available and be always up-to –date. In these days reality likes to change on daily rate, heh even hours or minutes matter. Short cut, as for today, future data support for apps lays exactly in there. That kind of solution would be more than fine for us, as we want our project to posses distributed system as well (that would provide more solutions for future and after all it is server based system). However I think we would like to update it with some more detailed local data as well, monuments made in 3D Studio Max for example, so no worries... I’ll try to cover that as well. What about availability of such a WS you ask? Well yeah, there is not much, but enough to start I would say. Web Services are still in early phases when it comes to GIS. They can provide answers for simple queries like latitude and longitude for given address, but when it comes to more sophisticated data - problems appear. ESRI has Web Services on public/student license available for one year period, with limitations of course. All you need to do is, go to company web page and register then subscribe for Web Services license. I’m not sure exactly what sort of data these services provide at the moment but I’m sure we can make something out of it to show that it works. Ok I’m talking here about data and stuff but did I mention that it is 2D raster, vector or text based data? Nop?
Data - a very important and vital component for our project. It’s nature has to be a bit different than the nature of existing data sources. As we remember we wanted it to describe 3D objects. Hmm.. so not having found existing, satisfying internet solutions I gathered some pointers which I think we should consider. Primarily the basic – the data has to have ability for describing 3D objects as well as 2D. Secondly it has to be simple, so that we could for example parse it by ourselves to write/read some of its properties (even at runtime). It has to be lightweight as it will be struggling through internet from server-side or Web Services if we would use them. There are actually very simple solutions that we could use – first that immediately popped up out of my mind is XML of course. Then there is Collada 3D file based again on XML language – lightweight and supported by almost all of 3D modelling apps. So I think, with storing the data we would have no problem, at least in that early phase.
So the real question here is where we are going to get data from? The most preferable would be using Web Services – but I haven’t found ones that would give us answers, for example like - building boundaries – that we could use to build a polygon. ESRI WS provides you with types of data like text based or Map Image raster generated on server, which is not suitable for us (but we could use it for more fancy things -> making a true texture for sky polygon = true weather). So next step I think, the best one is to look for existing data sources – no matter if it is online or offline resource (as long as we make our solution universal, and ready when that kind of data will be available through the net). Find the ones that are based on XML files (or are easy to convert) and would provide us with true, geographic polygon like data. Here is an example to show you what I mean. Bear in mind that this kind of data simplicity is desired, especially in these days (internet connection speed, 3D browser engine limitations). For instance:
{area id=”1234”}
{building id=”museum” video=”http://museum.com//Welcome.avi” }
{FirstCorner} x=120,y=123,z=0{/FirstCorner}
...
{/building}
...
{/area}

If we could find that kind of data, we are ready to go, to create some visual basics. Yeah, and what if that kind of data doesn’t exist? I’m going to answer that in a non scientific way - I’m always optimistic and my intuition again tells me that there is something that we can make use of, it just seems so logical that it exists.

By Marcin Czech

Thursday, March 15, 2007

FLEX and 3D is it possible?

While I was digging the web trying to answer that question I must say I already had an assumption about it. Well these suspicions were mainly because Adobe Flex is based on Action Script 3.0 and Adobe Flash which is... let’s say the technology which had a big influence on the new child of Adobe, is mostly AS ver. 2.0. And as I have already seen some 3D solutions in Flash AS2, so it was very possible that it is the same with Flex, however it had to be checked.
So by simply typing “Flex 3D” in google I started looking for existing solutions. Well it turned out that there are not many, to be honest just a few. One of the best and very interesting Flex Apps is located here :
http://flexarena.blogspot.com/2006/10/3d-wireframe-renderer-for-flex.html
by Anjali Bhardwaj.
It consists of a wireframe renderer which loads 3Dmax ASE format and XML mesh models from the server side, however it is very primitive and simple, without textures and so on.. but that’s not the point here. By simply watching this example we are in some sort of way assured that it is possible to render and load objects which is really important from our point of view... in which, in the future we would like to use that kind of solution as a basis for our GIS 3D object oriented system. After digging some more, I have to say that it is really little done in 3D and Flex at the moment, and there are several reasons why.
First of all – why do something that is already done. Well as I said before Flash and Flex have more similarities than differences. Main difference is that the source file for Flash is a binary FLA which is compiled among with AS classes in Flash IDE to swf file which is later hosted on a server. Flex can deploy MXML(XML based) files and AS classes on the server which is generating swf files at runtime, that’s cool. Not having source in binary format is also important because it gives Flex ability to do for example ver. control on files. Well there are much more differences in server-client communication structure but my point here is that we should look for some really good 3D solutions for Flash and find out if they are able to take a leap to Flex environment.
Ok. Finding 3D solutions was quite easy. There are already some commercial products and also some open source approaches. Well 3D in Flash requires a bit more explanation because Adobe doesn’t support native 3D – no OpenGL or DirectX. There are some gossips saying that they are working really hard on it. Well these gossips could not be certified until I could get in touch with Adobe team, heh and I don’t think they would share their plans with me. So let’s pause on this thread for a second.
In the meantime let’s look at some non-native 3D solutiuons - software only. First is so called pre-rendered sprite approach. You create object with software such as Maya, Blender, Max or other.. then you render it from several angles and place it in Flash. It’s completely fake 3D. You can create really marvellous and vivid sites with that, because the only limit you get is the one with your software. However interaction is really limited so this is no good for our GIS purposes. Another approach is a real 3D engine, there are several at the moment and they differ on the ways of rendering. After taking a closer look at these beauties – documentation, license, source, examples, features and so on. I specified two possible candidates with are fully open source so that we can mess with the code. The names are Papervision3D (http://www.papervision3d.org) and Sandy3D (http://www.flashsandy.org). PV3D has a great advantage of being already implemented in AS3 what makes him much faster than Sandy. Ok now let’s invoke the thread that we paused before.
In this point a question arises... If the gossips about Adobe and its native 3D are true, is that a proper way that we’re going to follow with open source engines? Huh, well that’s a really good question because in that case most of the existing 3D engines will have to revise again their main goals, because if Adobe would release 3D engine it would probably wipe out all the existing ones. But, we are not sure at the moment what adobe plans right now... and in the other hand I truly doubt that hardware supporting engine for Flash would be such a good move for Adobe, in some way they would lost their platform independence. So, fake 3D engines can live. Especially bearing in mind that their performance is based on CPU speed, which is increasing these days month by month. At the moment PV3D engine based on AS3 is able to view 20.000 polygons per second which gives us 1000 in 20FPS. That is a really nice result and I think it should be enough for our GIS 3D project.
Ok, so now the answer... so Yes it is possible to render 3D environment in Flex. However there are some limitations which we should always keep in mind. Our goal here is to create simplicity, just like google maps or ArcWeb Explorer are using vector representation our priority is also to keep it as simple as possible while supporting many ways of evolution for future purposes.

Thursday, March 8, 2007

Project GIS and FLEX 3D started

Aloha!
I started working on my research about GIS (geographical information systems) few weeks ago. As I explored the subject deeper, I found that its evolving really fast and the possibilities that it gives... well they can have tremendous influence on our society in next years, to be honest I truly believe that the future lays there.. hehe I can imagine governors playing SimCity like game on GIS software, they virtually place a home -> application sends job specification to construction group and they start their work... ok futurismooo but possible.... so after reading some articles especially about ESRI using they latest tool ArcWeb Explorer :
http://mxdj.sys-con.com/read/295386.htm
http://www.spatiallyadjusted.com/2006/06/29/esri-is-a-adobe-flex-2-success-story/
and because I'm quite familiar with the Adobe Flex 2 technology abilities.. I thought, why not to go further and develop three dimensions interface in Flex 2.. Imagine going through the cities and looking from first person perspective view. That would be cool. Well to be honest if we could develop 3D abilities in Flex, that kind of solution would affect not only GIS but also navigation on Web applications and online gaming as well. Its worth seeing what can be done in that direction.. So lets start.. this week I'm gonna dig the web in search of existing solutions for 3D in Flex.

Any comments, pointers and suggestions would be most appreciated.
Saludos!

Marcin
http://sauax.boo.pl