3D renderer ENTIRELY in CSS3

263 views
Skip to first unread message

Mihail Ivanchev

unread,
Nov 3, 2012, 7:48:03 AM11/3/12
to haxe...@googlegroups.com
Hello List,

I had an interesting idea I wanted to try out yesterday, to make a 3D renderer entirely in CSS3, just to see if it's possible, since I supposed using masking, skewing and 3D transformations, one can achieve anything possible. no external things required. After spending the night fixing linear algebra issues, I finally managed to get it going with the help of Haxe :) If you're interested you can check it out here:


and source:


I am sorry I embedded the model directly in the source code and for the hacky nature of everything, this was a quick prototype. No texture mapping yet, but that would surely be also possible!

Regards,
Mihail

Mihail Ivanchev

unread,
Nov 3, 2012, 8:04:14 AM11/3/12
to haxe...@googlegroups.com
For those of you not seeing the 3D model, testing requires a WebKit browser, such as Chrome.

Ashiq A.

unread,
Nov 3, 2012, 8:17:37 AM11/3/12
to haxe...@googlegroups.com
Looks very interesting! What's the FPS on this thing? It looks like 1-2 on my computer (quad-core, decent GPU).

I'm not sure how suitable 3D rendering is to CSS, because of the high-performance nature (lots of verticies and polygons). Still, this is an awesome idea, and it only takes one person to take it to the next level :)

--Ashiq


On Sat, Nov 3, 2012 at 8:04 AM, Mihail Ivanchev <miha...@gmail.com> wrote:
For those of you not seeing the 3D model, testing requires a WebKit browser, such as Chrome.

Luca

unread,
Nov 3, 2012, 11:24:56 AM11/3/12
to haxe...@googlegroups.com
Specifically a very up to date version of firefox/chrome, or else it still doesn't work.

j...@justinfront.net

unread,
Nov 3, 2012, 12:12:11 PM11/3/12
to haxe...@googlegroups.com
Mihail

Nice but I use firefox more :)

You need to really change the JQuery lines.  I am not sure that you need a selector your only changing one node? should be able to just access the style?

The changes needed are line 78

new JQuery(Std.format("#polygon-$index .face")).css("-moz-transform", faceTransform);
new JQuery(Std.format("#polygon-$index")).css("-moz-transform", triangleTransform);

and for Opera try... 

new JQuery(Std.format("#polygon-$index .face")).css("-o-transform", faceTransform);
new JQuery(Std.format("#polygon-$index")).css("-o-transform", triangleTransform);

not sure about IE10 it maybe -o as well?

but my approach would be to maybe add a few methods to Divtastic see line 954 for general structure I would need to work out the detail but if you can avoid JQuery and selectors I think potentially you might be able to gain a small speed increase or maybe it would be much slower I am not too sure depends?

Best 

Justin
PS on firefox I am seeing some distortion.



Laurent Auneau

unread,
Nov 3, 2012, 3:07:02 PM11/3/12
to haxe...@googlegroups.com
Are you handling Z depth?
Looks like a flat model, so not really 3D. You'd have to go for a BSP and back to front rendering, which would mean a lot of overdraw.
But maybe you came up with something clever?

-L



--

Jan_Flanders

unread,
Nov 3, 2012, 7:28:46 PM11/3/12
to haxe...@googlegroups.com


On Saturday, November 3, 2012 8:07:44 PM UTC+1, Laurent Auneau wrote:
Looks like a flat model, so not really 3D.
 
Some people actually see a non flat model: http://simn.de/haxe/nonflatkey.png
But I (and some others) see the same as you: http://www.haxer.be/screenshots/flatkey.png

Jan

Ashiq A.

unread,
Nov 3, 2012, 7:48:21 PM11/3/12
to haxe...@googlegroups.com
Odd.

I see a non-flat model as well.

--

Joshua Granick

unread,
Nov 6, 2012, 12:37:02 PM11/6/12
to haxe...@googlegroups.com
If you are going to use CSS transforms, make sure you also include the unprefixed "transform" property, since the current versions of Opera and other browsers are dropping the vendor prefix
--
Using Opera's mail client: http://www.opera.com/mail/

Joshua Granick

unread,
Nov 6, 2012, 12:37:06 PM11/6/12
to haxe...@googlegroups.com
Although many browsers support CSS transforms, they don't all support 3D. Most support 2D transforms only
Reply all
Reply to author
Forward
0 new messages