Facepunch / garrysmod-requests

Feature requests for Garry's Mod
86 stars 24 forks source link

Overhaul Detail.vbsp #2351

Closed Battlefieldkille closed 7 months ago

Battlefieldkille commented 8 months ago

I wanted to classify this report as an Issue, but due to many changes needing to be done in order to fix everything, it should be a Request instead.

I had a map that has most of the available textures with grass sprites that I myself made for ease of access when I wanted to use a texture with a specific grass sprite. There was a single texture that had an Error on itself in Hammer Editor, but the Error would never be seen in-game. error At the time I ignored it but months later down the line, once I started to mess with decompiling the game and editing VMT files, I decided to take a closer look on why that particular texture had an Error. The VMT of that texture was using a specific Detail Type, which itself was referencing a non existent model. Most of HL2 textures that are using these Detail Types have them blocked in their VMTs.

detailtypes_original.zip < The original Detail.vbsp, a map for ease of review & custom textures made specifically to showcase all possible detail sprites/models. ( Put these custom textures in the Materials folder. ) Once you load the map you will see: ( Left Side ) - All possible Detail Types + Each model being used in them. ( Right Side ) - All textures using possible Detail Types. ( Behind ) - All models used by Detail Types.


Detail Types list

This is the list of all Detail Types, followed by whats wrong with them, what models they are using and by what texture they are being used by ( Textures that block Detail Types will be marked like this: X_texture_X ): Detail Type Whats wrong Model/s used Used by
swamp_land_001 Missing textures grass_swamp_001a.mdl grass_swamp_001b.mdl grass_tuft_003a.mdl grass_tuft_004b.mdl No texture uses this Detail Type!
swamp_land_002 Missing models grass_swamp_001a.mdl grass_swamp_001b.mdl grass_tuft_001a.mdl grass_tuft_001b.mdl No texture uses this Detail Type!
swamp_water_001 Missing textures grass_tuft_001a.mdl grass_tuft_001b.mdl grass_tuft_003a.mdl grass_tuft_004b.mdl No texture uses this Detail Type!
grassland1 Missing textures grass_tuft_004a.mdl grass_tuft_004b.mdl grass_tuft_004c.mdl grass_tuft_004d.mdl grass_tuft_001a.mdl grass_tuft_001b.mdl X_blenddirtgrass001a_X
grassland2 Missing models w_traffcone.mdl No texture uses this Detail Type!
rocks1 Missing models/textures rocksground01a.mdl rocksground01b.mdl rocksground01c.mdl rocksground01d.mdl rocksground01e.mdl rocksground02a.mdl rocksground02b.mdl rocksground02c.mdl X_blendrockdirt005b_lowfrict_X X_blendrockdirt006a_X X_blendrockdirt006b_lowfrict_X X_blendrockdirt007d_X X_blendrockdirt008c_X X_blendrockdirt008d_X X_blendrocksand008c_X X_blendrocksgrass005a_X X_blendrocksgrass006a_X
grassland3 Missing models/textures shrub_01a.mdl shrub_03a.mdl shrub_03c.mdl grass_tuft_001.mdl No texture uses this Detail Type!
test Missing textures grass_tuft_001a.mdl grass_tuft_001b.mdl grass_tuft_003a.mdl grass_tuft_004b.mdl grass_tuft_004a.mdl grass_tuft_004c.mdl No texture uses this Detail Type!
grass01 Nothing None blenddirtgrass001b
grass02 Nothing None No texture uses this Detail Type!
coastline_grass01 Nothing None blenddirtgrass005a blenddirtgrass006a blendsandgrass008a blendsandsand008a X_blendsandsand008b_antlion_X
coastline_grass02 Nothing None No texture uses this Detail Type!
coastline_redgrass01 Nothing None blenddirtgrass008a blendmuddirt001a blendrockgrass004a
coastline_redgrass02 Nothing None blendgrassgravel001a blendgrassgravel002a
coastline_redgrass03 Nothing None blendgrassgravel001b
citygrass01 Nothing None blenddirtdirt001a dirtfloor001a
redgrass Nothing None red_grass
redgrass_light Nothing None red_grass_thin
short_redgrass Nothing None short_red_grass
PerfTest1 Missing textures grass_tuft_004a.mdl grass_tuft_004b.mdl blendrockdirt001a
canal_reeds Nothing cattails.mdl blendsandrock004c canal_reeds
rocks_redgrass Missing models detail_rocks01a.mdl X_blendrocksand008d_X rocks_red_grass
street_junk Missing models detail_junk01.mdl detail_junk02.mdl detail_junk03.mdl No texture uses this Detail Type!

