Jump to content


Photo

LOD help


13 replies to this topic

#1 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 155 posts

Posted 10 March 2018 - 12:47 PM

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:

lodprop.gif


Edited by R Soul, 10 March 2018 - 12:49 PM.


#2 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37380 posts

Posted 10 March 2018 - 01:24 PM

Try adding     "inherit"                "atdm:lod_base"


TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#3 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 155 posts

Posted 10 March 2018 - 03:10 PM

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, 10 March 2018 - 03:24 PM.


#4 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5682 posts

Posted 10 March 2018 - 04:52 PM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#5 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 155 posts

Posted 10 March 2018 - 07:32 PM

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.



#6 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37380 posts

Posted 10 March 2018 - 09:55 PM

I don't see anything immediately amiss there.

 

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


TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#7 Spooks

Spooks

    Member

  • Member
  • PipPip
  • 485 posts

Posted 11 March 2018 - 03:48 AM

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!


#8 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 11 March 2018 - 04:14 AM

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.



#9 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5682 posts

Posted 11 March 2018 - 05:53 AM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#10 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 155 posts

Posted 11 March 2018 - 09:03 AM

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, 11 March 2018 - 09:29 AM.


#11 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 155 posts

Posted 11 March 2018 - 09:44 AM

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, 11 March 2018 - 06:20 PM.

  • nbohr1more likes this

#12 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 11 March 2018 - 12:08 PM

 "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.


  • Springheel likes this

#13 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 155 posts

Posted 11 March 2018 - 02:48 PM

Thanks, that's good to know, though I can't even imagine making a model with 5000 triangles.



#14 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 11 March 2018 - 03:23 PM

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.

 


  • Abusimplea likes this



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users