MrBurda

Using Pixi for procedural image drawing.

Recommended Posts

Hello! I'm writing a pixelArt game.

1) I'd like to use procedural image generation, i e using functions to create and modify images pixel by pixel on fly. Some examples: modifying images to create dynamic shadows on an object itself, grass reacting to player movement, characters calculated/ animated in vector, but then pixel clothes grows on the vector sceleton and displayed.

My Question is: Can Pixi do pixel manipulation? Is there smth I should know about it? Is Pixi - the best choice for such a task? Is it even gives any advantages, compared to HTML Canvas pixel manipulation, e g does it use GPU or smth?

2)I'd like to scale pixels freely, so two objects on scene can have pixels of different sizes. Is there a proper way to do it? I'm thinking of using some scale method on image or just drawing a lot of rectangles, with PIXI ParticleContainer or smth..

Also if someone thinks that my ideas are dumb for some reason, and I should prerender everything, please say so! 

Here's some probably irrelevant information: I plan to desktop the game, using electron.

Thanks for attention! 🎩

Share this post


Link to post
Share on other sites

The only interface in PixiJS that gives advantages for pixel manipulations is called TextureResource, it was introduced in v5. I didnt see anything like that in other renderers, but if you use it right, you can make your own Bitmap. There're no articles on it, only one example https://pixijs.io/examples/#/textures/gradient-resource.js and one hack: https://github.com/pixijs/pixi.js/wiki/v5-Hacks#pixisprite . If have to know what "subTexImage2D" is and how to do manipulations with html5 canvas getImageData/putImageData.

I use pixel manipulation a lot and in a few months ill be ready to make Bitmap plugin that allows to do it.

However, you might be intereseted in manipulations with RenderTexture, shaders and filters - it allows to create your own lighting and other effects.

Share this post


Link to post
Share on other sites

Thank you so much! 😂 You are very helpful! If you ever got another moment:

Can you say something on second question?

3) Also, I got another one: Is there a way to switch off Pixi's rendering and call it manually from my game loop?

Share this post


Link to post
Share on other sites

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...

  • Recently Browsing   0 members

    No registered users viewing this page.