all_textures_with_detailtypes.zip - A zip file containing all VMTs that reference these Detail Types, I wanted to include even those Detail Types that are blocked for the sake of documentation.


All models inside the Detail Types

Now I will list the actual models that the Detail.vbsp contains, whats wrong with them, their game of origin and how they are supposed to look like: Model name Whats wrong Game of origin How its supposed to look like
grass_swamp_001a.mdl This model doesnt exist! HL2 Beta grass_swamp_001a
grass_swamp_001b.mdl This model doesnt exist! HL2 Beta grass_swamp_001b
grass_tuft_001.mdl This model has no texturing! HL2 Beta Grass_tuft_001
grass_tuft_001a.mdl This model has no texturing! HL2 Beta Grass_tuft_001a
grass_tuft_001b.mdl This model has no texturing! HL2 Beta Grass_tuft_001b
grass_tuft_003a.mdl This model has no texturing! HL2 Beta Grass_tuft_003a
grass_tuft_004a.mdl This model has no texturing! HL2 Beta Grass_tuft_004a
grass_tuft_004b.mdl This model has no texturing! HL2 Beta Grass_tuft_004b
grass_tuft_004c.mdl This model has no texturing! HL2 Beta Grass_tuft_004c
grass_tuft_004d.mdl This model has no texturing! HL2 Beta Grass_tuft_004d
w_traffcone.mdl This model doesnt exist! HL2 Beta W_TraffCone
rocksground01a.mdl This model has no texturing! HL2 Beta rocksground01a
rocksground01b.mdl This model has no texturing + Cant be seen in-game due to an Error in console: Detail prop model models/perftest/rocksground01b.mdl is using vertex-lit materials! HL2 Beta rocksground01b
rocksground01c.mdl This model has no texturing! HL2 Beta rocksground01c
rocksground01d.mdl This model has no texturing! HL2 Beta rocksground01d
rocksground01e.mdl This model has no texturing! HL2 Beta rocksground01e
rocksground02a.mdl This model has no texturing! HL2 Beta rocksground02a
rocksground02b.mdl This model has no texturing! HL2 Beta rocksground02b
rocksground02c.mdl This model has no texturing! HL2 Beta rocksground02c
shrub_01a.mdl Cant be seen in-game due to an Error in console: Detail prop model models/props_foliage/shrub_01a.mdl is using vertex-lit materials! HL2 Beta shrub_01a
shrub_03a.mdl This model doesnt exist! HL2 Beta Shrub_03a
shrub_03c.mdl This model doesnt exist! HL2 Beta Shrub_03c
cattails.mdl Works fine. HL2 cattails
detail_rocks01a.mdl This model doesnt exist! Unknown Unknown
detail_junk01.mdl This model doesnt exist! Unknown Unknown
detail_junk02.mdl This model doesnt exist! Unknown Unknown
detail_junk03.mdl This model doesnt exist! Unknown Unknown

Fixing everything

I will explain bit by bit on how to fix everything manually or you could download the few links I will provide and just replace those files. Lets start off with the Detail.vbsp itself, some Detail Types are straight up unfixable while some of them require a tiny bit of work to function as intended. Notepad is enough to modify this file, its located in: GarrysMod/garrysmod/detail.vbsp Keep in mind im not asking for the actual models to be removed, just for them to be commented out of this file.


1. Swamp Grasses, Tufts, Traffic Cone, Shrubs & Detail Junks

