HTML5 Weird texture issues

Discussion in 'Legacy GameMaker Community Tech Support' started by Roa, Aug 27, 2016.

  1. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    html5 has some very strange behavior in 3d.

    1: I noticed that a model can only ever have one texture applied to it. The model must be redefined per individual texture. All model calls will use the first texture mapped to. It never to updates unless the model is destroyed.

    2: stemming from the same issue, you cannot even cycle an animation using a sprite and updating the texture pointer. All instances that call the model will all have the same first texture, no matter where its called, and it can never be changed.

    When talking 3d, constantly having to create models and dynamically to updates textures doesn't work as it causes too many texture swaps and draw calls that lag. Alternatively, having a new model defined for very frame of animation and texture variant is a total pain in the ass.

    Is this a limitation of html5 or a glitch? It only happens in html5. All other platforms work fine. I can work around it to a point, but the extra work is very tedious.


    PS: also notice you cannot use sprite_get_texture() and store the value in an array. It will always return a white graphic. Can only store textures in variables, which is even more inefficient to iterate through.

    PSPS: I don't even know whats going on anymore. Things work on android and windows and simply don't on HTML5 and there are so many points of fault that I can't tell what exactly is causing issues, if its not a great number of things. Anyone experience any of this? This is a nightmare.
     
    Last edited: Aug 27, 2016
  2. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    @Mike Is gamemaker html5 broken? Help me out with this one lol.
     
    KingdomOfGamez likes this.
  3. Mike

    Mike nobody important GMC Elder

    Joined:
    Apr 12, 2016
    Posts:
    2,356
    Nope - working fine here as far as I can tell.

    First, don't use d3d_models, use vertex buffers. A vertex buffer can be rendered using different textures (as long as the UVS map to the same thing). As long as the texture is on it's own page, it'll use 0 to 1 UV values, and then when you submit, you can easy change texture on the submit.

    If you want to keep many textures on a texture page, do a shader that accepts the base UV and pass that into the shader using sprite_get_uvs(), then again you can easily render using the same model with different textures
     
    renex and KingdomOfGamez like this.
  4. Mike

    Mike nobody important GMC Elder

    Joined:
    Apr 12, 2016
    Posts:
    2,356
    okay... so I've actually been playing with a model loader for windows, but tried it in HTML5. It works fine, complete with different textures. All use vertex buffers to render frame, with a dedicated buffer for each texture.

    Works fine - in fact, worked right off. You do have to uuencode your files though - even ascii ones, that's the only gotcha. Buffers only load UUE files in HTML5
     

    Attached Files:

    renex and Roa like this.
  5. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    Alright. Sorry I haven't got back to you on this. Classes started this week. Anyways, the vertex buffer method works when I tried it, allowing animated textures to be used, even when one global vertex buffer is used and each instance controls thier own texture. This simply isn't true for models. No matter what happens. Models can never change their texture, whether global, or per instance. The first texture assigned to that model index is the only one they keep through out the entire program. I mean my problem is solved by using vertex buffers, but I feel this may effect other users down the line. I could make a video showing the problems I'm experiencing and all my work arounds.

    The model I made for the test I did was just a d3d_model_wall(). All I needed was a plain. It wasn't anything I imported.
     
  6. Mike

    Mike nobody important GMC Elder

    Joined:
    Apr 12, 2016
    Posts:
    2,356
    The texture itself isn't encoded into the model - the UVs obviously are (as are colours)... if the texture is on a TPage (not it's own dedicated one) then it'll keep showing the same one. But if they are dedicated TPages (1 per texture), then it should work fine....
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice