Jump to content

How to change pixels in texture one at a time


Recommended Posts

I'd like to have a running character leave footprints in the ground, but I want it to be efficient as possible and I'd assume that making a keeping track of a new image for each footprint would be inefficient.


My idea is to have a big transparent texture that covers the whole level and just modify certain pixels of that texture.  How can I do this in Pixi?  Or, is there a better way to solve my footprint problem that I haven't thought of?








It looks like it might be possible with this: http://www.html5gamedevs.com/topic/667-question-pixel-array-render/

So I guess my question now is: In terms of efficiency and I approaching this problem the right way, or am I going in the wrong direction?

Edited by crowbar
Link to comment
Share on other sites

We can renderer ~100k moving and rotating sprites in webgl with no perf degradation as long as you batch properly. I wouldn't be too worried about it.

Doesn't batching only work if its the same sprite tho?  What if I want to use sprites of different shapes or colors?


I guess http://www.goodboydigital.com/pixijs/bunnymark/ kind of answers my questions.  My real purpose is to make a particle engine with persistence.  I had no idea 100k sprites was possible.


Here is another scenario.  I want my character to eject shells when he shoots his gun and I want the shells to stick around until the level ends.  Based on your answer I should be able to have thousands and thousands without there being any problem?


I notice that the bunnymark uses a "Particle Container" but I can't find any documentation on it.  I can't even find it in the files used for the bunny mark.  What is it?

Link to comment
Share on other sites

Batching works if it is the same *base texture* meaning the same base image. I can have all the sprites in my game in a single image spritesheet, and they will all be batched. The ParticleContainer is a new v3 container that enforces a single layer of children, and uploads specific properites of those children to the GPU where all the transforms occur. It is a super fast way of rendering sprites that share a common texture, and only need basic transform updates.


Link to comment
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.

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.


  • Recently Browsing   0 members

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