• Welcome to SC4 Devotion Forum Archives.
 

News:

The SC4 Devotion Forums are no longer active, but remain online in an archived, read-only "museum" state.  It is not possible for regular members to post or use the private messaging system, and no technical support will be provided for any issues pertaining to the forums in their current state.  Attachments (those that still work) are accessible without login.

The LEX has been replaced with SC4Evermore (SC4E), and SC4E maintains an active Discord server.  For traditional forums, we recommend Simtropolis.

Main Menu

Help with LODs

Started by thingfishs, November 20, 2009, 05:52:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thingfishs

Hi,
I've been having some problems understanding how LODs work. I am in the process of making my first BAT, detailed here http://sc4devotion.com/forums/index.php?topic=9362.20.



It's the family winery and though there's still much to be done to the buildings I want to move on and start adding some greenery to what is increasingly looking industrial. That's when I found out about LODs. I have made a couple of versions now but I'm clearly not getting it. I'm sure I've got this all backwards or something but what I have done is cut the area of the pavers and concrete (where I want to be able to put props) out of the LOD. Then in the LE and in game at zooms 1-4 it looks normal (with pavers and no props) then at zoom 5 there's no pavers and all the props. I didn't understand all the suggestions on my thread and rather than keep filling that up with questions I thought I would post here. I was directed to BAT essentials (which I already had) but LODs aren't covered much in there. How do I do it?
(it was also suggested to not BAT the pavers and make a custom LOD, what's a custom LOD as opposed to what I have been doing?)

Orange_o_

Excuse me, my English is not perfect. You have a problem with zooms away? But in closed zoom  it's ok? Is that it?

If so that's, it's normal LOD3 LOD4 and LOD5, you manually create the corresponding closed zooms. For zooms away, the lods are generated automatically (a box), so you have this problem

   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °  


thingfishs

#2
Thanks Orange_o,
I think I understand. I will try again.
(to clarify, I only edited 1 LOD, so I assume that was the cause of my problems)

Orange_o_

you must change LOD3 LOD4 and LOD5 (you can clone and rename LOD3 in LOD4 and LOD5.) I did a tutorial in French.
But I think your problem will continue to zoom away

   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °  


thingfishs

This time I edited 1 LOD and then cloned it and renamed them. This is what happened, for zooms 3, 4 and 5.



I noticed in your tutorial (though I can't read it) that you turn the LOD into an editable mesh. I did mine as an editable poly, I don't fully understand the difference; could that have caused my problem. Also the amount removed is bigger than the amount intended. I still don't know what I'm doing.  ()what()

kwakelaar

It seems you are having a bit of a problem, looking at the picture. Maybe you have just made the LOD's too tight not containing all of your model within the LOD's.

First a custom LOD is one you make yourself, not using the one the BAT will make for your model when you render it.
For your model I would make two boxes each making part of the L in the shape of your building. Make the boxes rather tight fitting, but still containing all parts of your building. If not you will slice parts off when looking at it in the game.
Turn one box into an editable mesh and attach the other box. Then rename as LOD3, then indeed clone/make a copy and rename it LOD4 and again clone/copy rename it LOD5.
Hope this will help you out.

thingfishs

#6
Thanks kwakelaar,
I've done as you instructed and it worked, the building's all OK. But I still don't understand how this helps me to get plants props where I want them. If the pavers are there I can't put props on them, and if they're not I can put props but have to be reliant upon base textures etc which I am trying to avoid. It doesn't seem to make any difference to the pavers whether they are covered by the LOD or not, what am I not getting?

(okay that time I did as you said, but forgot to delete the other LODS so there were two sets. This time I deleted them and yes, it does make a difference whether the pavers are covered by the LOD. If they're not, you can't see them, which if I understand correctly is the point of LODS. So how do I get my pavers and props? How is the LOD helping in this situation?)

kwakelaar

Ok, if you do not want you use base- and overlay textures instead of your batted textures, also for this there is a work around where you can use the LOD's. But now you will need to make a little more complicated set of LOD's. I do not agree that this is the way to do it, but it is possible. I think there are so many good textures that have been made, and I really would recommend you to use these. And if I have understood the working of LOD's the more complicated they get, Simcity will need more processing power for running the game.
You can keep the LOD3 you already have and then make new boxes for the pavement, you will need to make these really tight fitting, with the smallest height to be able to put props on them later. Just make the new boxes and again with the editable mesh (LOD3) use attach. Again copy to make LOD4 and LOD5.
I would make the well and the wall in the courtyard as separate props. You can merge these into a new scene in the BAT and render them separately.
If you do not want these as props, you will need to include these shapes as well when making your LOD's. Again make the shapes as tight fitting as possible if you want to use props on or around the well and wall later.
Also always before rendering or making a preview, save, and never save after rendering or making a preview. Then you avoid a few problems with camera's and LODs that get included in the scene after these functions.
Best of luck, and I look forward to see how it turns out.


thingfishs

thanks a lot kwakelaar,  :thumbsup: I mostly understand how they work now.
I hear what you say about the advantages of using base/overlay textures. I am trying to recreate the winery accurately (including the gardens) and if I use textures won't I have to still create a whole bunch of new ones to make the layout of the paths and gardens roughly correct?
This may still be the way to go, I don't know I'm brand new at this. But I want to at least get my head around my different options.
Thanks again for making the process less painful.

Lowkee33

Thanks for the help here, this thread definitely got me making a custom LOD.  I have a few questions though.

1)Judging by the fact that the UV map on the S3Ds in Reader is not a cube, I assume that I did this successfully.  Am I correct?  While rendering, BAT displays a generic cube over the model.

2)When people say a "tight" fitting LOD, how tight are they talking about?  If I have a 1 meter cube as a model would a 1 meter cube be the ideal LOD?  Should the LOD be >1 meter on all sides?

