Question - Code [SOLVED] draw_sprite_ext: Unwanted Lines

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Nodamex, Jan 5, 2019.

  1. Nodamex

    Nodamex Member

    Joined:
    Jul 14, 2016
    Posts:
    25
    Here is the lines:
    upload_2019-1-5_22-38-19.png

    Code:
    draw_sprite_ext(sprite, -1, xx, yy, ssize, ssize, aangle, bblend, aalpha)
    
    This is my shield sprite:
    upload_2019-1-5_22-41-22.png

    How can I avoid this?

    Note: After refreshing, lines may disappear.
     
  2. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    649
    this is too vague
    from your post, the original pics are diagonal and you rotate it upright, and i dont know the lines your talking about,
     
  3. The Sorcerer

    The Sorcerer Member

    Joined:
    Jan 3, 2019
    Posts:
    30
    At a glance, this appears to be texture bleed caused by the surrounding sprites internally on the texture page.

    You can verify this by turning off interpolation, for test purposes only, and/or ticking use for 3D.

    Neither of these options are optimal, But if the lines go away it is texture bleed.
     
    Nodamex and Joe Ellis like this.
  4. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    649
    True, it could be, could you post more info though?
    and if you refresh do they go away?
     
    Nodamex likes this.
  5. Desix

    Desix Member

    Joined:
    Jun 23, 2016
    Posts:
    427
    Are you adding black outlines to these in-game? - & do the artefacts appear if you don't do this?
     
    Nodamex likes this.
  6. Nodamex

    Nodamex Member

    Joined:
    Jul 14, 2016
    Posts:
    25
    Even if I do not use the black outline script, it happens.
    upload_2019-1-7_16-22-28.png

    Setting interpolation off solves the problem, but I do not want to turn off.

    Left: With interpolation
    Right: Without interpolation
    upload_2019-1-7_16-33-6.png
     
  7. Hyomoto

    Hyomoto Member

    Joined:
    Jul 7, 2016
    Posts:
    1,014
    The issue, as others have noted, is a type of texture bleeding. I don't know the full technical reasons behind it but I know that it's worsened by precision problems. That is to say, it's worse on an angle of 12.019228 than 12.00000, which is worse than 10 or 15. However it doesn't affect all things equally either, as your bow is affected but other sprites may not be.

    A solution could be to make a new sprite that is already rotated, but you may also be able to find a scale/rotation that doesn't cause the effect.
     
    Last edited: Jan 7, 2019
    Nodamex likes this.
  8. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,246
    Nodamex and Hyomoto like this.
  9. Nodamex

    Nodamex Member

    Joined:
    Jul 14, 2016
    Posts:
    25
    changing border size solved my problem.
    thank you all.
     

    Attached Files:

    gnysek and The Sorcerer like this.
  10. Hyomoto

    Hyomoto Member

    Joined:
    Jul 7, 2016
    Posts:
    1,014
    I just remembered, even though this is marked as solved, that GM2 optimizes sprites by removing all of the 'blank' pixels regardless of how many you have in the editor. Which is why the changing border fixes it, because you are adding that blank space back in. Just to add a little bit of information as to why that fix works. I honestly forgot about that.
     
  11. kupo15

    kupo15 Member

    Joined:
    Jun 20, 2016
    Posts:
    694
    Border size adds transparency around the border of the entire tex page not each individual sprite, right? I know there are both options when dealing with texture atlases. When would you need to use the border padding vs sprite border padding?
     
  12. Nodamex

    Nodamex Member

    Joined:
    Jul 14, 2016
    Posts:
    25
    it adds space for each individual sprite in one texture page, so lines are gone, i think.
     

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