Jump to content

skybox fog calculations wrong


klepto2
 Share

Go to solution Solved by Josh,

Recommended Posts

When using the skybox together with the angular fog you get artifacts in the corners like this:

image.thumb.png.30f16131c7bfd8cca03241fcacac0c2b.png

This can be fixed with something like this in the sky.frag:

	if (ExtractCameraFogSettings(CameraID, fogcolor, fogrange, fogangle))
		{
			float slope = degrees(asin(normalize(texCoords).y));
			if (slope < fogangle.y)
			{
				float l = clamp(1.0f - ((slope - fogangle.x) / (fogangle.y - fogangle.x)), 0.0f, 1.0f) * fogcolor.a;
				outColor[0].rgb = outColor[0].rgb * (1.0f - l) + fogcolor.rgb * l;
			}
		}

just normalize the texcoords before calculating the slope:

image.thumb.png.7fbb99cbb5eee8349164885cbe619fb7.png

  • Thanks 1
  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...