0
votes

I have a particle system for creating "nebulas" in a 2D space game. The results are looking pretty good, except there's a rendering/shader issue with what I'm doing. In game I see a rather ugly tiered blending, almost like I'm looking at 6-bit color rendering (exaggerating for clarity).

In-game with ugly tiered blending

Looking at it in unity's scene view, it's nice and smooth (the few "artifacts" are part of the source image used for the particle. It looks exactly as I would hope):

Smooth blending in scene view

Is there a way to fix this issue? And for curiosity and posterity's sake, why does this happen?

A few specifics:

It's Unity 2018.1.0f2, Windows 10, GTX 1050 ti. There are multiple particles overlapping in that image (I'd guess around 10?), One particle system. the shader is unity's provided Particles/Additive, and I get the same results with Particles/Additive (Soft), Particles/Alpha Blended, and a number of other built in transparent shaders I've tried. The material has alpha = 77 and the particle system adds in alpha = 16 (I believe that's cumulative). The base image is white and transparent. The alpha channel is what defines the actual shape. Color is added with the particle system (resulting in each particle having a different color, even though they all use the same base image).

Edit:

Did some more experimentation, the problem occurs in game (build or in editor) and also in the scene view if not play-testing. I tried reducing the particle count; even single particles (no other overlapping transparent objects/particles) still have the issue. I also experimented with putting all of the transparency control in the particle system or the material, and tried putting both at 255 alpha and using the brightness to control opacity (it's an additive shader), and still no improvement.

I did figure out why the camera and scene view rendered differently. The Camera had "Allow HDR" checked. After unchecking that, the scene view looks identical to the camera's rendering (too bad it didn't go the other way). Perhaps looking into HDR farther will yield answers...

1
Could it be caused by low Quality Settings?Nathalia Soragge
@NathaliaSoragge I wouldn't think so. I'm running with quality set to Fantastic, and dropping the quality setting doesn't have any effect. Also I'm using unity's default settings for quality and graphics.Semimono

1 Answers

0
votes

Alright, I've done some experimentation, and I'm beginning to think this is actually a problem with computer displays/graphics cards/color profiles. I took the image in gimp, zoomed in on a part where there was visible stair-stepping in color, and took some color samples at the edges of different color gradients. Here are the color samples I took, from lighter to darker gradients.

G1 43 48 17 (next to G2) G2 43 47 17 (next to G1) G2 39 46 16 (next to G3) G3 38 45 16 (next to G2) G3 36 44 16 (next to G4)

What you'll note is that there is substantial difference in RGB value within a gradient, but even zoomed in to where I could fit four pixels on the screen, I couldn't see any pixel outlines within a gradient, but it was very obvious at the edge of the gradient. Either there's something funky with my eyes, or the screen is doing a poor reproduction of the colors. I've tested this on three screens, a cheap HP laptop, a 27" Acer monitor, and a MackBook Pro, all have the same effect.

Also interesting to note, the effect is present even on the brighter image, it's just less noticeable. I'm thinking that unity has absolutely zero to do with this effect, and it's more of a hardware issue (or like, gamma settings in the video drivers).

I'd still be curious if anyone else knows anything more on this topic.