Jump to content
The Dark Mod Forums

Using LOD


Springheel

Recommended Posts

Is anyone familiar enough with LOD to explain how to use it in simple terms? I've created a new brazier that is fairly high-poly, and I wanted to make the combined light entity use the LOD system so that it swaps out lower poly models as you get further away. The wiki page on LOD confuses the hell out of me though, with descriptions of a dozen different spawnargs and the different ways they interact with the player's LOD Menu setting--some depend on the player's Menu setting and some override it. There is "lod_X_distance", "lod_normal_distance", "hide_distance", "min_lod_bias", "max_lod_bias"....I can't keep them all straight.

 

All I really want to do is to change the model as the distance to the player increases.

Link to comment
Share on other sites

I can't claim much experience but I do have the basics working in my map. You only need 4 of the LOD spawnargs, plus the normal "model" spawnarg.

 

model -- point this to the fully detailed model

 

dist_check_period 0.5 -- time in seconds between distance checks

hide_distance

 

Those last 2 are needed to activate LOD. I don't think hide_distance is designed to be compulsory, but I find that without it, none of the LOD functions work.

 

lod_X_distance

model_lod_X

 

You want a pair of these for each different LOD model you have. Replace 'X' with '1' for the first transition, 2 for the next transition etc. Here's an example from a test map. A globe becomes a birdcage when you get more than 200 units away, and vanishes at 400 units:

 

post-29566-0-44176300-1401894387_thumb.jpg

Link to comment
Share on other sites

Totally off topic, but what I initially read earlier...

 

I've created a new brassier that is fairly high-poly...

 

For the new female NPCs, rather modern, no? (Yes, my mind was an entirely different place when I first read that post.)

 

Playtex's new high-poly bras, for that smooth rounded appearance--no Madonna low poly bullet bras for our AI.

  • Like 2

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

It works like SteveL describes it. There are additional features however, which may make the wiki article a bit confusing (beneath the fact it was written by tels iirc, it can actually be read quite easy by a german one ;) ).

 

Additional features are distance based skin swap and disabling of shadow-casting (on models, not on lights). In addition I think you can apply offsets etc. if the different lod models do not share the same origin. If they do, you only have to set the distance and the model to be used as described by SteveL.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Has anyone tried using LOD as an alternative to visportalling for exteriors? I'm just starting on trying that out, which is why I had a test map to hand. I've done a big open exterior area with long sight lines and put in the building walls as invisible brushes -- caulk, nodrawsolid, and skyportal only -- and the plan is to dress those up in FS visible walls which I then convert to models. The distant ones would be replaced by simple shapes, and all the detail will vanish too. I'm combining detail patches into a single FS for each building face so I can turn them off with a simple hide_distance. I have VP'd the exterior but only so I can use location settings to switch some stuff on and off that can't be handled so easily by LOD. Of course I won't really know how it's going to perform until I've added a load of detail, so if it's been tried before I'd like to look at that work first.

  • Like 1
Link to comment
Share on other sites

The only testing of that sort I recall was in a wilderness map. I don't believe it's been tried with an urban area.

 

Of course, you can see that NHAT 3 (forest) benefits LOD simply by changing the object detail setting.

 

I hope to see you carry out this experiment :) .

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Has anyone tried using LOD as an alternative to visportalling for exteriors

You will not get around using those, as they are both used for sound propagation to and from the player.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Do you need their effect for sound prop outdoors though? Sound is ok to travel in a straight line outdoors. I don't plan to do away with visportals anyway, I'm just wondering whether lod can make long and wide sightlines possible. I'm thinking again about that rooftop view question I asked when I first joined the forum :)

Link to comment
Share on other sites

Thanks for all the tips.

 

You want a pair of these for each different LOD model you have. Replace 'X' with '1' for the first transition, 2 for the next transition etc. Here's an example from a test map. A globe becomes a birdcage when you get more than 200 units away, and vanishes at 400 units:

 

How many transitions are you supposed to have? And how do they relate to the LOD menu setting? Doesn't that impact the distance the above globe turns into a birdcage?

Link to comment
Share on other sites

I've got it working, but there's a weird snag (of course).

 

Things work well when backing up; the lod model swaps in normally. But when I walk forwards and the main model comes back, it starts casting shadows. As a light entity, it has "noshadows_lit" "1" applied, so it shouldn't be casting shadows while lit, but it seems like when the model gets swapped back in this spawnarg stops working.

 

It seems like the "no_shadows" spawnarg is overriding the "noshadows_lit" spawnarg when the model gets swapped back in. Other than this, everything works marvelously.

 

Any ideas how I might get around that problem? It's not usable at present.

Link to comment
Share on other sites

I plan to start with 1 transition, and add another if the effect is too jarring. Any more than that would be too much for my experiment. You can apparently have up to 7 if you really want them.

 

The user settings do scale the lod distances up and down. Some of those extra spawnargs let you override the user settings to a certain extent, but that's beyond anything I plan to try.

 

I have no idea about the shadow problem. I'd kind of assumed the game was just hiding/showing stuff, not messing with spawnargs or creating/destroying things. I'll see if I can rep it with a standard model light.

Link to comment
Share on other sites

Great, thanks. This could be really useful for things that are entities by default, like lights and doors, since mappers wouldn't even need to do anything special to benefit from it.

Link to comment
Share on other sites

It's not strictly a bug, but it's also fixable if that makes sense. Turns out that LOD is designed to manage shadowcasting for you. Whenever there's a LOD transition, the LOD code sets shadowcasting on the entity.

 

It's using only the lod spawnargs in that logic. There are optional LOD spawnargs for you to say whether your entity casts shadows at any given lod distance. The normal noshadows spawnargs are ignored after the first lod transition. If you haven't set any lod shadow spawnargs at all, it assumes you always want shadows.

 

But it's fixable. There's no reason I can think of that the noshadows_lit spawnarg shouldn't be allowed to override the LOD shadows logic. And that's not the only way to fix it: another way would be to stop LOD messing with an entity's shadowcasting settings in the first place if the mapper hasn't set any shadow-related LOD spawnargs on the entity.

 

I'll raise a tracker.

Link to comment
Share on other sites

I've only indirectly used LOD via SEED for my outdoor areas. It has helped significantly, and sound propagation is moot since it was line of sight.

 

Since I couldn't grok the LOD wiki page months ago, I've added this example per SteveL's post above and with another pic provided by him (thank you very much), please correct or inform me of any errors: http://wiki.thedarkm...tle=LOD#Example

 

You can apparently have up to 7 if you really want them.

 

From my read, the seven includes the regular detail model and hidden, so five lower levels of detail.

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

another way would be to stop LOD messing with an entity's shadowcasting settings in the first place if the mapper hasn't set any shadow-related LOD spawnargs on the entity.

 

Yes, I think that probably makes the most sense.

Link to comment
Share on other sites

Yes, using SEED with the SEED/LOD designed source objects works well. The grass and shrubs in the cemetery of "Inn Business" are SEED generated, if you view from the starting location through the telescope, you can observe the LOD effect as you move closer. Performance benefits nicely at various distances.

 

That was my impression too, that LOD seeded SEED... That SEED grew out of LOD... That the germination of SEED was... ;-)

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

Yes, I think that probably makes the most sense.

Agreed, and it also has the advantage that it'll be very easy to do it that way. I'll test it this end but I'll wait till we're finished with 2.02 before asking anyone to look at the code fix. But I think you can press on and safely assume we'll tackle it in 2.03.

Link to comment
Share on other sites

\But I think you can press on and safely assume we'll tackle it in 2.03.

 

Great, thanks! The new asset won't be available until 2.03 anyway.

Link to comment
Share on other sites

  • 4 weeks later...

There are still parts of LOD that I don't quite understand.

 

Can anyone explain what the following means?

 

 

The spawnargs min_lod_bias (default: 0.0) and max_lod_bias (default: 10.0) make entities disappear, change skin, or open/close portals when the value of cv_lod_bias (e.g. the setting "Object detail" in the menu) is either lower than min_lod_bias or higher than max_lod_bias.

 

Also, I'm not sure what this means:

 

 

lod_normal_distance

 

From TDM v1.05 onwards: This spawnarg defines a minimum distance from the player where the entity will ignore settings lower than Normal. This can be used to enforce a certain minimum distance so that players who set the detail level to Low or Lowest still do not experience entities popping in and out when being very close. If this spawnarg is not set, it defaults to 500 units.

 

I can't figure out what that means. What does it mean that it "ignores settings lower than Normal"?

 

So if the player has their LOD setting to Low or Lowest, entities won't change within 500 units? Does that mean the distance between the player and object is always assumed to be at least 500 units away? If players walk right up to a model they will only see the stage meant for 500 units away? That's the only way I could see it being a benefit to players, but I can't confirm that it works that way.

Link to comment
Share on other sites

As I recall, the lod_bias spawnargs are meant to be static detail levels rather than an offset of the LOD transition distances.

You set the LOD Bias so that when a player set's Normal Detail the entity "ALWAYS" renders with normal detail level (etc).

 

http://wiki.thedarkmod.com/index.php?title=LOD_Bias

 

The lod_normal_distance was created because certain very large objects were seen doing lod transitions up close and it was too jarring.

It basically acts as a LOD dead zone where "if you are closer than x then never perform a lod transition on this object".

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

The lod_normal_distance was created because certain very large objects were seen doing lod transitions up close and it was too jarring.

It basically acts as a LOD dead zone where "if you are closer than x then never perform a lod transition on this object".

 

I can see the value of that...player with lower level systems just never see the high-poly versions of objects. But I can't verify that it actually works...when I put my LOD settings to LOW, my door model still goes through all three stages, you just have to be closer for it to happen.

 

 

As I recall, the lod_bias spawnargs are meant to be static detail levels rather than an offset of the LOD transition distances.

You set the LOD Bias so that when a player set's Normal Detail the entity "ALWAYS" renders with normal detail level (etc).

 

So it's basically a way for the mapper to override LOD settings if they want to for some reason?

Link to comment
Share on other sites

So it's basically a way for the mapper to override LOD settings if they want to for some reason?

 

Yeah, I think that's the idea. It's a simplification similar to hide_distance that is easier to grasp than full-blown LOD.

You could use this in-place of "using difficulty spawnargs to change map performance attributes" as was done in Heart of Lone Salvation.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Not everything in the wiki article has been implemented. I've already removed a couple of references to spawnargs that aren't referenced at all in the code or any scripts. Lod normal distance looks to be another. From what I can see in entity.cpp, it means: if the player is at less than this distance, and they have object detail set to low, then ignore the low setting and calculate the lod stage as if the player was using normal object detail. But the code isn't active, unless it turns out to be handled elsewhere instead. Hard for me to browse on the phone but I'll help clear it up when back next weekend.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
    • The Black Arrow

      Hope everyone has the blessing of undying motivation for "The Dark Mod 15th Anniversary Contest". Can't wait to see the many magnificent missions you all may have planned. Good luck, with an Ace!
      · 0 replies
×
×
  • Create New...