Grab WebGL canvas of a Sprite

0 favourites
  • 11 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • The question is more specifically for ASHLEY.

    For some examples and plugins I'm planning to create, it would be useful to grab a Sprite on which a shader has been applied. I can now easily grab the <img> of a Sprite, when WebGL isn't used. However, I don't know what and where to grab to get that (because you can't easily convert a WebGLTexture back to a <canvas>).

    Ashley is there an easy way to do that ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You mean you want to grab the image of a sprite with a shader applied?

    The shader compositor (which runs all the effects) is one of the most difficult and complicated parts of the engine. I don't think this will be at all easy to do, and possibly very slow (since it might depend on retrieving pixel data). I'm afraid I can't see an easy way to do this.

  • Ashley : OK. I'm a bit sad, because having the possibilty to retrieve effects applied on Sprites would be great for a few things...

    I have another questions about shaders. The Sprite is seens as a quad with four vertices. So there is no need for a vertex shader.

    However, having the possibility to tesselate to quad can open the possibility to apply vertex shaders on the tesselated Sprite. That would help to create crumpled paper effects on a Sprite, or page flip. Are you planning to add a more refined way to deal wth vertex shaders, or is it out of the scope of C2 ?

  • It's out of the scope of C2 for the moment, the shader compositor does not support vertex shaders at all right now (and I dread to think how complicated it would be to add them...)

    We might eventually add something like mesh distortion from Classic back in, but it's a very complex feature to get right. Users expect the collision mask is distorted the same way and so on, and used incorrectly it can cause performance problems too.

  • We might eventually add something like mesh distortion from Classic back in, but it's a very complex feature to get right. Users expect the collision mask is distorted the same way and so on, and used incorrectly it can cause performance problems too.

    Very much please add this feature! Even with the collision mask not distorted with the image, it's very useful and awesome and I utterly loved it in CC. I also found ways to make my own distorted collision mask using invisible sprites.

    What do you mean by "used incorrectly" though? For reference if it ever gets put in, so I can know what to avoid.

  • Arima - if you make the columns/rows high, so there are say 400-1000 cells, then spawn a few instances, you could easily be reaching the equivalent rendering demand of 10,000 sprites.

  • Ashley : OK, thanks for the answer.

    I was thinking about that because when I people were asking for a Mode7 shader, I realised that without vertex shader, it's going to be difficult to do it properly.

  • Pode I think it's possible to simulate Mode7 using only a pixel shader. I will try some ideas, but I think it's doable.

    Too bad it's not that easy to grab the image of a sprite with a shader applied. :/

    I was counting on R0j0 updating his canvas plugin to allow me to create some iterative shaders to simulate fluids like smoke, air flows, possibly water, etc.

    I did this once in CC. But to be doable there needs to be a way to use the output of the last frame as the input of the next one.

  • Arima - if you make the columns/rows high, so there are say 400-1000 cells, then spawn a few instances, you could easily be reaching the equivalent rendering demand of 10,000 sprites.

    Why can't we just go with poly's rather than rows/ columns?

    Its not like we don't use them for collisions already.

    Granted its slower, but I think we've crossed that bridge already.

  • newt - sometimes you want a lot of rows but just one column, e.g. to make an archway.

  • Guess you could always use <tables>. :p

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)