SFML community forums

General => SFML projects => Topic started by: Mortal on October 30, 2016, 11:50:33 pm

Title: experiment on Terrains
Post by: Mortal on October 30, 2016, 11:50:33 pm
hello

i was working on terrain lately, i'm trying to cover as much as i can on this topic which it seems, it is massive topic wasn't a best choice to lean basic opengl on this path. but i have made some progresses so far.

here i have made a demo to test opengl 4.4 features by drawing terrain with Tessellation based on nvida demonstration on Tessellation and Program Pipelines. but unfortunately, this technique has huge drawback regarding performance especially for terrain atleast on my Labtop.

the demo shows the terrain colored based on its height and dynamic cloud & lighting effects.i made it with c++/SFML.  i would like to carry on this topic to get a decent knowledge for both opengl in general and terrain in specific

demo:
http://www.youtube.com/watch?v=2iLtqPRua7s

source code: github (https://github.com/MORTAL2000/Terrain-Tessellation)
 
Title: Re: experiment on Terrains
Post by: Sub on November 01, 2016, 01:02:06 pm
That's beautiful man.  Keep it up
Title: Re: experiment on Terrains
Post by: Mortal on November 01, 2016, 11:07:42 pm
thanks Sub, i appreciate it
Title: AW: experiment on Terrains
Post by: eXpl0it3r on November 02, 2016, 09:42:54 am
Looks pretty neat! :)
Title: Re: experiment on Terrains
Post by: Tukimitzu on November 03, 2016, 03:34:16 am
Pretty cool!
Title: Re: experiment on Terrains
Post by: Mortal on November 03, 2016, 05:12:41 am
thank you guys, i'm glad that you like it.

actually, the shader (GLSL) is taken from nvidia SDK demos. they updated their SDK as well as demos with gigantic frame-work. they released it lately along with cool stuffs. but unfortunately the documents not descriptive if you aimed to lean basic modern opengl like me. :-\
Title: Re: experiment on Terrains
Post by: DarkRoku12 on November 03, 2016, 07:25:33 pm
Good lights effects.  :D ;D
Title: Re: experiment on Terrains
Post by: Hapax on November 03, 2016, 10:14:35 pm
This looks really nice. Good work :)
Title: Re: experiment on Terrains
Post by: Mortal on November 04, 2016, 02:01:46 am
Good lights effects.  :D ;D
yes it is, i have seen worst from free tutorials on youtube and else where.

This looks really nice. Good work :)
thank you Hapax,
Title: Re: experiment on Terrains
Post by: roccio on November 04, 2016, 10:55:44 am
Very nice! Thank you for sharing and will keep an eye on this!
Title: Re: experiment on Terrains
Post by: Mortal on November 04, 2016, 02:31:22 pm
Very nice! Thank you for sharing and will keep an eye on this!
you most welcome


update

i added ImGui to the project, inspired by Elias work.
Also, i added new features for testing tessellating output and terrain deformation such as changing height, noise frequency ..etc.

(http://i.imgur.com/5VXcHoL.png)


(http://i.imgur.com/ApcfwDy.png)
Title: Re: experiment on Terrains
Post by: roccio on November 04, 2016, 08:35:49 pm
It would be great to add tessellation based on distance from camera. Very good work
Title: Re: experiment on Terrains
Post by: Mortal on November 05, 2016, 01:19:34 am
It would be great to add tessellation based on distance from camera. Very good work
it does support tessellation based on distance.
from the image where the wireframe is on, i disable "auto LOD" which manged tessellation based on distance, and switch to the manual mode to test both inner/outer tessellation in GUI window.
Title: Re: experiment on Terrains
Post by: Mortal on December 14, 2016, 07:58:25 pm
work progress:

i have implemented multi-textured to the terrain.for simplicity, i used brute force to generate mesh. and i applied Diamond Square Fractal based on CPU. i've found that working with GPU is bit harder for debugging. i couldn't find any tool for my graphics card, most of debugger tools out there is specific for nvidia graphics cards. all i can do now for debugging is using transform feed back and that really annoying.

does any one know  debugger tool for Intel(R) HD Graphics 5500?

any way, here the demo for Fractal  multi-textured terrain.
http://www.youtube.com/watch?v=HzxZ-W1vLkU


source code (https://github.com/MORTAL2000/Simple-Terrain-Generator)



Title: Re: experiment on Terrains
Post by: roccio on December 15, 2016, 08:12:08 pm
Very nice work. Thank you
Title: Re: experiment on Terrains
Post by: Mortal on December 16, 2016, 02:23:59 am
you welcome roccio, i really appreciate it.

but in term of performance, the demo wasn't efficient and algorithm is a bit buggy. when i start this project wasn't in my mind to optimize it, the main goal for me was to implement diamond square algorithm in CPU side because wasn't an easy to retrieve the values from GPU for the debugging propose. after i finished the demo i saw couple of places that obviously can be optimized. for instance, i send the height data which is one dimensional array twice to GPU every frame, once with pixel buffer in HeightMap class and once with array buffer in GroundMesh class. theoretically, this is inefficient since this data will be present for every active shader better to be sent only once. also pixel buffer wasn't really necessary, i just test how to implement it, like when i start learn c++ i was wondering how to use the various of STL containers and adapters, same thing with OpenGL many buffers and textures just to allocate and store data as one dimensional array or two dimensional array in GPU.

for diamond square algorithm, it has an ugly artifacts mountain tops appear pinched, this might be fixed by using filters like blur or smooth. and from where i read about this algorithm, it suggests the seed atleast for starting corners but i haven't seen any different when i tested it, may be  a personal choice. 

i will re-visit the project once again and implement these.
Title: Re: experiment on Terrains
Post by: Mortal on December 18, 2016, 02:47:51 am
minor update to fractal demo

i added mid point displacement algorithm based on Terrain Tutorial at Lighthouse3d.com (http://www.lighthouse3d.com/opengl/terrain/index.php?mpd2). the result looks not bad. i believe with some help of morphing Filters and better texturing. it will looks awesome.

demo:
http://www.youtube.com/watch?v=bKr-UABlVNw
Title: Re: experiment on Terrains
Post by: roccio on April 13, 2017, 12:19:08 am
Getting really good. You should make some more mountain, but it's awesome
Title: Re: experiment on Terrains
Post by: roccio on April 13, 2017, 12:43:48 pm
Even better, but can you post some more infos?
How much is big the terrain? Are you using some sort of chunked lod?

I will follow your work with interest.