Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange minimap fade/melt effect #3

Closed
Enet4 opened this issue Sep 11, 2014 · 5 comments

Comments

Projects
None yet
2 participants
@Enet4
Copy link
Contributor

commented Sep 11, 2014

I've been observing an undesired effect in the game's minimap. A slight movement on the screen makes its background fade away in some way. This effect seems to happen on any area of any terrain.
shot0
shot1

It also seems to be related with the lower left edge of the screen, as we can often see things replicated from there on the minimap, including what is supposed to be drawn to it in the first place. This last picture was taken immediately after a game load, before the image "melted" completely (there's a minor trace of the minimap's background on that corner).
shot2

Hopefully, this info will help one of us fix this bug. This is happening in my 64-bit linux machine.

@Enet4

This comment has been minimized.

Copy link
Contributor Author

commented Sep 22, 2014

I confirm that this issue still occurs in the latest development code. Here's another picture.
shot3

I've looked into the texture creation procedures from the engine module, but I still don't have a clue on what's going on. It's as if the minimap background texture was mistakenly being drawn elsewhere.

@verhoevenv

This comment has been minimized.

Copy link
Owner

commented Oct 23, 2014

Interestingly, before fading, there is a ghost view of the minimap on the left hand side of the screen:

shot1

(EDIT: oops, you already noticed this, ah well)

I have narrowed the bug down to the code that is supposed to darken the trail of your exploration, WinMain:6515-6520. If I comment those out, the fading doesn't happen.

It's probably related to other state not being right, though.

@verhoevenv

This comment has been minimized.

Copy link
Owner

commented Oct 23, 2014

I'm also going to guess something is wrong in Engine::System_SetRenderTarget, because the only place you use it is for the maps and the screenshots, and in both cases something is rather off when combined with blending (more evidence in the screenshots of the credits screen).

It's hard to understand, though.

@Enet4

This comment has been minimized.

Copy link
Contributor Author

commented Oct 24, 2014

Those are good findings, though! Are there any other side effects to commenting that part of the code?

@verhoevenv

This comment has been minimized.

Copy link
Owner

commented Oct 25, 2014

Render-to-texture is implemented as kind of a huge hack, because plain SDL 1.2 doesn't easily give access to framebuffer objects and all.
What we do when we switch rendering target:

  • copy the current color buffer to a texture so we can resume working on it later (or use it as texture)
  • clear the color buffer and reinitilize
  • copy the target texture to the color buffer
    This only works because we have double buffering and because the last render target is always the screen.

The bug occurs because the current color buffer was not cleared properly, and because rendering was done using blending which I think is inappropriate when making 1-to-1 copies to/from the coor buffer.

The effect was that the color buffers began to blend in the lower left corner, because that's where the textures where constructed, the origin being the lower left corner.

Screenshots of the credits screen were also suffering from this. The screenshot was taken using render-to-target, and there's also a hack about textures needing flipping involved. Because screenshots are the same size as the window, the entire buffer got blended.
It only affects the credit screen, I think, because it is explicitly rendered with blending.

@verhoevenv verhoevenv modified the milestone: v1.0 Jan 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.