Opened 11 years ago

Closed 11 years ago

#1770 closed defect (fixed)

PostProc showing really weird behaviour on Mac

Reported by: Kieran P Owned by: myconid
Priority: Release Blocker Milestone: Alpha 13
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by Kieran P)

I'm getting the following when running 0 A.D. http://i.imgur.com/RmMfe.jpg

This didn't happen during a game we had leading up to the Alpha 12 release. So whatever has changed happened after that game.

Attachments (6)

Screen Shot 2012-12-16 at 9.10.55 PM.png (437.0 KB ) - added by Kieran P 11 years ago.
Alpha_12_on_OSX_10_8_2_HD5670.png (465.1 KB ) - added by Raymond 11 years ago.
Alpha_12_on_OSX_10_8_2_HD5670_all_enabled.png (449.6 KB ) - added by Raymond 11 years ago.
postfix.diff (2.5 KB ) - added by myconid 11 years ago.
postfix2.diff (3.5 KB ) - added by myconid 11 years ago.
bloom.fs (888 bytes ) - added by myconid 11 years ago.

Download all attachments as: .zip

Change History (42)

by Raymond, 11 years ago

comment:1 by Raymond, 11 years ago

Works great on:

OS X 10.8.2 on a AMD HD 5670

see screenshot

Last edited 11 years ago by Raymond (previous) (diff)

in reply to:  description comment:2 by historic_bruno, 11 years ago

Replying to k776:

See attached file.

Which package?

comment:3 by myconid, 11 years ago

Need more info. Which map? What config?

comment:4 by myconid, 11 years ago

Hold on. This is because of historic_bruno's patch for #1768.

comment:5 by myconid, 11 years ago

Right, need more info. Is this with postproc on or off?

in reply to:  1 comment:6 by historic_bruno, 11 years ago

Replying to raymond:

Works great on:

OS X 10.8.2 on a AMD HD 5670

see screenshot

Your config doesn't appear to have shadows enabled, let alone more advanced GLSL stuff, is that by choice?

comment:7 by Raymond, 11 years ago

so now I enabled all settings, no problems (12 out of 13 settings are enable in settings, except Developer Overlay)

map: Acropolis I

Last edited 11 years ago by Raymond (previous) (diff)

comment:8 by historic_bruno, 11 years ago

Ok thanks, good to know :) That's using the 64-bit bundle?

in reply to:  8 comment:9 by Raymond, 11 years ago

Replying to historic_bruno:

Ok thanks, good to know :) That's using the 64-bit bundle?

yes, of cause.

comment:10 by Kieran P, 11 years ago

This is the Mac package Ben built, which includes the patch he made recently, yes.

Here is my local.cfg. The map was the default one I believe (Acropolis 1).

windowed = true
xres = 1280
yres = 700
pauseonfocusloss = false

playername = "k776"

waternormals = true
waterbinormals = true
waterrealdepth = true
waterfoam = true
watercoastalwaves = true
waterrefraction = true
waterreflection = true
watershadows = true

showsky = true

renderpath = shader
preferglsl = true
gentangents = true
gpuskinning = true
smoothlos = true
postproc = true

materialmgr.quality = 10.0
materialmgr.PARALLAX_DIST.max = 150
materialmgr.PARALLAX_HQ_DIST.max = 75
materialmgr.PARALLAX_VHQ_DIST.max = 0

forcealphatest = false

hotkey.profile.toggle = "Alt+P"

The issue isn't prevent on the SVN copy of 0 A.D., so this may be related to Ben's patch, or something to do with the package picking up textures maybe?

comment:11 by Kieran P, 11 years ago

Milestone: Alpha 12Alpha 13

Issue is still present in 32bit build but release is done, so we'll reupload fixed package later. Pushing to Alpha 13.

comment:12 by Kieran P, 11 years ago

Description: modified (diff)
Summary: Mac package showing really weird behaviour (not present in SVN)PostProc showing really weird behaviour on Mac

comment:13 by Kieran P, 11 years ago

Cc: myconid added

@myconid: cc'ing you in. Getting this weird behaviour: http://i.imgur.com/RmMfe.jpg

It only shows up when postproc setting is enabled in the config. Everything else off, and only postproc on, this issue still occurs.

I've done a complete rebuild (clean-workspaces and update-workspaces) and the issue hasn't gone away.

I've just reverted to the same revision that I played on with historic_bruno and Pureon, and the issue exists in that.

Which makes me think it might be some type of software/graphics update I've applied to the system through Apple's automatic updates. I'll try and track down if I installed anything recently. Till then, any steps I can do to help track down the issue?

comment:14 by Kieran P, 11 years ago

I've also just tried deleting the cache (~/Libraries/Caches/0ad) which had no effect, the issue as seen at ​http://i.imgur.com/RmMfe.jpg still exists after rolling back to a last know working revision, doing a complete rebuild, and clearing the cache.

The only recent updates to my Mac system have been an iTunes update and a Digital Camera Compatibility update. Neither should have affected the game.

