News for hackers. Stuff that matters.
Re:3D graphics in JavaScript (no libraries) by Scene_Cast2 on Tuesday February 11, 2014 @04:04PM (#7220437)
Something I often see missing in JS demos is fps-correct animations. Sure, the

  drawInterval = setInterval(plot, 10);
and

  angle += .05;
will work on default settings with no bottleneck, but put in "Manual Bresenham" and the animation slows down.

Back in the days of Flash, this was solved with tweening libraries that took in a curve (how to interpolate between the end values), and passing a variable reference that could be updated in an fps-agnostic fashion.

Here's my idea for a framerate-independent graphics library. Have a function pointer to the main draw( time T ) call, and one of the requirements would be that time T does not represent the current time and can be out of order ( draw(1), draw(3), draw(2) ). In other words, draw() would have to be pseudo-functional. This approach would allow for some neat tricks such as cashing, multithreaded and split-rendering, motion blur tricks, etc.

Re:3D graphics in JavaScript (no libraries) by yoha on Tuesday February 11, 2014 @04:20PM (#7220545)
Re:3D graphics in JavaScript (no libraries) by Timmmmbob on Tuesday February 11, 2014 @05:35PM (#7221011)
No he means it doesn't do:

angle += time_taken_to_render_previous_frame * speed;

Re:3D graphics in JavaScript (no libraries) by yoha on Tuesday February 11, 2014 @01:26PM (#7219282)
Use HTML labels with your radio buttons, please; I don't want to have to aim for the little circle.

   </body>
 </html>
 <script>
hem. use this instead:

      <script type="text/javascript">
      …
      </script>
    </body>
 </html>
I doubt it will be any efficient compared to native implementation. Cool hack though, it reminds my when I played around with basic real 3D drawing with Quick Basic.
Re:3D graphics in JavaScript (no libraries) by bbosh on Tuesday February 11, 2014 @03:26PM (#7220163)
<script> should be in the body, but the type attribute is optional in HTML5.
Re:3D graphics in JavaScript (no libraries) by vicapow on Tuesday February 11, 2014 @03:17PM (#7220106)
If you're familiar with D3, I recommend DZ. (disclaimer: I'm the author) https://github.com/vicapow/dz

Here's an example of DOF blurring using SVG filters. (no WebGL)

http://vicapow.github.io/dz/example/plane-blur.html

Re:3D graphics in JavaScript (no libraries) by CmonDev on Wednesday February 12, 2014 @04:12AM (#7223301)
It actually uses libraries: one for DOM traversal and another which provides a canvas. It's just that they are typically readily available in modern browsers and you have to go somewhere else to see the sources in a programming language. Perhaps "software rendering" would be a better word combination. Would be interesting to see similar projects in other scripting languages (Lua, Python etc.).
Re:3D graphics in JavaScript (no libraries) by burnte on Tuesday February 11, 2014 @05:30PM (#7220977)
If you like this, visit ctho's own site where all his toys are available. http://ctho.org/toys/

This particular one is the "3D engine" link. he later turned it into the Tie Fighter/Roller Coaster one. When looking for inspiration, I directed him to the xscreensaver module that he created Popsquares from.

Re:3D graphics in JavaScript (no libraries) by double051 on Tuesday February 11, 2014 @01:32PM (#7219327)
We're being redirected to http://liveweave.com/1POv7l/index-alert.html and seeing a 404.
Re:3D graphics in JavaScript (no libraries) by chewmieser on Tuesday February 11, 2014 @01:38PM (#7219392)
I guess LiveWeave is making some changes. From their footer:

  We are making changes to the server. Database I/O operations have been disabled. You can still "Download" your weaves
Re:3D graphics in JavaScript (no libraries) by browserspot on Tuesday February 11, 2014 @03:47PM (#7220317)
seems to be working again now...
Re:3D graphics in JavaScript (no libraries) by leeoniya on Tuesday February 11, 2014 @01:47PM (#7219477)
and if you dont mind libraries, but need to work without WebGL, i recently discovered http://www.kevs3d.co.uk/dev/phoria/

repo: https://github.com/kevinroast/phoria.js

Re:3D graphics in JavaScript (no libraries) by smrtinsert on Tuesday February 11, 2014 @03:25PM (#7220153)
This looks nice, can you do a quick compare/contrast with three.js canvasrenderer?
Re:3D graphics in JavaScript (no libraries) by sebastianavina on Tuesday February 11, 2014 @11:17PM (#7222456)
nice lib. thanks
Re:3D graphics in JavaScript (no libraries) by cordite on Tuesday February 11, 2014 @02:59PM (#7219988)
Too bad, still down.