unrealnl

Members
  • Content Count

    22
  • Joined

  • Last visited

About unrealnl

  • Rank
    Member

Recent Profile Visitors

642 profile views
  1. This an old post, but since it does not offer a complete solution I'm dropping this link here: https://github.com/ErikSom/PixiCulling Feel free to explore the source as it might offer a more complete solution to culling. Additionally there is this one, which looks great as well: https://github.com/davidfig/pixi-cull
  2. Hey, Ivan made me aware of the question. he pushed me in the right direction and ill share the code. Masks are slow, its better to convert a graphic shape to a mesh and draw the shape using its vertices. // In the case of my editor, somewhere i set the body.mySprite.data.tileTexture to the lookup name of the tileTexture, e.g. 'grass.jpg' this.updateBodyTileSprite = function (body) { const tileTexture = body.mySprite.data.tileTexture; if (tileTexture && tileTexture != "") { let tex = PIXI.Texture.fromImage(tileTexture); tex.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT; if (!body.myTileSprite) { //body.originalGraphic is the shape we want to get the mesh from game.app.renderer.plugins.graphics.updateGraphics(body.originalGraphic); const verticesColor = body.originalGraphic._webGL[game.app.renderer.CONTEXT_UID].data[0].glPoints; let vertices = new Float32Array(verticesColor.length / 3); let i; let j = 0; for (i = 0; i < verticesColor.length; i += 6) { vertices[j] = verticesColor[i]; vertices[j + 1] = verticesColor[i + 1]; j += 2; } const indices = body.originalGraphic._webGL[game.app.renderer.CONTEXT_UID].data[0].glIndices; let uvs = new Float32Array(vertices.length); for (i = 0; i < vertices.length; i++) uvs[i] = vertices[i] * 2.0 / tex.width; const mesh = new PIXI.mesh.Mesh(tex, vertices, uvs, indices); body.mySprite.addChild(mesh); body.myTileSprite = mesh; } body.myTileSprite.texture = tex; } else if (body.myTileSprite) { body.myTileSprite.mask = null; body.myTileSprite.parent.removeChild(body.myTileSprite); body.myTileSprite = undefined; } }
  3. The resources are not available before the resources are loaded. I think thats the issue at Problem 1 right?
  4. Hi, After looking again at this issue, i still have to conclude that its not working for complexer shapes. @Tazi tried your polygonbounds, but also there i get weird results when rotating, see here: The Pen can be found here: @ivan.popelyshev I'm currently running version 4.7.0 and the normal getBounds() is giving me similar results. Do note that my graphic is inside a container. The setup is Stage > Container > Graphic The Container is only being scaled and positioned. Hope you can help me out! Best
  5. I apply a mask to a container that can container several sprites. Im building a decal system for my game, and i plan to render the decals on every x interval to a render texture. But there will be a lot of decals so creating a render texture on every frame seems a bit expensive. My idea is to create the following structure, in case of a Box: Box Container Sprite that has: 1) Box Sprite (with Box texture) 2) Decal Sprite (can have multiple sprites in it) 3) Decal Mask Sprite Decal Mask Sprite = Render a solid black graphic and add a white version of box texture to it. Decal Sprite = sprite that will hold several decals Decal Sprite will be masked by Decal Mask Sprite. When there has not been a sprite added to Decal Sprite for x MS , it will render itself to a render texture. That's a bit the idea i had in mind, also then for erasing decals, i could render on any position within Decal Mask Sprite a black graphic and re-render the Decal Sprite and then swap back the old Decal Mask. Hope this explains it a bit
  6. Hey Ivan, Thats super cool, i like the alternative approach a bit better as i still might be mixing alpha masks and black and white masks. So i will figure out how to implement those.
  7. So i could potentially use a blendMode subtract and render a texture twice on top of eachother, but this is not possible in WebGL..
  8. unrealnl

    Dissolve Shaded

    Thanks Ivan! I will build it myself ;)!
  9. Hi Guys, I was wondering if it's possible to render a texture with a solid color? I would need this in order to build a masking sprite. Im planning on using a solid black white mask and for this reason would like to be able to draw a sprite with just black or just white to a canvas. I looked at the tint class, but this doesnt force all pixels in a texture to be a color. Thanks in advance! Erik
  10. unrealnl

    Dissolve Shaded

    Hi all, Would it be possible to create a dissolving filter effect similar to http://kylehalladay.com/blog/tutorial/2015/11/10/Dissolve-Shader-Redux.html with Pixi? I'm no expert on shaders but would really like to port the shader over to pixi. It would be a nice addition for the filter pack, a dissolve shader. Hope to find some answers. Cheers
  11. Check this out: http://www.alexanderhare.com/experimental.html on your phone or on a desktop. Apparently Adobe is pushing hard for webgl content creation in Adobe Animate. Article here: https://blogs.adobe.com/creativecloud/creating-interactive-webgl-content-with-adobe-animate-cc/ Do you guys have experience with this? Is it still buggy? Does it work as advertised? Does it work on all browsers mobile/web? It runs for me on my S8 Chrome.
  12. No, im using the Graphics drawing API to draw the object in a new graphics object.
  13. Its exactly the same result, below you can see what i was trying to accomplish: