gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.51k stars 779 forks source link

Some questions about triton ocean in osgearth #1594

Closed cll131421 closed 4 years ago

cll131421 commented 4 years ago

Recent projects require the use of triton library to achieve marine effects When I use osgearth to load triton, there are some problems. It may not be a bug, but a problem with my own use. I use the code in Sample osgearth_triton, the sample that comes with osgearth, and the loaded data file is triton_drop_shader.earth The generated ocean effect is perfect from a distance, but when I zoomed in, some undesirable things happened. It looked like a piece of area, the dividing line was very obvious, and one side was the ocean. One side is an image of land. When I move the position of the camera, the boundary line will also change randomly. In most cases, land will become ocean. image image (1) image (2)

In addition, the scope of ocean rendering also has a certain deviation, and there are also obvious dividing lines. The strangest thing is that when I am at a certain height, when the camera's field of view height is changed slightly, I will get completely different rendering results, as shown in the figure: Now the height of our camera is slightly higher image (3)

When I lower the camera height slightly image (4)

There will be such a scene image (5)

I found some methods on the Internet, using osgearth's LogarithmicDepthBuffer, and copying the shader files in the osgearth_triton directory to the triton resources directory The console prompts that an error is reported when loading the glsl file. After modifying the configuration file of triton, more detailed error information is obtained:

TRITON: GLSL error detected in: user-vert-functions.glsl

TRITON: 0(98): error C7532: global function inverse requires "#version 140" or later 0(98): error C0000: ... or #extension GL_ARB_gpu_shader5: enable ----This problem can be solved by putting #extension GL_ARB_gpu_shader5: enable in the first line

GLSL error detected in: user-vert-functions.glsl TRITON: Failed to link shader program for OpenGL. TRITON: GLSL error detected in: user-vert-functions.glsl

TRITON: 0(284): error C1038: declaration of "trit_projection" conflicts with previous declaration at 0(41) 0(292): error C7011: implicit cast from "f64mat4" to "mat4"

GLSL error detected in: user-vert-functions.glsl TRITON: Failed to link shader program for OpenGL.

I'm sorry I don't know anything about shader programming If anyone can provide usable examples, I would be very grateful. Or suggest a possible solution, ingredients thanks!

gwaldron commented 4 years ago

Looks like you solved the first error. Did you try replacing the "trit_projection" declaration with this? uniform f64mat4 trit_projection;

cll131421 commented 4 years ago

Looks like you solved the first error. Did you try replacing the "trit_projection" declaration with this? `uniform f64mat4 trit_projection;

The latest development is adding #extension GL_ARB_gpu_shader5: enable to the first line of user-vert-functions.glsl, glsl no longer reports an error, but the rendered effect is still unchanged, and the rendering effect of the ship seems to be out. The problem is as follows: image It looks like the boat is translucent, and the boat can only be seen correctly on a horizontal surface. The effect is as follows: image The rendering effect near the coastline is still wrong, the effect is as follows: image image When the camera moves near the coastline, the effect is as follows: image image image image image image What should I do to optimize the rendering of the ocean and fix the wrong results near the coastline? Ask you for advice on a feasible solution, thank you very much Seek help!

cll131421 commented 4 years ago

The ocean rendering effect I want to achieve is as follows: 2018-12-25_164358 If anyone can provide usable example code or point to a feasible solution, I would like to express my great thanks The link to the effect is as follows: http://forum.osgearth.org/Osgearth-with-triton-problem-td7592283.html On the second floor said. I fixed this problem. The problem is LogZBuffer of Triton. We need to apply logz to Triton camera. What should I do? Can someone give me some advice? It would be nice to have sample code

cll131421 commented 4 years ago

This problem is solved, the main reason is that the elevation data used is problematic. Triton requires that the depth data of the ocean is also smooth and gradual in order to render perfect results. The problem was solved after I changed my elevation data.

Mario-Yao commented 1 year ago

I have encountered the same problem as you. Could you please tell me how to adjust the ocean elevation data? Thank you very much!

cll131421 commented 1 year ago

You need a smoother elevation data

At 2023-07-10 16:36:06, "Mario-Yao" @.***> wrote:

I have encountered the same problem as you. Could you please tell me how to adjust the ocean elevation data? Thank you very much!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

Mario-Yao commented 1 year ago

You need a smoother elevation data At 2023-07-10 16:36:06, "Mario-Yao" @.> wrote: I have encountered the same problem as you. Could you please tell me how to adjust the ocean elevation data? Thank you very much! — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.>

Is it to find smoother elevation data directly? Where did you get such high quality data? Some of the data we have found so far have some problems with the ocean elevation. Or do you have a way to smooth out the elevation data? Thank you very much!

cll131421 commented 1 year ago

I have no idea to smooth out the elevation data. The point of the elevation data is the elevatin should be smooth,like 1.0 2.0 3.0 4.0 The data like 1.0 1.0 1.0 10.0 10.0 10.0 is not available for us.

At 2023-07-11 14:30:47, "Mario-Yao" @.***> wrote:

You need a smoother elevation data At 2023-07-10 16:36:06, "Mario-Yao" @.> wrote: I have encountered the same problem as you. Could you please tell me how to adjust the ocean elevation data? Thank you very much! — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.>

Is it to find smoother elevation data directly? Where did you get such high quality data? Some of the data we have found so far have some problems with the ocean elevation. Or do you have a way to smooth out the elevation data? Thank you very much!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

Mario-Yao commented 1 year ago

I have no idea to smooth out the elevation data. The point of the elevation data is the elevatin should be smooth,like 1.0 2.0 3.0 4.0 The data like 1.0 1.0 1.0 10.0 10.0 10.0 is not available for us. At 2023-07-11 14:30:47, "Mario-Yao" @.> wrote: You need a smoother elevation data At 2023-07-10 16:36:06, "Mario-Yao" @.> wrote: I have encountered the same problem as you. Could you please tell me how to adjust the ocean elevation data? Thank you very much! — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.> Is it to find smoother elevation data directly? Where did you get such high quality data? Some of the data we have found so far have some problems with the ocean elevation. Or do you have a way to smooth out the elevation data? Thank you very much! — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.>

Ok, thank you for your reply!