Borgel Posted October 23, 2020 Share Posted October 23, 2020 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. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 23, 2020 Share Posted October 23, 2020 Do texture.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP before you render to it. If it doesnt work, we probably have a bug, and you have to debug whether texParameter with REPEAT is called in TextureSystem Quote Link to comment Share on other sites More sharing options...
Borgel Posted October 23, 2020 Author Share Posted October 23, 2020 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? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 23, 2020 Share Posted October 23, 2020 if its set to clamp then it has to work. Do you use it in sprite or tilingSprite? Quote Link to comment Share on other sites More sharing options...
Borgel Posted October 23, 2020 Author Share Posted October 23, 2020 (edited) 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 October 23, 2020 by Borgel Adding Code Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 23, 2020 Share Posted October 23, 2020 btw, renderer doesnt have default wrapMode no , it should work fine. Need more details. Quote Link to comment Share on other sites More sharing options...
Borgel Posted October 24, 2020 Author Share Posted October 24, 2020 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. Quote Link to comment Share on other sites More sharing options...
Borgel Posted November 3, 2020 Author Share Posted November 3, 2020 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. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 3, 2020 Share Posted November 3, 2020 bwahahaha, sorry, forgot about that. Yes, we force it just change it back before it gets uploaded, or upload it by yourself first "renderer.texture.bind(myTexture)", praying that GC wont collect it and it wont be reuploaded with that forced style. Quote Link to comment Share on other sites More sharing options...
Borgel Posted November 3, 2020 Author Share Posted November 3, 2020 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? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 4, 2020 Share Posted November 4, 2020 I dont remember why do we have that thing, likely @Mat Groves added it when he was adding beginTextureFill(). Maybe we had discussion about it somewhere in https://github.com/pixijs/pixi.js/issues , but i cant find it. You can create a new one Quote Link to comment Share on other sites More sharing options...
Borgel Posted November 4, 2020 Author Share Posted November 4, 2020 Ill add a issue for it. I created a fiddle for the issue as well:https://jsfiddle.net/ngutc5ob/ The blue arrow point to the graphics object that the texture is rendered to. The black arrows point to the artifacts crated on the original texture. Not running beginTextureFill will leave the texture corrupted. Quote Link to comment Share on other sites More sharing options...
Borgel Posted October 11, 2021 Author Share Posted October 11, 2021 Link to the issue:https://github.com/pixijs/pixijs/issues/6977 ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.