Oliver Zhou

Members
  • Content Count

    7
  • Joined

  • Last visited

About Oliver Zhou

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. My requirement can be achieved by: 1) create a graphic and apply my filter on it 2) call renderer.generateTexture to generate a texture 3) create a sprite to use the generated texture and then apply rotation. There's no need to use "outputMatrix", as you have told, not the right abstraction. Thanks again, Ivan.
  2. Okay, thanks. I think I use wrong abstraction for my purpose😆
  3. Here's my pixi playground. https://www.pixiplayground.com/#/edit/huvn96zZqn-UfdrhsUXv7 The shader I've written is from "The book of shader, chapter five". Basically it draws a line and a nice gradient from black to white. You can see right top one on the above screenshot. And then I rotated the sprite by 45, then as you can see, my expectation is it only draws pixels inside the blue rectangle I marked on the bottom right. But somehow it draws pixels on the whole bounding box. The question is how to achieve my goal when rotation is applied to the sprite?
  4. Thanks for you immediate help, Ivan. I see it finally works well😀. I can understand 2, could you please elaborate 3 a little bit for me? I don't quite get it. Thanks in advance.
  5. Hi Ivan, I created a pixi-playground at here for you: https://www.pixiplayground.com/#/edit/Y6TocuLkUOTfl7HrfcZFp
  6. I have rewritten the code as https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters suggested. Please help
  7. I tried this example in v5, it seems that it didn't work as expected any more. I have no idea why class CrtWarpFilter extends PIXI.Filter { constructor() { super(null, ` precision mediump float; varying vec2 vTextureCoord; uniform sampler2D uSampler; uniform highp vec4 inputSize; uniform highp vec4 outputFrame; vec2 mapCoord( vec2 coord ) { coord *= inputSize.xy; coord += outputFrame.xy; return coord; } vec2 unmapCoord( vec2 coord ) { coord -= outputFrame.xy; coord /= inputSize.xy; return coord; } vec2 warpAmount = vec2( 2.0 / 34.0, 1.0 / 16.0 ); vec2 warp(vec2 pos) { pos = pos * 2.0 - 1.0; pos *= vec2( 1.0 + (pos.y * pos.y) * warpAmount.x, 1.0 + (pos.x * pos.x) * warpAmount.y ); return pos * 0.5 + 0.5; } void main() { vec2 coord = vTextureCoord; coord = mapCoord(coord ) / outputFrame.zw; coord = warp( coord ); coord = unmapCoord(coord * outputFrame.zw); gl_FragColor = texture2D( uSampler, coord ); } `); } }