Jump to content

PixiJS bullet decal to renderTexture when alpha


JErvin
 Share

Recommended Posts

Finally I could create a bullet decay effect with renderTexture, I attached the image. There is a black ammoBox texture, and I render to it a red slpash texture. It works nice, but when I apply a blurFilter to the red splash sprite I cannot see it, I only can see the black ammoBox. I guess, it is because the red splash sprite becomes alpha (without the SRC_ATOP blendmode I see the image well, just little blurry, as expected).

What can I do to achiveve similar effect and also can use it with blurFilter? So my goal is, I have a sprite, like an ammoBox, it has transparent parts, I do not want to copy anything to the transparent parts, but any other part I want to copy my image (even if it has alpha in it).

Thank you!

 

        const brick=new Sprite(textures["ammoBox.png"]);        
        const wheelRenderTexture = RenderTexture.create({width: brick.width, height: brick.height});
        const wheelRenderSprite = new Sprite(wheelRenderTexture);
        wheelRenderSprite.x=1200;
        wheelRenderSprite.y=1200;
        this.contGame.addChild(wheelRenderSprite)

        this.app.renderer.render(brick,{renderTexture: wheelRenderTexture, clear: false});

        const splash=new Sprite(textures["splash.png"]);         
        splash.blendMode=BLEND_MODES.SRC_ATOP;        
        splash.tint=0xFF0000;       
        splash.filters=[new BlurFilter(1)]; //With this it not works :(
        
        this.app.renderer.render(splash,{renderTexture: wheelRenderTexture, clear: false});

 

ammoBox.png

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.

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