I also installed AoK recently using a Wineskin (http://wineskin.urgesoftware.com/tiki-index.php) which may have done something, but shouldn't have since it should be pretty self contained.

I'm out of ideas :-(

comment:15 by myconid, 11 years ago

I think I've figured out what the problem is. The postproc renders to NPOT textures (to save memory), but calculates bloom by generating mipmaps (to take advantage of hardware filtering). While both features are very portable, it looks like the combination can have issues on some buggy/older drivers/hardware. I'll just get rid of the NPOT textures.

comment:16 by Kieran P, 11 years ago

Any idea what would have changed in past the few days to cause this? I played a game with the same settings late last week with no problems. Only occurred recently, and can't see any recent commits that changes the postproc...

comment:17 by myconid, 11 years ago

Maybe someone added a postproc effect to the map you were playing on.

comment:18 by myconid, 11 years ago

A quick idea: can you please remove the following lines from PostprocManager.cpp (189-193) and recompile

	glBindTexture(GL_TEXTURE_2D, renderedTex);
	pglGenerateMipmapEXT(GL_TEXTURE_2D);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glBindTexture(GL_TEXTURE_2D, 0);

This removes the hardware filtering, but in theory it should take care of the issue you encountered.

comment:19 by Kieran P, 11 years ago

Negative. Commenting out those lines and recompiling did not fix the issue.

comment:20 by Kieran P, 11 years ago

If it's any help, when I try the map we played last week (Boeotian Plains), that one works fine. So do a few other ones. Most of the Acropolis maps display the issue though. So what is Acropolis 1 doing that Boeotian Plains aren't?

comment:21 by Kieran P, 11 years ago

With help from leper, managed to track it down to this setting in the affected maps:

<PostEffect>hdr</PostEffect>

When commented out, maps with that line return to normal. So the issue lies in HDR...(?).

comment:22 by myconid, 11 years ago

I'm sure the issue is somewhere in the bloom code (included in the "hdr" effect).

First I'd like to know if this still occurs with POT-sized textures. Try changing the config so the game runs in windowed mode, with a square resolution (e.g. 1024x1024 or 512x512).

A separate thing I'd like you to try is to edit shaders/effects/HQDOF.xml to remove this line

<pass shader="glsl/hdr"/>

then open the "Campaign Test Map" and let me know if you still get the issue.

comment:23 by Kieran P, 11 years ago

Tried 1024x1024 and had the same issue. Removed the glsl/hdr pass line, same issue. Tried 1024x1024 with removed <pass /> line and still had the issue. Any more ideas?

by myconid, 11 years ago

Attachment: postfix.diff added

comment:24 by myconid, 11 years ago

"patch -p1 -i postfix.diff" in 0ad root directory. Messes a little with the way the results are transferred from the postproc framebuffer to the system framebuffer. I'll be surprised if this fixes it, but it's worth a shot.

Also, this unanswered question looks like the same issue.

comment:25 by Kieran P, 11 years ago

Reverted the previous made changes, and applied that patch and the problem still exists. :-(

by myconid, 11 years ago

Attachment: postfix2.diff added

comment:26 by myconid, 11 years ago

Ok, last attempt for now. Revert changes and apply as before.

comment:27 by Kieran P, 11 years ago

Negative. Still getting the issue with postfix2.diff :-(

comment:28 by historic_bruno, 11 years ago

For what it's worth, Apple's software renderer supports GLSL and actually looks pretty good with postproc off (though it's painfully slow). With postproc on, I get similar problems to k776. So I can help with testing, if there's anything I can do.

by myconid, 11 years ago

Attachment: bloom.fs added

comment:29 by myconid, 11 years ago

It turns out that Apple's software renderer is actually Mesa's FOSS software renderer (thanks for the idea, historic), so I installed a VM with software GL and thus managed to reproduce the problem.

And, as I already suspected, the problem was with the bloom calculation! Put bloom.fs in shaders/glsl and hopefully the problem should be fixed now.

comment:30 by historic_bruno, 11 years ago

Works for me, nice job! Hope it works for k776 as well

comment:31 by Kieran P, 11 years ago

Indeed. It did fix the issue. The bloom is a lot on Acropolis 1. The starting units are almost a white haze because it's too bright. Michael should tweak that a bit... But as far as the rendering issues I got go, awesome work fixing it. Thank you.

comment:32 by myconid, 11 years ago

Great. :)

As for the bloom being too much, it's because I changed the bloom calculation. I'll also tweak the "hdr" shader to tone it down before committing.

comment:33 by historic_bruno, 11 years ago

Cc: myconid removed
Owner: changed from historic_bruno to myconid

comment:34 by Kieran P, 11 years ago

myconid, where is this at? Replacing bloom.fs worked a treat, but it's still overly bright on any map that uses it.

comment:35 by myconid, 11 years ago

Okay, it's committed... though I must say I'm not too happy with how this bloom looks.

comment:36 by historic_bruno, 11 years ago

Resolution: fixed
Status: newclosed

I believe this is fixed now, perhaps some maps need their bloom values tweaked, but that's not high priority.

Note: See TracTickets for help on using tickets.