phaser icon indicating copy to clipboard operation
phaser copied to clipboard

SpriteFx doesn't render to render texture

Open vforsh opened this issue 2 years ago • 1 comments

Version

Phaser 3.60 beta 4 (built from the repo)

Description

Items that have sprite fx don't render to render texture.

2021-12-09_17-12-58

Example Test Code

Demo - https://codesandbox.io/s/render-texture-glow-zsv9k?file=/src/index.ts:172-1009

		let renderer = this.renderer as Phaser.Renderer.WebGL.WebGLRenderer
		let glowSpriteFx = renderer.pipelines.add("GlowSpriteFX", new GlowSpriteFX(this.game, 0.3, 10)) as GlowSpriteFX
		
		let text_1 = this.add.text(0, 0, "no glow", {
			fontSize: "70px",
			fontStyle: "900",
		})

		let text_2 = this.add.text(0, 70, "glow", {
			fontSize: "70px",
			fontStyle: "900",
		})

		text_2.setPipeline("GlowSpriteFX")
		
		let rt = this.add.renderTexture(0, 300, 500, 200)
		rt.fill(0xff0000, 0.5)
		rt.draw(text_1)
		rt.draw(text_2)

vforsh avatar Dec 09 '21 14:12 vforsh

I'll have a look at this, but it's likely just a limitation of RenderTextures and non-trivial to work around.

photonstorm avatar Feb 03 '22 16:02 photonstorm

Closing as this now works correctly. PreFX will show up on Game Objects drawn to Dynamic Textures. Post FX will not, but that is fine, I'm not supporting that.

photonstorm avatar Mar 31 '23 15:03 photonstorm