[SOLVED] Skybox will clip model?

I created a demo: http://jsbin.com/husoxas/20/edit?js,output

When the camera move far away, the model will be clipped.

It is not related to the farClip property, as I’ve set it to 100000. Here is the code:

camera.addComponent('camera', {
    clearColor: new pc.Color(0.1, 0.2, 0.3),
    nearClip: 0.01,
    farClip: 100000

I also found that when I remove the skybox, every thing is ok. You can comment the following line to see the result:

app.setSkybox(cubemap); // comment this line

I have no idea about this issue…:joy:

1 Like

I know how to solve this issue now.

Solution 1:
From the information of Is units different between engine and editor?, the model’s unit is incorrect. Regenerate the model json file, and make sure its unit is meter.

Solution 2:
It seems there is a limitation of the range of nearClip and farClip. In my case, 0.01 ~ 100000 is too large, so adjust them will work. I’ve tested on 100 ~ 100000, it works fine. See http://jsbin.com/husoxas/25/edit?js,output.

Ah of course, the depth buffer only has so much accuracy… You must have been blowing the limits of it! Yeah the units are based on the difference between the two. If you think about it there aren’t many times when you can see from between 100m and 1000km!