Jump to content

RenderTexture border aftifact


Borgel
 Share

Recommended Posts

I am rendering a container to a texture.
Following this tutorial:
http://scottmcdonnell.github.io/pixi-examples/index.html?s=basics&f=render-texture.js&title=Render Texture

From what i can tell my code is identical, but i get a border spill artifact where the edge pixels on one side spills over to the other.
What could be causing this? 
The texture size is pow2 and i have tried setting different WRAP_MODES. 
 

Artifact.jpg

Link to comment
Share on other sites

Setting the RenderTexture.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP did not work.
I stepped through the render code and in
TextureSystem.updateTextureStyle the warapMode is set to clamp (33071)
Im working in V5.2.1.

Im not very familiar with the pixi codebase, so im not sure what im looking for.
Do you have a rough idea of where you would want me to start debugging? 

Link to comment
Share on other sites

Perhaps its not a wrapping issue? 
Sprite, not tilingSprite. 

 

var brt = new PIXI.BaseRenderTexture( 128, 128, PIXI.SCALE_MODES.LINEAR, 1 );
var rt = new PIXI.RenderTexture( brt );
var sprite = new PIXI.Sprite( rt );

rt.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP;
renderer.wrapMode = PIXI.WRAP_MODES.CLAMP;

containerOne.addChild( sprite );
renderer.render( containerTwo, rt, true, new PIXI.Matrix().translate( x, y ) );

 

Edited by Borgel
Adding Code
Link to comment
Share on other sites

I tracked down the issue to a specific event.

This line:
m_graphics.beginTextureFill( { texture: t_texture, matrix: new PIXI.Matrix().translate( -m_radius, -m_height / 2 ) } );

For some reason this corrupts the texture producing the effect. 
This feels like a bug to me, but i have not had time to investigate it yet. Ill look further into it later.

Note that the effect appears both in the graphics shape and the sprite created with the texture, so it is the texture that is changed. 

Link to comment
Share on other sites

  • 2 weeks later...

I have found at least where the issue is introduced, but now yet why the texture becomes corrupted. 
GraphicsGeometry -  buildDrawCalls - line 728: nextTexture.wrapMode = 10497; (repeat)
When changing this to mirror or clamp at runtime the texture corruption does not happen. 

Link to comment
Share on other sites

Temporarily im forcing the drawcall back to clamp by intercepting 'packAttributes', as its the next function to be called after that. Super hacky, ill see about a better solution later. 

But what about the texture getting corrupted?
I can understand that the graphics object might want to tile its texture, but that should not alter the supplied texture. Surly this is a bug?

Link to comment
Share on other sites

  • 11 months later...

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