Webgl renderer possible?


Webgl renderer possible?
#1
Hi! I'm doing research about making a webgl renderer for ldraw-models. I'm curious if any of you guys have seen that before. Maybe it's a difficult task, with all dependencies and high polygon-count but is it worth a shoot? The webgl-engines like three.js is quite optimized these days. Or do I need geometry-shaders for all the details, like studs?

Einar
Reply
Re: Webgl renderer possible?
#2
I'm almost done writing one completely from scratch to be highly optimized for LDraw. The advantage of not using something like three.js is that we don't need any of the fancy (and slow) features in their shader, we don't even have textures! However, almost any decent sized model will easily have 10k polygons visible at once.

I originally started it as a proof-of-concept for real-time multi-user editing, and figured that the browser would be a good platform to start from because it could easily reach a large cross-platform audience, but I've temporarily held off on finishing implementing the editing capability to focus on optimizing rendering.

I plan to release a stripped-down version shortly that people can easily embed in their own webpages, with usage much like lightbox. This would progressively enhance the traditional galleries of normal renders of models to be interactive 3D using only HTML5, no plugins needed.

I still have not implemented conditional lines, and I would like to optimize lighting calculation a bit more before releasing a public beta version... but don't worry, it's coming.

In the mean time, if you really want something similar right now, take a look at this Java solution. It isn't WebGL, it doesn't use the canvas, but it's available right now.
Reply
Re: Webgl renderer possible?
#3
It really sounds interesting! I agree, a framework is always stealing power. I'm also investigating a multiplayer feature, maybe turned based or tiles side by side. I have looked into porting (at least structure and concept) from LegoCad (or is it Leocad...?) or/and Bricksmith. My programming skills is unfortunately not at the level of making low-level webGL applications. What concerns me most is optimization. I have to find a way to hide parts that is encapsulated and hidden by other bricks.

I have a really interesting project coming up if things go our way, so I really hope I can use the ldraw-format to build, view and share models instead of creating a structure of my own. Would be great to use existing parts and models as well.

Good luck with your engine! Hope it's out there in a near future.
Reply
Re: Webgl renderer possible?
#4
I haven't worked with webgl, but here are just some general OpenGL pointers you might find useful.

Don't worry about hiding bricks whom are blocked by others, let the OpenGL Z-Buffer handle that for you. This because OpenGL does the calculations anyway. Testing brick visibility yourself would probably be even slower as a result of the overhead.

Doing your own visibility tests is only useful when working with HUGE models, in such engines you could do pre-processing using frustum culling, in order to eliminate whole submodels (located behind the camera etc) before sending them to OpenGL.
Reply
Re: Webgl renderer possible?
#5
During this process I've realized that WebGL is basically a giant mess of abstraction layers and hiding underlaying interfaces (a certain level of this is necessary to ensure a minimum level of security... this is from a browser after all) but it makes it impossible to optimize anything at all like I would with OpenGL. Stay away from browsers if you want to do this right. God how I miss working in C.

I can definitely say that if you want to actually do a large-scale LDraw-based world, it MUST be written at a low level, and the shaders, etc. should be written specifically for LDraw (our needs are quite far removed from the needs of your average library intended for games). The only reason I'm still using WebGL is because I want to provide the community with a practical HTML5-and-related-technology based LDraw renderer. I believe that it would be a much better investment of my time to try to add concurrent multi-user editing capability (locks are fun!) to bricksmith (or preferably LDCad if it becomes open-source) than to try to do it in a browser (queue all the vomiting).

Multi-user simultaneous editing is a REAL pain though. When I started working on the project I was aiming for something like Etherpad except for WYSIWYG 3D LDraw. It took months and tons of research to design an efficient multi-user asynchronous editing model which I'm now realizing isn't as scalable as I'd hoped. It's a HUGE amount of work compared to the amount of free time I have, which is why I'm just trying to push the lite version right now.

Best of luck with your project. I would highly recommend giving the parsing portion of LDView and the rendering portion of Bricksmith (even if you're not familiar with Objective-C) a good read.
Reply
Re: Webgl renderer possible?
#6
maybe also cast a view to these threads

http://forums.ldraw.org/showthread.php?t...35#pid1935

http://forums.ldraw.org/showthread.php?t...856#pid856
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 4 Guest(s)