MrBurda Posted August 20, 2019 Share Posted August 20, 2019 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! ? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 20, 2019 Share Posted August 20, 2019 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. MrBurda 1 Quote Link to comment Share on other sites More sharing options...
MrBurda Posted August 22, 2019 Author Share Posted August 22, 2019 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? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 22, 2019 Share Posted August 22, 2019 Yes, and I recommend to do it as soon as you start making serious stuff and not just a demo: https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop Just make your own app class with pixi ticker inside. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.