PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

Understanding the terrain munge #80

Closed DoctorAnsem closed 5 years ago

DoctorAnsem commented 5 years ago

I was taking it out for a spin just now but there hasn't been much success. Maybe it's something I've misunderstood, but then again the error message I get leaves practically everything up for imagination.

Error munging RhenVar1.tmtrl: The request is not supported.

Essentially the terrain doesn't get munged at all. I pretty much copied the config file from the example but I'll stamp it here just in case I screwed it up.

Global:
   UseEnvironmentMapping: no

   UseZEStaticLighting: yes

   sRGBDiffuseMaps: yes

   BumpMappingType: Normal Mapping

   Rendertype: normal_ext

   DiffuseColor: [1.0, 1.0, 1.0]
   SpecularColor: [1.0, 1.0, 1.0]

Materials:
   Rhn1_far:
      DiffuseMap: Rhn1_far_diffuse
      NormalMap: Rhn1_far_normal
      GlossMap: Rhn1_far_specular
      AOMap: $null_ao
      HeightMap: $null_heightmap
      HeightScale: 0.05
      SpecularExponent: 128.0

   Rhn1_main_2:
      DiffuseMap: Rhn1_main_2_diffuse
      NormalMap: Rhn1_main_2_normal
      GlossMap: Rhn1_main_2_specular
      AOMap: $null_ao
      HeightMap: $null_heightmap
      HeightScale: 0.05
      SpecularExponent: 128.0

   Rhn1_main_2a:
      DiffuseMap: Rhn1_main_2a_diffuse
      NormalMap: Rhn1_main_2a_normal
      GlossMap: Rhn1_main_2a_specular
      AOMap: $null_ao
      HeightMap: $null_heightmap
      HeightScale: 0.05
      SpecularExponent: 128.0

   Rhn1_main_4:
      DiffuseMap: Rhn1_main_4_diffuse
      NormalMap: Rhn1_main_4_normal
      GlossMap: Rhn1_main_4_specular
      AOMap: $null_ao
      HeightMap: $null_heightmap
      HeightScale: 0.05
      SpecularExponent: 128.0

   Rhn1_main_5:
      DiffuseMap: Rhn1_main_5_diffuse
      NormalMap: Rhn1_main_5_normal
      GlossMap: Rhn1_main_5_specular
      AOMap: $null_ao
      HeightMap: $null_heightmap
      HeightScale: 0.05
      SpecularExponent: 128.0

   Rhn1_main_8:
      DiffuseMap: Rhn1_main_8_diffuse
      NormalMap: Rhn1_main_8_normal
      GlossMap: Rhn1_main_8_specular
      AOMap: $null_ao
      HeightMap: $null_heightmap
      HeightScale: 0.05
      SpecularExponent: 128.0

So there are a few things I need clarified as well. I noticed that gloss maps for terrain are now separate from the normal map in the case of normal_ext, what sort of format does it expect for it? Is BC4 sufficient for it?

Also I was curious about the whole environment mapping thing. It doesn't actually have anything to do with this, but do we have any way to actually create cube textures?

Furthermore, just so this isn't mere idle questioning there was a minor inconvenience I came across. If the terrain material file has any extra notes commented out with #, it causes an error and fails the munge.

PrismaticFlower commented 5 years ago

First a thing I forgot to do when posting the release (there's always something...) was mention that the order of sp_texture_munge and material_munge need to be switched so that sp_texture_munge is called first. I've now updated the modified munge_world.bat accordingly.

So that is likely to be causing problems, you're config file looks fine so see if making that change and then munging fixes things.

So there are a few things I need clarified as well. I noticed that gloss maps for terrain are now separate from the normal map in the case of normal_ext, what sort of format does it expect for it? Is BC4 sufficient for it?

Yes it is. But when a texture is used for terrain it'll get assembled and packed with other textures into a texture array so that SP doesn't need to split up terrain geometry based on what textures it uses.

This is why the gloss map is provided separately, because it will actually end up being packed along side the normal map material_munge just does it for you.

Because of the processing done on terrain textures I actually recommend setting the Uncompressed value for textures that will only be used for terrain. Otherwise you'll be wasting you're CPUs time compressing them with sp_texture_munge, only for material_munge to decompress them so it can process them and then compress them itself.

You can find more info on this in the second half of the Intro in the docs.

Also I was curious about the whole environment mapping thing. It doesn't actually have anything to do with this, but do we have any way to actually create cube textures?

Yes and no. Nothing ideal at least. I think the game is supposed to have a console command for it but I've never had much luck with getting it to work. You can also use something like XSI to do it, which in theory should give great results but requires you to be able to setup your map as a scene in it.

My thought with terrain is that you might have a skybox texture you want to use or something as an envmap.

Furthermore, just so this isn't mere idle questioning there was a minor inconvenience I came across. If the terrain material file has any extra notes commented out with #, it causes an error and fails the munge.

Are you sure? The library is used to load the .tmtrl files as every other config.

DoctorAnsem commented 5 years ago

Hm. I tried with the new munge_world.bat but it still hands out the same error even with a clean munge.

Are you sure? The library is used to load the .tmtrl files as every other config.

Actually I missed a key word in that particular error message before. It seems to be annoyed by a tab, as it says Error munging RhenVar1.tmtrl: yaml-cpp: error at line 7, column 1: illegal tab when looking for indentation

I had it set up like this.

   sRGBDiffuseMaps: yes

    # options: Parallax Occlusion Mapping, Parallax Offset Mapping, Normal Mapping
   BumpMappingType: "Parallax Occlusion Mapping"

When I had one note just like it further down, it was fine, oddly enough. I wonder why it caused an error here. Oh well, the solution is simple. Just avoid tabs.

PrismaticFlower commented 5 years ago

I think I've fixed what was causing the cryptic error message in the latest release. It seamed to be related to improper handling of compressed textures in material_munge. They should now be handled correctly, however I still recommend adding Uncompressed: yes to your *.tex files if they're only used by the terrain materials.

Hopefully you can play around with it successfully now.