N8python / n8ao

An efficient and visually pleasing implementation of SSAO with an emphasis on temporal stability and artist control.
Creative Commons Zero v1.0 Universal
371 stars 13 forks source link

hi, I'm here again... I found that an object that is very far away from the camera turns black.... #14

Closed liuyehua closed 1 year ago

liuyehua commented 1 year ago

I am developing a mapping software based on an open source project (https://github.com/tentone/geo-three) , I found When the height of my camera reaches a certain height, some of the map tiles will start to turn black, and eventually all tiles will turn black, but the sky.js background is not affected, i dont know what happened...

normal

image

add ao

image
liuyehua commented 1 year ago
image
N8python commented 1 year ago

I have... no idea what could be causing this.. How far away are those tiles from the camera in world-units.

liuyehua commented 1 year ago

I have... no idea what could be causing this.. How far away are those tiles from the camera in world-units.

image

I tried to look down from the vertical direction, and when the camera height was around 3360000, the map tiles began to hover on the blackened edge...

N8python commented 1 year ago

could you perhaps send me a .zip of your project? so i could debug it myself?

liuyehua commented 1 year ago

I have... no idea what could be causing this.. How far away are those tiles from the camera in world-units.

I have found the problem, and this problem occurs when I turn on the logarithmicDepthBuffer...

liuyehua commented 1 year ago

could you perhaps send me a .zip of your project? so i could debug it myself? I am so sorry,This is not my personal project, it's a project of my company, I'm just working for it... The problem lies in the logiarithmicDepthBuffer, can you roughly guess what the reason is? If I don't turn on this, AO is normal, but if I don't turn on this, objects in my scene will flicker...

liuyehua commented 1 year ago

I have observed some useful phenomena, when I set camera near number more big , The later the black tiles appear, May this be an accuracy issue caused by the large difference between camera far and near...

N8python commented 1 year ago

Intriguing... log depth buffer probably relies on very high-precision math that breaks down at larger scales.

N8python commented 1 year ago

Did you try subdividing your plane - it could be that the depth-interpolation math breaks down at such large scales.

liuyehua commented 1 year ago

Did you try subdividing your plane - it could be that the depth-interpolation math breaks down at such large scales.

the map tiles is replies quad tree... The solution I am thinking of now is to dynamically change the near of the camera when the lens is zoomed out

N8python commented 1 year ago

I could also just disable AO entirely when the distance is too large... I don't know.

liuyehua commented 1 year ago

I could also just disable AO entirely when the distance is too large... I don't know.

yes that's a good way too😀

liuyehua commented 1 year ago

I could also just disable AO entirely when the distance is too large... I don't know.

Now I am wondering why sky.js is not affected. .

N8python commented 1 year ago

Cuz I have a special piece of code to exclude the sky from AO - I could also do that with things that are very, very far away.

liuyehua commented 1 year ago

Cuz I have a special piece of code to exclude the sky from AO - I could also do that with things that are very, very far away.

So can your AO plug-in set a threshold uniform, allowing users to decide how far away the distance AO will no longer take effect. . .

N8python commented 1 year ago

I'm thinking about that... though it appears the issue is w/ large triangles in general, so I don't know.

N8python commented 1 year ago

Pushed a possible fix. Let me know if it works - try version 1.6.7.

liuyehua commented 1 year ago

Pushed a possible fix. Let me know if it works - try version 1.6.7.

very nice,it works!!!, Thank you very much for your contribution

image
N8python commented 1 year ago

I'm so happy it works!