Jump to content

WebGL or Three.js for faster 2D rendering?


MrBurda
 Share

Recommended Posts

Hello :). Warn: Question could be dumb. tl;dr: If I want to harvest the power of GPU for a low-level 2D rendering, should I use WebGL, three.js, or something similar? Or Pixi.js is the way? Other options?

Version with redundant personal information: I've been making this rendering/animation engine for pixel-art, which I intend to integrate in different projects... It has simple vector animation ui and simple script lang, for converting from vec to pixelated graphics and applying pixel-wise transformations. And now I need to draw these big "pixels" fast. Also the task of creating pixel texture and filling a triangular region with it is at hand. Also custom shaders, programmable from my lang. And that's the end of my ambitions at the moment.. What should I use to GPU this?

I learned a little Pixi.js, but it seems a little high level (?). As I understand it, WebGL is the ultimate low-level answer to GPU questions.. I just need to draw big squares and textures... Creating custom shaders would be awesome too. 

(Is the whole project stupid?) I have this problem (with ego?) of building everything from scratch, no engines etc. And as a result a heap of unfinished projects with years of dev behind them. HELP! One of the first forum questions for me.. have mercy. ?

Link to comment
Share on other sites

For WebGL 2D my simple opinion would be "PixiJS is the way".  Easy to work with, performant, adaptable, somewhat lightweight, well adopted (good support and well documented), doesn't get in the way of your own opinions on how to structure a game.  I can't imagine how much effort it would be to develop something comparable, then convince enough strangers to adopt it so that you can strike up a conversation about whatever issue you're having and have someone contribute for the fun of it.  It's slick and makes game dev fun.

Link to comment
Share on other sites

If you use pure WebGL instead of Three.js/Babylon.js you should make some things from scratch like a skeleton animation. It requires some time. But every way has their own cons and props. You will understand math better, will have more control, and will more independent. I study pure WebGL with glMatrix and physics engines (like Planck.js (Box2D), Ammo.js (Bullet Physics), Matter.js, and Cannon-es) for 2D and 3D games. My favorite books are:

Run this demo in browser by click

animation-with-correction.gif.0cd38952292c56cacd22ec9f33efde21.gif

char-skeleton

Edited by 8Observer8
Link to comment
Share on other sites

  • 4 weeks later...
  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...