Hard Light Productions Forums

Site Management => Site Support / Feedback => Topic started by: Bobboau on April 08, 2011, 04:51:11 pm

Title: WebGL POF preview
Post by: Bobboau on April 08, 2011, 04:51:11 pm
With WebGL becoming available to a lot of people I was wanting to make some sort of project for it, and I think this might be it.

If I were to make server side PHP scripts that loaded a POF on the server (let us assume that they are just laying around in a folder somewhere) and returned a WebGL friendly version of the LOD0 geometry, and a client side set of scripts that would setup a WebGL canvas, download the previously mentioned geometry, and then draw it in an interactive manner, would the administration of Hard Light Productions be interested in integrating it into their site? I think this could be most useful in the wiki and there might be a way to get it to work such that <long term goal> if someone attaches or links to a properly formatted zip file containing a model and (optionally) textures then rather than just showing a link to the zip file it would show a preview window containing the model that a user could rotate/zoom/ect with all the appropriate effects (assuming they can be done in WebGL), it would probably need to be some new sort of forum tag (like lvlshot).

I will not promise that I will get this done, but if I do would HLP be interested in using it?
Are there any restrictions/requirements that HLP would have for this to be used, assuming it gets done?
Title: Re: WebGL POF preview
Post by: Black Wolf on April 08, 2011, 04:56:49 pm
This would be awesome for the wiki. :yes:
Title: Re: WebGL POF preview
Post by: The E on April 08, 2011, 05:18:26 pm
It would also require quite a bit of storage.
Title: Re: WebGL POF preview
Post by: Bobboau on April 08, 2011, 06:03:11 pm
For the wiki, a compressed and optimized version of wanted pofs' geometry could be stored, I think this would have a reasonable storage footprint, the down side is as the viewer was upgraded and new vertex formats were needed every model would have to be re-uploaded, but that is more or less a finite hassle.

As for the forum embedded viewer it would have a storage/performance tradeoff, technically it would not require any more permanent storage than is used currently. the server side script could download the pof/zip to a temporary folder then send off the geometry and then delete the temporary file, this would however be a bandwidth sink, however if it was done on the fly and it cached it's results (and the cache was cleaned periodically (and lets not forget browser caching) ) I think it would have an acceptable resource usage.

also keep in mind there are javascript implementations of many compression algorithms, this could help on both storage, processing, and transmission of geometry.
Title: Re: WebGL POF preview
Post by: Bobboau on April 08, 2011, 06:17:04 pm
HLP would not have a problem with me using jQuery, right?
Title: Re: WebGL POF preview
Post by: Luis Dias on April 08, 2011, 07:36:57 pm
How much of bandwith would a Sathanas with 100k polys and three 16Megapixel textures take on bandwith?
Title: Re: WebGL POF preview
Post by: Bobboau on April 08, 2011, 08:55:22 pm
ballpark guess, 2 megabytes uncompressed. textures should be obvious.
Title: Re: WebGL POF preview
Post by: Luis Dias on April 08, 2011, 09:00:35 pm
Yeah, I was looking more for a qualitative assessment, rather than quantitative. A jpeg file of a 16MPixel (which translates to 48MB of uncompressed data) will be at least 5MB each. 15MB + 2MB (more or less what I'd guess too), isn't that too much for a wiki page?
Title: Re: WebGL POF preview
Post by: Bobboau on April 08, 2011, 09:28:06 pm
it could use lower res textures, and it would only be loaded on demand.
Title: Re: WebGL POF preview
Post by: mjn.mixael on April 08, 2011, 11:47:04 pm
This seems like a really fantastic idea! Though, as a modeller and artist, I would be antsy about people being able to grab the POF before it's finished. (I'm envisioning a way to use it to give more in-depth model previews than screenshots occasionally.)
Title: Re: WebGL POF preview
Post by: Bobboau on April 09, 2011, 04:07:04 pm
it would be quite difficult (though not impossible) to reconstruct a POF from what the previewer would transmit. if someone wanted to do it they would be able to, but it would be quite an arduous task to convert JSON vertex buffers into some sort of standardized model format.
Title: Re: WebGL POF preview
Post by: Luis Dias on April 12, 2011, 02:08:14 pm
So how much trouble and work do you think this thing is?
Title: Re: WebGL POF preview
Post by: Bobboau on April 13, 2011, 01:37:01 am
well, I already have a client side script that draws an object loaded from a json source and lets you rotate/zoom it, and I am just getting to parsing the BSP tree to get the model geometry, so for basic functionality, another 18 hours of work.
Title: Re: WebGL POF preview
Post by: Bobboau on April 23, 2011, 08:48:40 pm
ok, after working on this for a while, it seems that PHP does not have good enough performance characteristics when dealing with binary data to be able to do this effectively, if I am going to continue I would have to wrap a c/c++ POF handling class that can make vertex and index buffers and wrap a PHP interface around it. I've never done that before, so I'm not sure if I would be able to.