[GSoC 2013] Dynamic Terrain Tessellation

Threads related to Google Summer of Code
Post Reply
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

[GSoC 2013] Dynamic Terrain Tessellation

Post by Naman Gupta »

Short Description
Main idea of the project is to replace the current brute force approach of distance dependent LOD for rendering heightmaps to a Continuous distance dependent LOD in Ogre3D.


Project Proposal
The current LOD system in terrain simply pops the mesh when its transition has to take place.
Image

This implementation has several issues like it consumes memory as each pre-calculated tile mesh has to stay in memory even if they are not queued to render. Also notice the sudden drop in FPS.
The proposed system will eliminate this issue by dynamically altering the vertices and indexing of the tile mesh that would look somewhat like this.
Image

Project is aimed at implementing the system good enough to be merged to the main trunk, and the final result would be reflected in Ogre’s Terrain Demo.

Implementation
There have been many implementations that have been made that I’d refer to The proposed system is divided into 3 phases
1). Quadtree traversal and node selection:-
Heightmaps are arranged into a quadtree, then use the best quadtree nodes from different LOD levels at run time. Ogre already has a Class TerrainQuadTreeNode to take care of it.
Image

2). Morph implementation:-
Each vertex is morphed individually based on its own LOD metric, where the morph is performed per-node. Each node supports transition between two LOD layers: its own and the next larger and less complex one. Morph operation is performed in the vertex shader in such way that every block of eight triangles from the more detailed mesh is smoothly morphed into the corresponding block of two triangles on the less detailed mesh by gradual enlargement of the two triangles and reduction of the remaining six triangles into degenerate triangles that are not rasterized.
Image

3). Rendering:-
To render the terrain, we iterate through the selected nodes and their data is used to render
the patch of the terrain that they cover. Continuous transition between LOD levels is done by
morphing the area of each layer into a less complex neighbouring layer to achieve seamless
transition between them.
Image

Schedule
<<ACCEPTED PROPOSALS ANNOUNCED>>
  • May 27~June 16(3 weeks) Setup developing environment. Read research papers and other implementations. Understand Ogre’s infrastructure. Discuss best ways to approach the problem with community and mentor.
<<BEGIN CODING>>
  • June 17~June 14(4 weeks) Begin implementation
    June 15~July 21(1 week) Benchmark and Optimize
    July 22~July 28 (1 week) Documentation
    July 29~August 4 (1 week) Test and Deal with Mid-Term Evaluation
<<MIDTERM EVALUATION>>
  • August 5 ~ August 25 (4 weeks) Complete the project
    August 26~ September1(1 week) Benchmark and Optimize
    September 2 ~ September 15 (1 week) Documentation
<<SUGGESTED PENCILS DOWN>>
  • September 16 ~ September 23 (1 week) Test
<<FIRM PENCILS DOWN>>
  • September 24 ~ September 27 (1 week) Deal with Final Evaluation
<<PROJECT ENDS>>

Why You're The Person For This Project
I’m a Third year undergrad computer science student of Meerut Institute of Engineering and Technology. I love video games and always keep asking myself while playing them the same question, “How do they do it!”.
To be really honest, I’ve been reading a lot lately about the project lately but sparingly understood the exact implementation. However my commitment towards becoming a good graphics programmer has always helped in tackling such scenarios. Also, part of my work on Crystal Space engine under GSoC 2011 was based on the project I’m proposal. It’s a definitely a plus. Having said that, I’m pretty sure with the right guidance from an incredibly supportive Ogre community I’d bring some eye-candy to the table.

Why OGRE?
Not only Ogre is a great rendering engine but it also have a very strongly community and followers. Also, Recent use of Ogre in medical simulation has deeply impacted me to work with on it.

Anything Else
Apart from practical exams for 3 days on random unknown dates I have no other commitments for this summer.
Last edited by Naman Gupta on Fri Apr 26, 2013 6:56 pm, edited 1 time in total.
-naman-
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by Assaf Raman »

Nice idea.
Is there any existing code base\sample of the idea?
How will this be a part of OGRE (core\plugin\etc), can you create a general class diagram?
Watch out for my OGRE related tweets here.
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by robert_sasu »

Hi, I am working and was working with D3D11 RS on Ogre3D. Good project, I thought I will implement NVidia's terrain tessellation sample in 3 weeks after core improvements. If you want something similar to NVidia demo, I think at least you need texture unit support for hull and domain shaders (tessellation stages) which which is not yet implemented to D3D11 Render System (also displacement mapping support). This hole was found out by @ja0335 and I am trying to implement it, but it is not a simple task.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by Naman Gupta »

Assaf Raman wrote:Nice idea.
Is there any existing code base\sample of the idea?
How will this be a part of OGRE (core\plugin\etc), can you create a general class diagram?
Yes, here is the sample code. Plus, Nvidia D3D SDK 11 has 2 samples along with the code.
I'm working on the class diagram for the project. will post as soon as it's done.
-naman-
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by Naman Gupta »

robert_sasu wrote:Hi, I am working and was working with D3D11 RS on Ogre3D. Good project, I thought I will implement NVidia's terrain tessellation sample in 3 weeks after core improvements. If you want something similar to NVidia demo, I think at least you need texture unit support for hull and domain shaders (tessellation stages) which which is not yet implemented to D3D11 Render System (also displacement mapping support). This hole was found out by @ja0335 and I am trying to implement it, but it is not a simple task.
Hi there,
I'm not quite sure. My project is not entirely based on Nvidia's implementation. They achieved terrain tessellation with D3D9. So my focus is on implementing it in general (including OpenGL). One possible solution for this conflict could be to develop a separate project of terrain that is exclusively for D3D11.
-naman-
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by bstone »

Hmm. Last time I checked it (and that was 1.7) Ogre's terrain supported continuous LOD with morphing. Has it been dropped in v1.8/1.9?
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by Naman Gupta »

bstone wrote:Hmm. Last time I checked it (and that was 1.7) Ogre's terrain supported continuous LOD with morphing. Has it been dropped in v1.8/1.9?
It is not there in Default branch.
-naman-
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by robert_sasu »

Naman Gupta wrote:
Hi there,
I'm not quite sure. My project is not entirely based on Nvidia's implementation. They achieved terrain tessellation with D3D9. So my focus is on implementing it in general (including OpenGL). One possible solution for this conflict could be to develop a separate project of terrain that is exclusively for D3D11.
I was confused then by your title (when you said _tessellation_ I thought about Shader Model 5.0, used by D3D11 and OpenGL3+) and link to NVidia's Terrain Tessellation white-paper, which was done using tessellation stages. This is why I wrote my observation that Ogre3D is not yet ready for that becuase it does not offer texture unit support for hull and domain shaders.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by bstone »

Naman Gupta wrote:It is not there in Default branch.
I've just checked v1.8 and it's still there. Looked into v1.9 and there have been changes to the related code but the gist seems to be there still. If it doesn't morph in v1.9 RC1 then there could be a regression between v1.8 and v1.9. The related method is TerrainQuadTreeNode::calculateCurrentLod().
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by Naman Gupta »

hi bstone,
I just complied ogre v1.8. It's not there.
Don't have time to go into the code but I looked at the terrain done in wireframe mode. It doesn't matches with my proposal rather it's same as vDefault.
Or maybe I'm doing something terribly wrong.
Can anyone else give conclusive answer on wheater or not this implementation has be made before?
-naman-
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by jacmoe »

How much of a difference does this really make?
I mean, with a fully textured terrain?
Or, is the material generation part of it?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by bstone »

Well, it's worth finding some time to actually look into the code behind the current terrain implementation, especially since your GSoC proposal is all about it. Judgment based solely on looking at wireframe renders might be misleading.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by bstone »

Also note that looking at the default branch is not a very good idea. Look at v1-9. Hope that helps.
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by Naman Gupta »

I'm on it bstone. Taking look at the code.
Sadly, v1.9's terrain demo won't even load on my machine. As I click "Start Sample" the application hags and stays there forever, while v1.8 and Default worked fine. I'm using Intel HD 4000.

Kindly take a look at this link.
This exactly what I'm trying to bring to ogre.

And yes I'd be upload a class diagram once I understand how this can be done.And Of course it requires taking a good look at Ogre's terrains system.
-naman-
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by Naman Gupta »

So this proposal of mine is more focused on older RS such as DX9 and GL2. However, this is more of a later RS thing and, holocronweaver and robert_sasu are already working on it. But, there should be many ogre users who would want to see faster & better terrain on older RS as newer hardware will take quite some time to replace the older one. At best, it can be scaled to ocean/water.

I'd like to ask the community if they are interested in my proposal so I can further work on it.
-naman-
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: [GSoC 2013] Dynamic Terrain Tessellation

Post by bstone »

So have you looked at the existing code after all? The problem is that the items 1-3 you mentioned in your original post is how Ogre's terrain component does it, i.e. quad-tree based hierarchy for LOD and morphing between two nearest LODs. That's why there are Ogre::TerrainQuadTreeNode and Ogre::Terrain::_setMorphRequired() in the Terrain component.

I can't really see the point of your proposal as it's stated now. Also, keep in mind that the current terrain component took a few years to mature to the level it has now. It's not very realistic to come up with a replacement developed as a GSoC if you ask me. There's just so much else in terrains beside LOD.
Post Reply