[whatwg] Web Applications and 3D

Ian Hickson wrote:
> On Thu, 28 Apr 2005, Matthew Raymond wrote:
>>I've been pondering how someone would have 3D graphics inside a Web 
>>application using current web standards and some in development (XBL2, 
>>HTML5, et cetera), and while I have a general idea, I'm not exactly sure 
>>how it would work.
> 
> The current idea is to do the same for '3d' as for '2d', probably using an 
> OpenGL ES API subset, tweaked to be appropriate for use from JavaScript.
> 
> Unfortunately I know very little about 3D graphics myself so someone else 
> is going to have to actually define the API.

    I've done some work with OpenGL. I'd be happy to write a first draft.

>>...what happens when you want objects for your 3D world to exist in the 
>>DOM? What happens when you want 3D effects that change when you use a 
>>different stylesheet?
> 
> What's the use case? The use cases that people have raised for 3D so far 
> are primarily games (as in Quake-like things). In those, you don't really 
> need to have a DOM representation, and stylesheets are unlikely to be used 
> for styling them.

    The problem with a <canvas> solution is that the entirety of the 3D 
data has to exist within the <canvas> element. If you want multiple 
elements in the markup to map to a single 3D window, then <canvas> 
doesn't really work. (Well, you could have them as "display: none" with 
XBL bindings that map to Javascript code which adds the object to a 
canvas, but at that point, you're implementing something like X3D using 
XBL + Javascript + <canvas>, which really doesn't make sense.)

> Having said that, there are probably use cases for declarative 3D, just 
> like there are with declarative 2D. And for those you would use a 
> dedicated markup language, just like you use SVG for 2D graphics.

    My point was that I'd like to see a CDF (not the CAD kind, but the 
W3C kind) that uses XHTML + X3D, or XHTML + CSS+ XBL2 + X3D. While I 
think it has a lot of potential, I don't know enough about how the 
respective standards to determine would work together. (This is partly 
because of my lack of knowledge of XBL2 and X3D...)

>>1) A Web standards version of Microsoft's "Flipin' CD Button" example.
> 
> The markup for that is easy:
> 
>    <input type="button">
> 
> ...or some such. Making it actually look like something 3D would involve 
> CSS, XBL, and either X3D or <canvas> (or some other 3D solution).

    I already knew the HTML. I was kinda hoping to see the CSS/XBL2 part 
of that equation. That's the part I'm confused about. Does XBL2 have a 
CSS binding property like XBL 1.0?

>>2) An example of something similar to Quake done entirely as a web
>>application, with a HUD.
> 
> That's pure <canvas>, with a 3D context for the 3D, and a 2D context for 
> the HUD.

    Well, that depends on whether you're using <canvas> or X3D. 
Personally, I'd like to see how X3D would be used in a compound 
document. I'm thinking that you could use X3D in combination with XBL to 
implement LOD and similar features so that 3D models can degrade 
gracefully into simpler models with fewer features if hardware doesn't 
support all the features and polygons.

>>3) An example of a simple 2D GUI with 3D effects as a web application.
> 
> Not sure what you mean there.

    I mean stuff like having windows that get smaller when they're 
further back in the Z-order. Perhaps there's a fog effect. You could 
have various <section> elements rendered within a 3D environment, where 
the user looks in a specific direction or in a specific place to see the 
  <section> inside a 3D environment. Stuff like that.

Received on Thursday, 28 April 2005 18:44:21 UTC