Jump to content
The Dark Mod Forums

LOD help


R Soul

Recommended Posts

Is there something I have to do to enable the LOD system for an ordinary object (i.e a func_static)? I created a model (the higher poly version), then added an lod_1_distance of 300 and a model_lod_1 referring to the lower poly version, but in game I only see the higher poly version. I've also placed a "atdm:brazier_large01" entity which confirms that LODs are working when set up correctly.

 

Do I have to use an entity or use some other class?

 

I've tested the lod 1 version as an ordinary model and it shows up correctly in game.

 

Properties:

post-2153-0-48866400-1520704063_thumb.gif

Edited by R Soul
Link to comment
Share on other sites

That didn't work, but what did work was to use atdm:lod_base as the classname instead of func_static. I'm aware of the possibility that something may work, but with consequences, so do you think that solution is okay or will something explode?

Edited by R Soul
Link to comment
Share on other sites

The typical approach would be to create your own entity, instead of setting up lod for every instance in DR manually. The entity definition looks like this:

entityDef nameOfEntity // name it whatever you want
{
    "inherit"                 "atdm:lod_base"
    "model"                 "..."                          // high poly model
    "model_lod_1"      "..."                          // lower poly version
    "lod_distance_1"  "300"                       // distance setting
    ... // etc
}

This way you can just place the entity in your map using right-click -> create entity (which is easier as you may wanna use several instances of this entity).

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

Still no success.

 

In my FM folder I have 'def/architecture.def' with the following:

entityDef atdm:stone_arch_01 // 3d stone bevelled arch
{
	"inherit"				"atdm:lod_base"
	"editor_displayFolder"	"LOD/architecture/arches"
	"model"					"models/darkmod/architecture/arches/stone-arch-128.lwo"			// high poly model
	"model_lod_1"			"models/darkmod/lights/non-extinguishable/streetlamps/roundstreetlamp_02.lwo"		// lower poly version
	"lod_distance_1"		"600"				// distance setting
}

Notice that I'm using a completely different model for lod 1 so I can be absolutely sure that I'll notice a change (LOD changes are meant to be subtle, after all).

 

It appears in the entity class tree as fms/atdm:entity_base/func_static/atdm:lod_base/atdm:stone_arch_01. The other four key-values set in the file are present in the properties pane.

 

The entity is created correctly in the 2d view and I can see its properties, which all match the above. The high poly model shows up in game but it doesn't change no matter what distance I try.

Link to comment
Share on other sites

I don't see anything immediately amiss there.

 

Make sure your LOD setting in the menu is set to Normal.

Link to comment
Share on other sites

R Soul, make sure you set dist_check_period to a numeric value in your def. That setting determines how often the game should check if the player's past the LOD switch distance and perform the switch. A value of 1 = one second, 0.5 = half a second, so on. It's integral for the LOD system to actually work.

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Link to comment
Share on other sites

AFAIR, you don't need to inherit anything in your model for LOD to work, but you need to have certain set of spawnargs, otherwise it won't. I'll check that on Monday, since I'm away from home, but AFAIR you have to include at least hide_distance (can be set to -1, if you don't want to hide your model), dist_check_period, and lod_1_distance.

Link to comment
Share on other sites

All relevant spawnargs (except the specific ones like model) are defined in the entity definition for atdm:lod_base and are inherited, so you normally don't have to set them.

 

entityDef atdm:lod_base
{
    "inherit"                "func_static"

    "editor_displayFolder"    "Nature"
    "editor_usage"            "Don't use. The base class for TDM nature items, that vanish a certain distance from the player. Good for huge forests."

    "editor_color"            ".3 0.8 0.2"
    "hide_distance"            "2000"
    "dist_check_period"        "0.7"            // in seconds, 0.7 second is ok if the player moves slowly
                                            // will be automatically adapted to player speed by code
    "lod_normal_distance"    "500"            // entities closer than this will ignore a LOD BIAS under 1.0 (e.g. only Object Detail "Normal" and better)

    // does not work yet:
//    "lod_fadeout_range"        "300"            // do not pop, just fade out

}

As Springs said I would recommend checking your lod settings. The distances defined in your lod definition get multiplied with a constant depending on the setting choosen, ranging from 0.5 to 3.0. So if you have the highest setting set, your model would change at a distance of 1800 (600*3).

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

Can the LOD posts be split in to a separate thread please? I think it'll make it easier to follow than if we have two people's questions running simultaneously.

 

edit: Thanks, that was quick.

 

I've tested with other LOD entities and they all switch models just fine (even when I use my two models), so I think the problem is related to the 'def' being in my FM folder rather than the TDM installation.

 

The hide distance works properly.

Edited by R Soul
Link to comment
Share on other sites

It's working now. The distance property name should be lod_1_distance, not lod_distance_1.

 

I appreciate the advice, and I've learned a bit about entities. : thumbs up smiley:

 

def file:

entityDef atdm:stone_arch_01 // 3d stone bevelled arch
{
    "inherit"                "atdm:lod_base"
    "editor_displayFolder"    "LOD/architecture/arches"
    "editor_usage"            "Stone arch with 3D bevelled edges. ~800 polys. LOD 1 model ~500 polys."
    "model"                    "models/darkmod/architecture/arches/stone_arch_128.lwo"            // high poly model
    "model_lod_1"            "models/darkmod/architecture/arches/stone_arch_128_lp1.lwo"        // lower poly version
    "lod_1_distance"        "600"                // distance setting
}

edit: Note to self and anyone reading this: don't use hyphens in filenames. Other things may get messed up.

Edited by R Soul
  • Like 1
Link to comment
Share on other sites

"Stone arch with 3D bevelled edges. ~800 polys. LOD 1 model ~500 polys."

 

While it's always good to know how the LOD system works to have better control over performance, there's no need to use it for such low differences in polygons. It you wanted to have a nice curve and it would have over e.g. 5000 triangles in total, that might be a problem in more complex scenes, longer views etc. Going from 800 to 500 polys is a waste of CPU time for LOD thinking entities.

  • Like 1
Link to comment
Share on other sites

That's easier than you think. This model is 3100 triangles, but they convey certain, quite complicated shape:

obraz.png

 

And that's all what really is to low poly: you use as little of them as possible to achieve certain shape, along with all other tricks you know (baking normals, using smoothing groups in a certain way etc.)

 

This is a very good presentation on the subject btw.

 

  • Like 1
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

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...