Jump to content

  • Log In with Google      Sign In   
  • Create Account


RetroIP

Member Since 12 Jan 2012
Offline Last Active Mar 03 2014 12:52 AM
-----

Posts I've Made

In Topic: Shadow mapping advice

16 September 2012 - 12:36 PM

Your approach seems correct form my view, I have something similar, but not in OpenGL.

//Generating shadows
if(shadows)
{
	 foreach light
	 {
		  foreach object
		  {
			   if(distance(object,light)<30
			   {
				    render object to shadowmap for this light
			   }
		  }
	 }
}
//Rendering lights with shadows
foreach light
{
	 if(shadows && cameradistance<***)
	 {
		  render light with shadow map
	 }
	 else
	 {
		  render light
	 }
}

In Topic: LOD Terrain - Indices management

07 July 2012 - 11:14 AM

Fine Martin,
Thanks for this, I'll try to use skirts again, then I'm finally free and I can enable/disable whole terrain chunks.
I'm not having FPS drops during current terrain rendering, but I wanted to have my engine, because someone other's engine is sometimes hard to understand.

I thought that drawing terrain in one draw is the best solution, but background indice management is time expensive in that way.

In Topic: LOD Terrain - Indices management

06 July 2012 - 03:18 AM

32x32 chunks, All picures all illustrations, Chunk 1 LOD 1, Chunk2 LOD 2, maximum lod is 12, so much more vertices.
Terrain size 8192x8192. Approx 3m between 2 vertices.
Heightmap is 2048*2048, so I have array of height. if there are more vertices per one pixel of height, IInterpolation is used - later details with additional noise
Occlusion is another part, which I want to implement, but current BiLOD sample which I'm using, is made a little bit in different way-this is the reason why I want to use my own terrain system.

I have opinion that I can reder terrain with one DRAW, (yes, limitations of vertices/indices), what I want ,is to collect all VB and IB from chunks, put it these into one VB and IB a simply DRAW.
Problem for me is how I remove duplicated vertices and SORT indices in IB properly according removed vertices.

I red many WhitePapers for terrains (LOD,Roam, different approaches), this process whas not mentioned.

Rendering each chunk separately will force to gaps, solution for this maybe skirts, but at the edge of chunk you will still see this.

I think I want to do it in wrong way.But then how it is done in globally ?
2 options:
1. Large terrain rendering is builded in way that it does not generates duplicated vertices (my currently terrain renderer NOTmade by me)
Attached File  bilod.jpg   59.16KB   77 downloads

2.Or vertices are somehow handled - this I want to know, how

I want to achieve Quad based LOD, when I can easily cull quads which are far away. With current chunked LOD I cant't, because implementation is not possible in this algorithm.

In Topic: LOD Terrain - Indices management

05 July 2012 - 10:28 AM

Samoth:Yes, they are same, I just wanted to illustrate same vertice position for Chunk 1 and Chunk2 , I also wrote:

So, for example Vertices ABCD will be discarded because I already have E,G,I,K on that position.

Thank you, this looks better than my approach of handling stitches (Edge grid was created in every Chunk to adapt to neighbour's Chunk . You are right, interpolation was not enough to "hide" very small gaps. OK but this is not main point now.

Martin: I think I got it what do you want to say. For me is important "ordering indices" as you wrote, how is this done.

I'm trying to know simple thing, I understand that my explanations are not clear.
OK, another pic:
Attached File  lod_illu2.jpg   30.39KB   91 downloads

So what was made by me:
We have Chunk1 and Chunk 2 with it's own VB and IB. When I was preparing main VB and IB, which will be swapped later on with VB and IB for drawing, was:

Fill VB with Chunk's 1 VB and fill IB with Chunk's 1 IB.
Results: VB: A,B,C,D IB: 0,3,2,0,1,3 (ADC,ABD)

Fill VB with Chunk's 2 VB
Results: VB: A,B,C,D,C,D,F,G,H,I,J,K IB: 0,3,2,0,1,3

Fill IB with Chunk's 2 IB + SHIFT INDEX (starting number will be Count of current VB vertices), so:
Results: VB: A0,B1,C2,D3,C4,D5,F6,G7,H8,I9,J10,K11 IB: 0,3,2 (ADC) ,0,1,3 (ABD) , 0+4=4;3+4,=7;2+4=6 (CGF) 0+4,1+4,3+4 ==4,5,7 (CDG) 1+4,4+4,3+4==5,8,7 (DHG)

Yes I can draw this, but in LOD level 4-5 I can have >20 same vertices per chunk. In overall I had around 8x more vertices then current Terrain renderer.

And NOW:
I hope you can see what I'm pointing at.
I have vertice C twice in VB. If I want to remove doubled vertice C on index position 4 (C4) in VB, I need to edit Indice 4 at index position 6 of IB, and set it to 2 (from ib[6]=4 to ib[6]=2), and SHIFT all other indices. This is too complicated process when currently in average I'm rendering 66000 Vertices with 130000 Indices with not my terrain engine (as I linked on my first post).
My approach is not good and I think it is too complicated. There are not so many really working LOD terrains, with available source codes.

Martin: If I keep all Vertices for deepest level, I think it will be too much.

So question,
What is optimal approach to fight with this issue, how it is done in your terrain renderers ? Posted Image
I think I can't compute all indices if I have VB because, there is some order which I dont know (different, LOD per Chunk, different count of primitives)

My data:
Terrain is sized to 8192x8192 units, visibility is to aprox. 3000 units, LOD level max 12

Screens shows my requirements but not my renderer:
Attached File  show1.jpg   35.39KB   102 downloads
Attached File  show2.jpg   74.95KB   97 downloads
This is maximum terrain detail, you can compare it to character.

Or I'm missing some knowledge regarding VB,IB, ordering, drawing.

Many thanks for your attention

In Topic: LOD Terrain - Indices management

05 July 2012 - 07:34 AM

Thank's Martin for hint, it makes sense, to precalculate all vertices and indices. I'll give it a try.

Well I have Primary V&i Buffer for rendering, on background thread I'm recalculating terrain detail according camera movement. Determining LOD level for each "chunk", building vertices and IB's for each chunk. Then all chunk buffers are merged into one VBuffer & IBuffer, and then quickly swapped.
Then I was in circle:
1.that i can't compute Indices for chunk 1 if i dont know how will look like chunk 2, if I want to eliminate duplicated vertices
2.I can't compute Indices on merged vertices buffer, because I dont know the order of them (if I'll delete duplicated vertices)

Thats the advantage of BiLod I mentioned up, because there is no duplicated vertices, as I'm using this sample, and I spent a lot of time for analyse of this code. I cant see anything, that is maintaining duplicated vertices. But in wireframe it is not about squares, but 8 vertex shapes.

PARTNERS