migueltk's picture

OpenTK + Terrain Splatting

This project is a viewer of terrains created by the software "EarthSculptor" using "Terrain Splatting" technique . The rendering uses the brute-force and GLSL shader. The source code is available here.

The first image shows terrain rendering with EarthSculptor,

Renderer with EarthSculptor

the following picture shows the same terrain rendered with OpenTK.

Renderer with OpenTK

I also include the basic code of a circular manipulator for the more restless. This manipulator is operated by the keypad.Perhaps someone in the future implement a terrain editor!Everything is possible.

Regards, ...

Miguel


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
migueltk's picture

The origin of all this, here.

ebnf's picture

Looks very close, great job!

I think the original has more gamma correction, the cracks in the rock are more pronounced and so is the color saturation, should be an easy tweak.

I really like those style manipulators for rugged environments, keyboard buttons keeps together better than mouse-style pointers.

migueltk's picture

Thanks for your support ...

The use of shaders is still something magical for me, any improvement or correction will be very welcome.

Norris's picture

Hi Miguel !
I try to implement approximately the same thing, without splatting for the moment. I have a question.
I think you use the original heightmap size of 257 pixels ? So, how do you create your terrain grid ? Is it also the same grid resolution (256x256 vertices (257-1)) ? Or do you use a custom resolution and interpolate values between heights ?
It's in case you use a grid of squares obviously ... maybe you use another technique ?

I ask this question because I use the first described technique, and my terrain seems very ... "3d pixelated" (I don't know how to say that)

terrain test 1

here in more high definition: highDef

heeeuuuu ... sorry for my bad english !

migueltk's picture

Hi Norris

In sending you the attached PDF I am preparing documentation but I could not finish because of time. It's in Spanish but most importantly you translate and you can see the explanatory drawings.

As you can see in figure 1, for an area of ​​4x4 chunks need bitmap 5x5 pixels. For each pass through the inner loop computes the position of the upper left point of the chunk in the row in question. For the first iteration would be the point 0, followed by the 1, 2, 3, and 4, as shown in the illustration above. For the second iteration would be 5, 6, 7, 8, 9 and so on.

As an optimization triangles are also generated in the inner loop. When constructing the triangles (two per chunk constructed) should avoid this construction triangles for both the last chunk of each row to the last row. The code that does this is if (Contz

migueltk's picture

For some reason the full text shown above? ...

Hi Norris
 
In sending you the attached PDF I am preparing documentation but I could not finish because of time. It's in Spanish but most importantly you translate and you can see the explanatory drawings. <a href="https://sites.google.com/site/bitiopia/Terrain-Heightmap.pdf?attredirects=0&d=1" title="Terrain-pdf-file"></a>
 
As you can see in figure 1, for an area of ​​4x4 chunks need bitmap 5x5 pixels. For each pass through the inner loop computes the position of the upper left point of the chunk in the row in question. For the first iteration would be the point 0, followed by the 1, 2, 3, and 4, as shown in the illustration above. For the second iteration would be 5, 6, 7, 8, 9 and so on.
 
As an optimization triangles are also generated in the inner loop. When constructing the triangles (two per chunk constructed) should avoid this construction triangles for both the last chunk of each row to the last row. The code that does this is if (Contz <totalChunksZ && contX <totalChunksX).
 
For each chunk two triangles are constructed, (i1, i2, i4) y (i2, i3, i4).
 
To avoid "3d pixelation" try to change the order of the indexes of the triangles for each chunk, for example, for drawing three triangles are created (i1, i2, i4) and (i2, i3, i4), to change indexes are created (i1, i2, i3) and (i3, i4, i1).
 
Yet I fear that EarthSculptor use any smoothing technique that softens the ground even more.
 
I hope you serve something ...
 
regards