3)My model isn't very complicated, and the most straight forward way for me to make an LOD is to first make a cube over the entire model, and then add the points I need.  The points are moved/merged to create the ideal shape.  If I started with a cube, would I have different results than if I had started with a sphere?  Other than perhaps ease of start, should I consider the type of shape I start with?

Thanks

cogeo

#10
Always keep in mind the following:
- The actual 3D model displayed ingame is the LODshell. Everything else is projected on the LODshell's faces.
- The UW map shown in the reader has nothing to do with the UVW maps in your gmax scene. It is simply a Vertex==>Texture Coordinates mapping. The "polygons" (or else "triangles") in the S3D model are triplets of vertices, and the objects actually drawn. The UV map just tells the game which coordinate in the texture (they are in the 0.000000-1.000000 range, not pixels) each vertex corresponds to.
- There are performance considerations too, in general the more complicated the LODshell (ie the larger the number of triangles) the heavier the workload for the graphics engine.

So the answer to "how should my LODshell look like?" or "how tight should my LODshell be?" is make the simplest possible shape that can meet the projected requirements. If you click "Re-fit LODs", BAT will generate the smallest possible LODs (simple boxes) that fully encompass all objects in your scene. For many BATs this is OK, but for some others not. A notorious example is the LODs of some trees, where the trunk is projected on the front face of the LOD (see Franku's thread). But on the othedr hand, trees can be used in very large numbers, so efficient LODshells are paramount here.

For an example of tight LODs, take a look at this thread. This LOD is for one of the stations in my Rural Rail Station Pack on the LEX. They are made this way in order to allow people and other props to be placed under the shelter and still display the pavement. If this wasn't a "requirement", a simple box would be enough. Still, they are not too complicated either, as they only consist of three simple boxes attached together: the main (building) box, the shelter and the pavement.

A spherical LODshell would contain a large number of triangles, so it wouldn't be efficient. Also if you make a cylindrical LODshell, it won't really be a cylinder ingame, it will instead be like a "prism" (there won't be any curvature). So spherical or cylindrical LODshells are not recommended. But for such cases approximations can be used (as close as required, and again, keep an eye on complexity too). Take a look at the Water Tower models (in the same pack). It's cylindrical object and uses a prismatic LODshell. You can place props close enough, and it's not too complicated either. As you can see, the number of "Height Segments" is 1.

Hope I was helpful.

Lowkee33

Thanks Cogeo,

QuoteThe UW map shown in the reader has nothing to do with the UVW maps in your gmax scene

This is interesting, the UV map showed the exact points that I set in BAT.  Perhaps I don't understand this.

I was doing a "slope run" on some lots and realized that I aught to make some custom foundations (something I think my limited BAT skill can manage).  My model is basically a cube (the foundation as it would be in RL), a triangle (the driveway) and some steps.  The issue is the space between the steps and and the driveway, not necessarily placing props on the driveway (although I should definitely check out what happens).  I assume that if the LOD is default, then any prop that I may have placed if front of the building will rise off the ground in case the foundation is used.

QuoteA spherical LODshell would contain a large number of triangles, so it wouldn't be efficient.

Is this because of the way a sphere is created?  I am guessing, but a decent sphere might be made with 36 points.  A cube only needs 8, but one could add segments to make 36 points.  What I wonder is if the way the sphere with 36 points is generated has more complicated triangles than the cube with 36 points.  Should I be starting with Tetrahedrons?

cogeo

I'm not sure about foundations (I mean the Maxis building and lot foundations). I don't know if they are indeed models, and if they can have protruding (non-orthogonal) parts. Maybe check in more detail how the ingame ones are done.

What do you mean by "points"? Vertices? If so, a decent sphere needs many more than 36 vertices. Uncheck the "Smooth" box to see how your LODshell will look ingame. It's the number of "Faces" that counts. And finally, why want to use a sphere? Whether the LODshell should be a cube a sphere or what, should be determined by the shape of your model (it should encompass them all and be the smallest and simplest possible one), and its usage requirements, it's NOT a matter of taste.

Lowkee33

#13
Quote from: cogeo on April 05, 2011, 03:55:29 PM
I'm not sure about foundations (I mean the Maxis building and lot foundations). I don't know if they are indeed models, and if they can have protruding (non-orthogonal) parts. Maybe check in more detail how the ingame ones are done.

They can be anything, though I don't know if MaxisPIM has a "foundation" option, PIMX does.  Although, I have found that "Building Foundation" should be in the building exemplar, rather than the Lot.  The property points to the Instance of the foundation.  Haven't checked out Lot Foundations though.  Check out c.p.'s Early 19th Century Houses, you can see the foundation in the LEX image.  Although perhaps he only used them as props.

QuoteWhat do you mean by "points"? Vertices?

I mean Vertices. 

QuoteWhether the LODshell should be a cube a sphere or what, should be determined by the shape of your model (it should encompass them all and be the smallest and simplest possible one).

Agreed.  No matter what shape I started with, the end be the same.  I wonder if the general construction of a "sphere" is more complex than a "cube".  If so, I would have to assume that a tetrahedron would be even simpler, and that everyone willing to put the effort in, should start with that.

jmyers2043

#14
LowKee

Here's a short TUT on how I approach LOD's. 


http://sc4devotion.com/forums/index.php?topic=536.msg294366#msg294366


Good Luck.

Jim Myers  (5th member of SC4 Devotion)

cogeo

Quote from: Lowkee33 on April 05, 2011, 04:52:54 PM
No matter what shape I started with, the end be the same.

Not at all! The model may look the same ingame, but behave differently, and not only in terms of performance; its interaction with other models (aka: the ability to place props close enough) can be affected too. Varous shapes have fundamental differences. And again, the ideal shape of your LODshell should be dictated by the shape of your model, eg a box for a parallelepiped model, a cylinder (prism) for a cylindrical model, etc. And of course, the shape of your LODshell near the model's base is far more important than its top, as almost all props are placed at ground level.

Quote from: Lowkee33 on April 05, 2011, 04:52:54 PM
I wonder if the general construction of a "sphere" is more complex than a "cube".

Isn't this obvious? A box is the simplest possible shape, having only two triangles per face. And BAT optimises models, removing the faces that are not visible. In a simple box LODshell, only three faces (per Z/R) are generated: the upper, the front and the right one; the others are removed (in the reader, rotate the model in the preview pane and check its back side, to see this). Such a "shape" consists of only 6 triangles (check the Indx tab) defined by only 7 vertices. On the contrary, a spere is made up of a BIG number of faces. After creating a sphere, apply an Edit Mesh modifier, go to Faces selection mode and select them all to see the count.

Quote from: Lowkee33 on April 05, 2011, 04:52:54 PM
If so, I would have to assume that a tetrahedron would be even simpler, and that everyone willing to put the effort in, should start with that.

A tetrahedron has fewer faces than a cube, but its shape is not really convenient for most models. It has a wider base, and this can be detrimental for placing props next to it. I would suggest that you check the LODs of some more models in the rural rail station pack, to see how they are applied (in the reader select "Wireframe" and "Both" modes to see more details).

Lowkee33

#16
Did some playing around.  A "sphere" can be made with 4 segments, at which point is has 6 vertices and 8 faces.  This is less than a cube with 8 and 10 respectively.  By manually adding vertices and planes, this sphere could become identical to the cube.  My conclusion is that the shapes only provide ease of use.

However, there is much that I do not know.  I understand that once a box is converted into an "editable", I loose a bunch of options (such as width segments).  Other options that I may loose I am not sure of, so perhaps this is another reason to pick the most fitting shape.

The models in the Rural Rail Pack are terrific BTW.  If I could ask a question, the roof of the "Small1" station is not connected to the walls, why is this?

Edit: Oh yes, Thanks Jmyres.  The tutorial is helpful, although much of it goes over my head.  I have been having trouble "attaching" things, not really sure what that means, but that is another story.

Judging by your pictures, it appears that the LOD can be exactly the same size as the model.  What if you were to select every object in the model, clone them, and then attach them (making one object)?  Would this make for a good LOD (if simple enough of a model)?   

cogeo

Quote from: Lowkee33 on April 06, 2011, 01:01:30 PM
A "sphere" can be made with 4 segments, at which point is has 6 vertices and 8 faces.  This is less than a cube with 8 and 10 respectively.  By manually adding vertices and planes, this sphere could become identical to the cube.  My conclusion is that the shapes only provide ease of use.
Yes, but why make it so complicated? The resulting shape will be a romboid, or pyramid if you remove the underground part, which are both not suitable for (most) "normal" BATs.

Quote from: Lowkee33 on April 06, 2011, 01:01:30 PM
However, there is much that I do not know.  I understand that once a box is converted into an "editable", I loose a bunch of options (such as width segments).  Other options that I may loose I am not sure of, so perhaps this is another reason to pick the most fitting shape.
Yup. if you convert a shape to a mesh, you can no longer modify parameters like the number of segments. So before converting, you have to set its final size and position, number of segments etc. But after converting, you can attach other LOD components, eg for protruding objects, like the canopy and the pavement in my stations. These components can be specifically-made shapes, or again... LODs, generated by BAT, by selecting, saving as a new scene and re-fitting LODs only for the protruding objects, and finally re-importing them in your scene using the File->Merge command.

Quote from: Lowkee33 on April 06, 2011, 01:01:30 PM
If I could ask a question, the roof of the "Small1" station is not connected to the walls, why is this?
I don't understand this. What do you mean by "not connected"? Use the rotate tool and you will see that the LODshell is a "continous" shape. And remember, BAT removes the faces that are not visible at each specific viewing angle.

Quote from: Lowkee33 on April 06, 2011, 01:01:30 PM
What if you were to select every object in the model, clone them, and then attach them (making one object)?  Would this make for a good LOD (if simple enough of a model)?   
This would create a LOD exactly matching the model shape, howeve it will be extremely complex. First of all it will be containing parts "inside" the shell that are not needed - you just need a "shell". Second, the number of faces will be huge. And I'm not sure how good it will be looking ingame. So the answer is make simple shapes fully encompassing your objects and modify it as needed (resize some parts, attach other objects etc. And of course, keep things as simple as possible.

Lowkee33

Thankyou very much for the help

Quote from: cogeo on April 06, 2011, 03:16:05 PM
Yes, but why make it so complicated?

Because thats just what I do  ::)

QuoteAnd remember, BAT removes the faces that are not visible at each specific viewing angle.

Ah yes.

So I got the Model into SimCity and things are looking fine.  Better than other custom foundations? No. Better than the default Maxis? Yes.

One last question about simplicity.



This image was taken from Reader.  You are looking at the underside of the model.  The blue rectangle surrounds the front of the foundation (It's actually 2 faces...), while the object in front of it are the steps.  The foundation extends behind the steps, and this portion is never seen in game.  However, I thought it would be preferable over breaking the foundation into 2 pieces and thus have 4 faces.  Any thoughts?