This is the list of the Detail Types that have models/textures that simply cannot be fixed since the files were abandoned in HL2 Beta, part of me wishes we could use those files but we obviously cant due to licensing issues. swamp_land_001 - Broken beyond repair, should be removed. swamp_land_002 - Broken beyond repair, should be removed. swamp_water_001 - Broken beyond repair, should be removed. grassland1 - Broken beyond repair, should be removed. grassland2 - Broken beyond repair, should be removed. test - Broken beyond repair, should be removed. street_junk - Broken beyond repair, should be removed. 12345678910111213151617 If the models are outright removed from these Detail Types, we will only have a completely empty Detail Type so I think we should just opt to completely remove these Detail Types. Very few base HL2 textures are using these Detail Types but those that do use them are having them blocked in their VMTs so no map will be affected by this change, the VMTs looking like this: Example1Example2


2. Tufts & Detail Rocks

PerfTest1 - I didnt want to completely remove this Detail Type as it has functional grass sprites, I instead removed these 2 models referenced within the Detail Type: Example3Example4 Fixing this would mean that any map with the texture blendrockdirt001a will now all of a sudden lose the Tuft models if the map is recompiled, but I dont know any sane mapper that would purposely use these broken models in their maps. rocks_redgrass - This is what started all of this, the first image on this post. This Detail Type is referencing a model that doesnt exist in the game at all, but it can only be seen in Hammer Editor. Despite that, I decided to remove that model in order to prevent confusion when mappers use the texture rocks_red_grass. Example5Example6 14


3. Unused Construct Grass

grassland3 - Originally, I removed this Detail Type due to it having missing models/textures much like the other Detail Types mentioned in the 1st section. But at one point while researching all of this, a guide on GameBanana listed all various detail sprites from some Valve games. One of those detail sprites was the unused gm_construct grass which was present in the older versions of the map. construct_grass.vmt & gm_construct_grass.vmt directly reference the non existent construct_grass Detail Type: Example12Example13 I realized that this would be a great opportunity to re-add this grass so it could be usable again, no HL2 texture uses this Detail Type. The original density of this Detail Type was 1500.0 but I set it to 3000.0. Example7Example8 It is also worth mentioning that before reworking this Detail Type, it tried to generate shrub_01a.mdl which cant load in-game due to Detail prop model models/props_foliage/shrub_01a.mdl is using vertex-lit materials! - This means that in order for the model to be generated on the texture, its VMT would need to have UnlitGeneric instead of VertexLitGeneric - but dont do this. I have good reason to believe that the shrub_01a.mdl we currently have isnt the original one and was instead a replacement, the old one was simply left forgotten by Valve. This is the original: Shrub_01a


4. Rocks

This Detail Type needs its own section as it cant be fixed through Detail.vbsp itself, we instead have to edit a few VMTs. I used Crowbar to unpack the VPK and to also decompile the models to figure out what VMT they are trying to use. I am unsure if there is a way to edit these files without unpacking and repacking the entire VPK file. Notepad is enough to modify these files, they are located in: GarrysMod\sourceengine\hl2_misc_dir.vpk\root\materials\perftest\rock_wasteland01a.vmt GarrysMod\sourceengine\hl2_misc_dir.vpk\root\materials\perftest\rockcliff02b.vmt GarrysMod\sourceengine\hl2_misc_dir.vpk\root\materials\perftest\rockground03a.vmt rocks1 - I was greatly disappointed when I realized we were always meant to have randomly generated rocks on some textures, this was the main inspiration to continue to try and fix all this. 1819202122232425 I had to remove rocksground01a.mdl & rocksground02a.mdl from the Detail.vbsp because they were always dark when they generated on the displacements, I tried moving their illuminated origin around to no avail, I guess im too dumb. rawr But removing rocksground01a.mdl was kind of necessary since it contained big rocks, given that these are details, they generate with no collision and its kind of ugly to interact with them because of that. However I still want this prop fixed despite removing it, the VMT for that prop needs to be modified: rock_wasteland01a.vmt - $basetexture needs to point to perftest/rock_wasteland01a. exampru1 Also removing rocksground02a.mdl because of it being dark all the time is a bit unfortunate but the prop is identical to its counterparts so its really insignificant. rocksground01b.mdl can never be seen in game due to Detail prop model models/perftest/rocksground01b.mdl is using vertex-lit materials!, meaning it needs to use UnlitGeneric shader for it to properly work. That obviously means the model itself will never have any lighting unfortunately, much like cattails.mdl. This was also mentioned in #1295. Valve Developer Community states that it can be fixed:

To allow VertexLitGeneric models, open game\client\detailobjectsystem.cpp and remove the conditional block from CDetailObjectSystem::UnserializeModelDict().

I have absolutely no clue where this file even is or whether or not it would break anything in the game if tampered with. For now lets just try to fix these rocks in a way that we know works. rockcliff02b.vmt - It uses VertexLitGeneric shader, it has to be UnlitGeneric + $basetexture needs to point to perftest/rockcliff02b. Example10 rockground03a.vmt - $basetexture needs to point to perftest/rockground03a. Example11 rocks.zip - A zip file with fixed VMTs, I double checked to make sure that modifying these 3 VMTs wouldnt break any other existing rock model.


detailtypes_overhauled.zip - The fixes I provided were all applied to this zip file aswell, it has a modified Detail.vbsp and it also has a map for ease of review to how it all looks like. I DID NOT modify any other Detail Type that didnt need fixing, only stuff from the "Fixing everything" section was changed.


Untitled Its been almost 2 decades and nobody ever tried fixing this, so why am I requesting it? This is for the mappers. Giving them more accessibility and working tools to play with, I also feel like its just a great missed opportunity to not have this working as intended.

( Side note 1: Yes im aware EP1/2 Detail Types exist and that no HL2 texture is using them, but I decided to not mention them in this post since some need their own episodic models which GMOD obviously doesnt have. ) ( Side note 2: Seems like grass_01.vmt used to have tf_forest_grass Detail Type but its blocked now, interesting. ) sarma

robotboy655 commented 7 months ago

I appreciate the detailed report and the map files.

Here's the summary of the changes:

The textures/models came from the (private) Source Engine licensee repository.

I am not sure this was worth the effort, but at least there are no longer any missing textures/models with the default detail.vbsp.

Battlefieldkille commented 7 months ago

I appreciate the detailed report and the map files.

Here's the summary of the changes:

  • Fixed the missing materials on the rock/grass models
  • detail_junk01.mdl and others replaced with junk-like models that is already shipped with the game
  • Replaced usages of grass_tuft_001a with grass_tuft_001, because the 001a variant has badly applied texture (it's a model issue)
  • Renamed test to grassland2, removed the original grassland2, it makes no sense for it to be just traffic cones
  • Replaced usage of models/props_foliage/detail_rocks01a.mdl with models/perftest/rocksground02b.mdl
  • Restored grass_swamp models & textures
  • Removed usage of shrub_03a and shrub_03c

The textures/models came from the (private) Source Engine licensee repository.

I am not sure this was worth the effort, but at least there are no longer any missing textures/models with the default detail.vbsp.

That is sick, I got no words. :heart:

Battlefieldkille commented 7 months ago

One thing I noticed: 1 rocksground01c.mdl rocksground01d.mdl rocksground01e.mdl rocksground02a.mdl rocksground02b.mdl rocksground02c.mdl These rocks all use the same texture but they are still UnlitGeneric instead of VertexLitGeneric.

Would it be a good idea to apply VertexLitGeneric to these new Grass Swamps, Grass Tufts, & old Cattails? I understand if not. 2 This is how the old Cattails model would look like with VertexLitGeneric, I observed no errors with it.

robotboy655 commented 7 months ago

UnlitGeneric is what those materials already had set, and detail props normally want that shader as well, so I don't think changing base game content like that is a good idea.

There's also the issue of detail props not accepting flashlight light at all, vertexlit or not.

Battlefieldkille commented 7 months ago

UnlitGeneric is what those materials already had set, and detail props normally want that shader as well, so I don't think changing base game content like that is a good idea.

There's also the issue of detail props not accepting flashlight light at all, vertexlit or not.

Fair.