Welcome, Guest.
Username: Password: Remember me

TOPIC: Injecting SMAA in No Man's Sky

Injecting SMAA in No Man's Sky 3 months 2 weeks ago #1

So, when I try to inject SMAA in No Man's Sky (opengl 64 bit) I end up with a very dark image... and constant flickering/strobing. It looks like maybe the SMAA shader needs the screen image to be in a certain color format, but it isn't, so it messes up the gamma somehow? Totally guessing. Not even sure if what I said makes real world sense. I can't explain the flickering/strobing, either.

I think engine uses deferred shading/rendering, if that matters. I didn't think that it would.

All other shaders (that I tried) seem to work fine, including fxaa.
Any ideas?

EDIT: Ahh... might be related to:
reshade.me/forum/shader-troubleshooting/...king-in-no-man-s-sky
reshade.me/forum/troubleshooting/938-the...on-dark-athena#12157
EDIT2: Ehhh... maybe not, since it happens even when smaa is the only shader injected, so it should be related to the number of samplers. Unless I'm wrong, and smaa uses a bunch of samplers.
EDIT3: It doesn't.
Last Edit: 3 months 2 weeks ago by Daemonjax.
The administrator has disabled public write access.

Injecting SMAA in No Man's Sky 3 months 2 weeks ago #2

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2452
  • Thank you received: 1391
SMAA is one of the few shaders working in linear color space, so it converts the color data using SRGB texture views. Those aren't properly implemented in some drivers in which case the conversion does not occur and you end up with calculations in the wrong color space which yields very dark or very bright results. So either it is this, or it is the sampler issue. But while SMAA uses some, it does not use 8.
Cheers, crosire =)
The administrator has disabled public write access.

Injecting SMAA in No Man's Sky 3 months 2 weeks ago #3

Thanks for the reply.

Further testing using just the curves shader causes strobing/flickering in certain scenes in NMS, but only aboard the space stations when talking to aliens. In those situations, the engine creates black borders on the top and bottom of the screen to make it look cinematic. While that's happening, I get the same flickering/strobing as when SMAA is enabled without the darkening issue (or at least I don't notice the darkening).

But, yeah, I guess it's just the way it is. Using 16.8.2 AMD drivers, so maybe the next version will fix it.
Last Edit: 3 months 2 weeks ago by Daemonjax.
The administrator has disabled public write access.

Injecting SMAA in No Man's Sky 3 months 2 weeks ago #4

I'm working on fixing the problems related to the SMAA shader for NMS with Radeon (R9-290x here) for the beta version of catalyst.

The issue seems to be related to the following:
Currently SMAA seems to assume it only needs to convert from Linear to SRGB when piggybacked.
It turns out however (for me) that replacing the conversion line to just after the if-statement (immediately before the return statement) the space seems correct.

The following goes for the SMAAWrap.h file
Basically edit the last few lines so it'll be like:


Edit; Forgot to mention:
I am planning to double-check the effects of this modification using my laptop (which has an nVidia-chip) to see if it's an AMD-thing, or something else.
#else
	float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).rgb;
			
	#ifdef Shared_Piggyback_SMAA
		color.rgb = (color.rgb <= 0.0031308) ? saturate(abs(color.rgb) * 12.92) : 1.055 * saturate(pow(abs(color.rgb), 1.0/2.4 )) - 0.055; // Linear to SRGB
			
		color.rgb = SharedPass(texcoord, float4(color.rgbb)).rgb;
		#else
			color.rgb = (color.rgb <= 0.0031308) ? saturate(abs(color.rgb) * 12.92) : 1.055 * saturate(pow(abs(color.rgb), 1.0/2.4 )) - 0.055; // Linear to SRGB
		#endif
			
			
		return color.OUTPUT_COMPONENT3;
			
    #endif

However It's bound to wrongly convert the space in *some* cases, it works for our specific case.


Another problem I'm running into (I'll probably have to make another topic on this one. Though thought i'd tuck it in here, because It's related to SMAA for NMS)
is that I can't seem to access the depth-buffer.
Thus far, whatever I've tried, the depth-buffer is all-black as soon as the splash-screens have finished...
Last Edit: 3 months 2 weeks ago by Annihlator.
The administrator has disabled public write access.