Mikal's Recent Forum Activity

  • The effect allows you to deform a quad image using four relative vertices within the object.

    Based on: https://iquilezles.org/www/articles/ibilinear/ibilinear.htm by Inigo Quilez

    The four points of the quad deform are the X,Y parameters for the effect. The parameters are relative to the size (width, height) of the original quad / image. 0,0 is the top left. 1,1 is the bottom right.

    The effect then maps the original texture of the object (usually a sprite) to the deformed quad.

    The deformed quad will not be rendered outside the bound of the original quad.

    However, a couple of helper functions detailed in the examples allows a quad to be resized and rendered anywhere in the layout with any size vertices (including flipped and convex.)

    Check out the effect and example project w/ the helper functions, if you do something interesting with it, please post a picture in the thread.

    Addon and examples

  • I agree it's not ideal. I understand about the gl state save and restore (and the perf cost.) I'm using a library to do it (which allows for a large amount of gl state save (perf hit), but also has a method to specify state to save, to trim back for min required and for better perf.) I am not done yet, because somewhat as expected, some Spine renderer state or context or gl call is not allowing the C3 render to show up (and I don't expect help from Scirra with that.)

    github.com/stackgl/gl-state

    My thought is to render Spine to a texture buffer (in C3 context) created through the C3 SDK CreateDynamicTexture(), instead of direct to C3 FB. I will not be using the UpdateTexture() call, instead, I'll be rendering to the texture directly. I will be doing this all through a C3 object's Draw(renderer) call, so I can render to the texture, then call SetTexture() and then Quad4() to keep things synchronized. This way I can hopefully continue to use the full power and integration of C3 (effects on Quad, size, position, rotation actions, behaviors - which is the goal.)

    This actually worked really well with the ElementQuad addon I created, which did render to other canvas and then UpdateTexture() - it was just the issue of slow UpdateTexture() on mobile which made it not a good solution for mobile (and perhaps some desktop GPUs which use heavily tiled render (Intel perhaps?) I could add effects and behaviors to ElementQuad, it is a nice combination of C3 and another renderer (for non-mobile.)

    Using IWebGLRenderer would be great also, as you said - I think it would be a big code rewrite, but I'm going to dig through the Spine-TS code a little more and see if I can find an abstraction layer which matches (I also need to match up C3 texture management and Spine-TS texture management/atlas - which I think CreateDynamicTexture may help with, since it seems like that does not become involved with the general C3 spritesheeting algorithm.)

    It feels like we are close to getting something good working, so I'm going to keep working on it (Igor made a nice plugin version, much better than my original template, so it could be used devs easily.)

    Thanks for the comments and discussion.

  • Ashley Thanks for the comments, so no magic bullet, I'm not surprised after my research, but I wanted to check, in case I was missing something (I also want to use C3 SDK to keep plugins more easier to maintain.)

    In parallel, I have already bitten that bullet. However, I want to check with you on this, because it's using mesh deforms and a lot of webgl effects and it's complicated (10k lines of code as I mentioned, using meshes, custom shaders, etc.) - so Spine-ts is rendering directly to the canvas using webgl. However, you cautioned against this due to C3 controlled batching, etc.

    Before I start asking questions - is this what you meant by render directly?

    (Current status - I have the Spine render to C3 canvas working, but I'm debugging save/restore state, calling EndBatch(), etc. to make it co-exist with C3, I may render to texture instead of direct to C3 Canvas FB and hopefully the rendered texture will be usable w/o a big perf hit for render to C3 canvas using C3 SDK to render the Quad to C3 canvas, Set up a new texture, etc.)

  • Ashley This is working very well on Desktop setup and Igor has actually created a nice Spine Addon which uses this new method. I have found it to work well on Desktop.

    However, on mobile (specifically iOS/iPhone), the UpdateTexture() takes a long time, specifically the gl.texSubImage2D() call. After some research, this is not surprising due to the PowerVR GPU tiled rendering method and also the GPU's BGRA pixel format.

    I am wondering how this is handled for the case for the Text plugin? Is it just reliant on the developer to not update Text plugins that often on a mobile system, or do you have another optimization for cases like a timer that might update a Text plugin every frame?

  • This is still work in progress.

    Based on this and Spine-TS, Igor has created a nice plugin which works reasonably well on Desktop, but is slow on mobile (lots of CPU consumption), this is likely due to how textures are being updated on mobile vs desktop, investigating possible fixes.

    gritsenko.github.io/c3_spine_plugin

  • I'm not sure of the answer yet, but I did run across this discussion for anyone else interested in this topic which looks related:

    github.com/Scirra/Construct-3-bugs/issues/3150

  • Great work, I might actually start using buttons again instead of Sprites for clickable objects, the default is so horrible.

  • Agree, I have the same issue. Testing an application which uses the mobile accelerometer, so I really want to test on mobile to tune the experience. I have some rather large textures, so the app is a little larger. However, I have a reasonably fast network/wifi (200Mbps+), but the OTA speed/loading seems much slower than that. The main thing I am looking for is faster preview on mobile.

  • equirectangular effect based on shadertoy.com/view/Ml33z2 By KylBlz.

    Can view 360 pictures and videos in C3. WIP will post to addon site w/ example soon.

    Try it out: Web Demo (includes more pictures and a 360 video example.) Use scroll wheel to change FOV (zoom.)

  • Working on some effects and I have noticed that the uniform pixelSize changes when opacity is set below 100%. I imagine this has something to do with rendering required on sprite before opacity/blend is applied. Any suggestions on how to handle the case of pixelSize changing as opacity is switched between 100% and < 100%?

    pixelSize is being used to get the full render screen resolution in the effect which uses it for relative positioning. An alternative is to pass this value in directly via another uniform.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, appreciate the work!

  • I posted a possible solution on the Construct Community Discord. Using fract() and normalize of uv/Vtex with srcOrigin*.

Mikal's avatar

Mikal

Early Adopter

Member since 22 Apr, 2016

Twitter
Mikal has 112 followers

Trophy Case

  • 9-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • x10
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

21/44
How to earn trophies