Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Auto LOD generation


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 gamelife   Members   -  Reputation: 192

Like
0Likes
Like

Posted 07 December 2010 - 05:07 PM

The artists in my company build large objects by putting separate parts together. For example, we have separate models of windows, walls, ledges, pillars, doors, etc. To make a whole building, they put multiple parts at different positions, allowing the parts to simply touch or intersect. As a result, a building would consist of 100 disconnected meshes.

Now I'm assigned the task of writing a tool for auto LOD generation. I found that it's hard to avoid holes after polygon reduction. I've tried many methods like locking the open edges or coincidnet vertices, but holes cannot be 100% avoided. I also tried to auto-split touching or intersecting edges, but it results in tremendous increase of polygon count.

So do you think it's a good idea of modellng large objects by simply putting small pre-made pieces together, without resolving the intersecting polys? It would definitely save poly count, but it also hinder auto LOD generation. What's the common practice in game companies?


Sponsor:

#2 Atrix256   Members   -  Reputation: 510

Like
0Likes
Like

Posted 07 December 2010 - 05:30 PM

You know honestly, you might get some good info here, but I would really talk to a more senior graphics programmer there at your company or your lead if they know about graphics programming.

If you are the most senior... i am really sorry... you are probably in for some major pain and i hope you are willing to be tossed in the "deepest end" of the pool. You will have major problems near the end of the project when everything is broken and nothing runs fast enough and no one there has experience enough to know what to do about it without having to learn everything for the first time.

Anyhow, I'm not a graphics programmer but i'll try a response!

The good thing about how they generate those models is that instanced geometry can be really fast to render and can take up very little memory since each building isn't it's own complete model.

HOWEVER, part of optimizing rendering is to minimize draw calls to as few as possible. Doing what you are saying could make the number of draw calls HUGE depending on how many buildings you have on the screen at any one time and how you do your LODing.

Also, since there are so many models you'd wand a really efficient kind of rendering setup, like perhaps BSP trees, so that you could quickly cull away everything that wasn't visible.

deferred rendering may also be a good idea.

Onto the idea of lodding... for low lod buildings have you thought about doing something like for instance, using a textured quad (without any transparency in that image) for the windows when they are far away?

You could render to texture to automatically get that lowest level of LODing for a building.

You could possibly even render the entire side of a building to texture and just paint that onto the side of a building as a single quad if appropriate.

If you had other buildings you knew were the same building you could re-use that texture for them too.

Hope this helps or starts some more discussion!

#3 gamelife   Members   -  Reputation: 192

Like
0Likes
Like

Posted 07 December 2010 - 05:47 PM

Hmm, I think the situation is not that worst. At medium to far distance, the parts of a building are combined together as a single mesh (1 draw call).

#4 Dancin_Fool   Members   -  Reputation: 608

Like
0Likes
Like

Posted 07 December 2010 - 06:07 PM

Have you profiled already to determine that too many vertices is your bottleneck?

If not I'd suggest you do some profiling first, depending on your platform there are different tools to investigate where your GPU bottlenecks are.

No sense in wasting a lot of time developing this auto LOD system if your time could be better spent somewhere else.

#5 allingm   Members   -  Reputation: 460

Like
0Likes
Like

Posted 07 December 2010 - 08:49 PM

Is it possible to merge the pieces and then do the LOD conversion? This would help to prevent holes.

You might also be able to tweak your algorithm so that the smaller LOD never loses volume but instead matches or gains volume. That could assure no holes are produced from separate pieces.

#6 gamelife   Members   -  Reputation: 192

Like
0Likes
Like

Posted 08 December 2010 - 02:35 AM

My task is assigned from the lead programmer so I think he has already done profiling.

I already merged the pieces before LOD. It helps a bit, but not perfect.

In far distances, I second that render to texture is a good choice. The problem is just medium distances. The LOD tool is used to merge the pieces, perform LOD, and combine textures.

I've voiced out several times that LOD can't be perfect when the input mesh is disconnected, and we'd better get artists to clean up the result by hand. Apart from the holes issue, the UV mapping after LOD needs to be fixed manually too. But I was told that the artists are too busy, so I need to try making the tool cover all cases and yield the best result. Errrrr.

#7 Darg   Members   -  Reputation: 209

Like
0Likes
Like

Posted 08 December 2010 - 02:59 AM

Well best case here would be simply to have lower LODs for each individual piece that still match up together. If the artists don't have time to work on that though then you're going to have to do it the hard way.

What you could do is for each piece, before joining the individual meshes find which vertices are touching other parts (the duplicate vertices that are removed when joining the meshes) and ensure that they never get moved or deleted. After that the internal vertices of each piece can be optimised by whatever algorithm suits.

#8 _swx_   Members   -  Reputation: 965

Like
0Likes
Like

Posted 08 December 2010 - 03:07 AM

This document shows the results of remeshing and simplifying complex models and then packing the textures and materials:

http://www.donyalabs.com/pdf/SceneOptimizationWhitepaper.pdf

Treating each object individually will result in either lots of gaps or very poor simplification.

#9 gamelife   Members   -  Reputation: 192

Like
0Likes
Like

Posted 08 December 2010 - 03:10 AM

I've already tried locking the coincident vertices. It does not help much, since a large amount of pieces are touching in edges, or even intersecting.


#10 Daivuk   GDNet+   -  Reputation: 376

Like
0Likes
Like

Posted 08 December 2010 - 03:24 AM

Batch objects using same material, and spend time on occlusion culling before getting yourself into this. Unless of course, you already have occlusion culling, and assuming it is fast enough.

Quote:

My task is assigned from the lead programmer so I think he has already done profiling


Maybe you should go talk to him first and make sure he knows what really the problem is. My lead here already asked me to do an auto LOD before, but he is not a graphic programmer and didn't really know. LOD should be done by art team. And art team agreed, but didn't want to do it. So we ended up with a better culling system, and everything worked out.

#11 Zemedelec   Members   -  Reputation: 229

Like
0Likes
Like

Posted 09 December 2010 - 04:06 AM

Mm, did your lead make some outline of the LOD process that should do the job?
First, you should not have problems with texture coordinates, since you should handle them in the same manner as the positional info, so you won't delete texture seams, etc.
It is common for all LOD algorithms to treat all vertex data in a similar way, be it tangents, positions or texture coordinates.

But the task you are doing is not by far the simplest thing at all.
Imo, your lead don't exactly knows, what a beast a LOD can turn into.
Most people do it by hand.
Introducing vertices should be a must, where they touch geometric surfaces or else you'll get holes and wierd stuff.

Btw, for very distant stuff you could try depth sprites (require rerendering of the original mesh) or a more generic LOD approach - marching cubes over the mesh, until some cube size, then bake the geometry into a single quad/triangle + baked texture from this piece of the mesh. Very straightforward and generally easy to write, but will require unique texture for the whole mesh.

#12 dreamhaha   Members   -  Reputation: 100

Like
0Likes
Like

Posted 09 December 2010 - 02:23 PM

The same thing happens in our company too. The artists agree with us that the lod mesh must be created by them,but they also say that "we are too busy...".

u can try some other way,for example,try to render the complex-large-mesh to a texture in real-time but not every frame,and use billboard technique.Some culling
and batch methods are also useful.

#13 Zemedelec   Members   -  Reputation: 229

Like
0Likes
Like

Posted 09 December 2010 - 08:38 PM

Quote:
Original post by _swx_
This document shows the results of remeshing and simplifying complex models and then packing the textures and materials:

http://www.donyalabs.com/pdf/SceneOptimizationWhitepaper.pdf



Looks stunningly good! Grats for actually succeeding where many failed :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS