Iavra Posted August 17, 2016 Author Share Posted August 17, 2016 It seems i get a weird bug. Here's my test layer, that gets added to the scene (initialize gets called once, update gets called each update): $.LIGHTING.Layer.prototype = $._extend(Object.create(PIXI.Container.prototype), { initialize: function() { PIXI.Container.call(this); //this.addChild(this._demo = PIXI.Sprite.fromImage('img/occlusion.png')); this._occlusion = PIXI.Sprite.fromImage('img/occlusion.png'); this._test = new PIXI.Sprite(PIXI.RenderTexture.create(500, 500)); this.addChild(this._test); this._test.filters = [new $.LIGHTING.RectangularToPolarFilter(), new $.LIGHTING.PolarToRectangularFilter()]; Window.x = 0; }, update: function() { this._occlusion.x = Window.x; Graphics._renderer.render(this._occlusion, this._test.texture, true); } }); Now, it seems to work fine, as long as i don't move around the occlusion map. As soon as i do so, the filtered image updates, but it seems like older data (which should have been cleared from the RenderTexture) is still there (images are with Window.x = 0, 100 and 0 again): I expected it to work, because when i render the occlusion map to the render texture, the filters aren't involved at all (or so i thought). If i don't use the filters, the texture gets updated correctly. This is the occlusion map i'm using: Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 17, 2016 Share Posted August 17, 2016 Ugh.. can you give me whole project, in a zip file? May be share it on dropbox? My email is [email protected] Quote Link to comment Share on other sites More sharing options...
Iavra Posted August 17, 2016 Author Share Posted August 17, 2016 It's actually an Rpgmaker plugin (though i'm using the latest PIXI version instead of the bundled one). The whole plugin can be found here: http://pastebin.com/qrFV6ThW It shouldn't be that hard to translate to a non-RM environment, though. Basically, you add an instance of IAVRA.LIGHTING.Layer to a scene and call its "update" function on each frame. "Graphics._renderer" would need to be substituted with however the PIXI.WebGLRenderer instance is called. Aside from that, i'm not using any RM specific classes. /edit: For now i'm working on per-vertex lighting, instead (example: http://ncase.me/sight-and-light/), since it's easier to grasp, until i come up with a solution ^^ 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.