# stalef

Member

88

607 Good

• Rank
Member
1. ## Clipping on a wavy surface

If you can sample the water height in the reflection pass fragment shader (easy if you are using a heightmap for the surface) you can discard the fragment if it is below water.

What about the range of your cascades? You write you are using {0.001,10},{0.001,50} and {0.001,100}. They all start at 0.001. You should have some overlap, but currently they all start at the same distance. This is not needed, and you will also get z-buffer precission problems / z-fighting.

4. ## Jittering near a landscape.

Floats have better precision on small values. One solution is to divide your terrain into tiles, and center vertices for each tile to 0. Each tile have their own coordinate frame and will require separate model matrices. When the camera is close to a tile, the vertices in camera space will have small values and precision should be acceptable. At greater camera distance the precision will get worse, but less noticeable. The trick then is to do all matrix calculations with doubles, and only convert to single precision in the end. Do not send model and view matrices as two separate matrices to the shader and multiply in the shader. Calculate model-view matrix using double precision on the CPU, then upload final matrix to shader as single precision.
5. ## Help with Smooth Gradient on Skydome

Instead of using vertex colors, a fragment shader can easily calculate azimuth/zenith angle of each pixel, and based on those angles you could use math or texture sampling to get the color you want.   By doing this stuff in the fragment shader, the acutal geometry of the skydome/box in not very important as long as the geometry you do use will cover the parts of the screen the sky is covering.

but I want to ask is there any other more simple (just using matrices without swapping y and z vertices) way to load scene correctly?   A rotation matrix that rotates 90 degrees on the x-axis will flip y/z coordinates.

8. ## Trying to get rid of all the deprecated stuff

This site helped me alot when I also wanted to do more modern OpenGL: http://nopper.tv/opengl.html
9. ## How is a view matrix computed?

http://glprogramming.com/red/appendixf.html (Bottom of page)
10. ## Texture Atlas seam issue.

Have you concidered using a texture array instead?
11. ## HDR: practical use in a game

Also make sure you compensate for gamma, and do your light calculations in linear space.
12. ## GLSL edit texture and save it

You can not do it like you have in your example. You need to set up an FBO with multiple render targets, and bind your editedMap as one of the targets.
13. ## gravitation question

Quote:Original post by Echkard g = G(m1)(m2) / r^2 I think your divide by r^2 is not the radius of the planet, but the distance between them. So, if you double the distance, the gravitational pull should be divided by four.
14. ## gravitation question

If you double the radius if a sphere, the volume (and the mass) should be multiplied by 8... (Volume of a sphere is (4/3) * PI * r^3 )