Shifting hue with the HLS shader produces terrible artifacts

Bugs will be moved here once resolved.

Post » Wed Jan 07, 2015 1:58 pm

Problem Description
I have a clean, artifact-less sprite with a pure red color. Shifting hue with the HLS shader shows a clean, usable result in the editor:
Editor.PNG

But terrible artifacts at runtime:
Chrome.PNG


Attach a Capx
HLSLookingBad.capx


Description of Capx
Uses the HLS shader to shift HUE of a red sprite by 75% or more.

Steps to Reproduce Bug
Just run the capx. From what I hear other users get that as well.

Observed Result
At runtime terrible artifacts appear.

Expected Result
Clean, usable result, just like the editor.

Affected Browsers
  • Chrome: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
Windows 7, 64 bit - SP1
NVIDIA GeForce GT 640/PCIe/SSE2 (Shader language 4.50 NVIDIA)
Latest driver - 347.09

Construct 2 Version ID
r193
You do not have the required permissions to view the files attached to this post.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Fri Jan 09, 2015 2:59 pm

I can now add to this that strangely it adds artifacts on positive adjustments and doesn't on negative adjustments - i.e. if we add 75% to a red sprite it goes ugly as sin, but -25% looks clean and proper.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Fri Jan 09, 2015 5:55 pm

I don't know what we can do about this - as far as I can tell we use the standard math for HSL adjustments, and this looks like some kind of floating point rounding errors are happening on the GPU. I tried improving the float precision but it didn't have any effect. So I'm afraid this is has to be closed as it's just an artefact of the GPU processing.
Scirra Founder
B
403
S
238
G
89
Posts: 24,653
Reputation: 196,143

Post » Fri Jan 09, 2015 6:08 pm

Well, why doesn't it happen in the editor then? And why it doesn't happen when subtracting? There has to be a way to make it behave properly at runtime, surely. Or, perhaps, introduce a more resource intensive non-rounded version that's actually accurate? In my case it could take half a second for what it's worth, as long as the result is accurate.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Fri Jan 09, 2015 10:54 pm

@Somebody

Do you have an intel processor? If so, you could try switching to the iGPU, and see if the artifacts resolve. Did you try node-webkit? Might be worth a shot.

Maybe if you forced the software rendered mode of webgl, the effect would work correctly. I think you could do that in node-webkit by passing it the right startup argument (don't know it off the top of my head).

Of course, that can be quite slow on anything but a beast of a computer, but you might get a more accurate result. Would be worth it for StuffGen.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Jan 19, 2015 4:00 pm

Found a workaround for this - just add -100 to any hue setting, so the cycle goes backwards and everything is perfect. I'd still say this isn't normal behaviour and there's an error in there, somewhere, but at least the pinks and purples act normal.
You do not have the required permissions to view the files attached to this post.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Mon Jan 19, 2015 4:15 pm

Beautiful! That's going to make a big difference. Brilliant workaround.
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests