Jump to content

Skybox clipped by higher camera near range


klepto2
 Share

Go to solution Solved by Josh,

Recommended Posts

if you set the near range of a camera > 0.3 the skybox get clipped by the frustum and if > 0.5 it is not visible at all. 

 image.thumb.png.48962879aa8d402a03ddb94603ace76a.png

  • Thanks 1
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

  • Solution

Easy shader fix in Sky.vert

void main()
{
	texCoords = normalize(VertexPosition.xyz);
	mat4 cameraMatrix = ExtractEntityMatrix(CameraID);
	vec4 pos = VertexPosition;
	pos.xyz *= CameraRange.x + (CameraRange.y - CameraRange.x) * 0.5f;
	pos.xyz += cameraMatrix[3].xyz;
	gl_Position = CameraProjectionViewMatrix * pos;
	gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5f;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

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...