Injecting SMAA in No Man's Sky

  • Daemonjax
  • Topic Author
More
7 years 8 months ago - 7 years 8 months ago #1 by Daemonjax Injecting SMAA in No Man's Sky was created by Daemonjax
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: 7 years 8 months ago by Daemonjax.

Please Log in or Create an account to join the conversation.

  • crosire
More
7 years 8 months ago #2 by crosire Replied by crosire on topic Injecting SMAA in No Man's Sky
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.

Please Log in or Create an account to join the conversation.

  • Daemonjax
  • Topic Author
More
7 years 8 months ago - 7 years 8 months ago #3 by Daemonjax Replied by Daemonjax on topic Injecting SMAA in No Man's Sky
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: 7 years 8 months ago by Daemonjax.

Please Log in or Create an account to join the conversation.

  • Annihlator
More
7 years 8 months ago - 7 years 8 months ago #4 by Annihlator Replied by Annihlator on topic Injecting SMAA in No Man's Sky
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: 7 years 8 months ago by Annihlator.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.