BF1942 doesn't display LODs with multiple textures

Ask questions, discuss ideas, get answers
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

BF1942 doesn't display LODs with multiple textures

Post by exe »

Hi,

I have noticed that when I create LODs with several materials/textures LOD02 and up are not shown ingame. Is that a known issue? Any ideas how to fix it?

See here for an example with the Vanilla Yamato: http://imgur.com/a/zaQrw

The only changes I did code-wise to the model:

Objects.con:

Code: Select all

rem *** YamatoLodSelector ***
LodSelectorTemplate.create DistCompareSelector2 YamatoLodSelector
LodSelectorTemplate.addLodDistance 1000
Geometries.con:

Code: Select all

GeometryTemplate.create StandardMesh Yamato_Hull_m1
GeometryTemplate.file Yamato_Hull_m1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 100
GeometryTemplate.setLodDistance 2 200
GeometryTemplate.setLodDistance 3 300
GeometryTemplate.setLodDistance 4 400
GeometryTemplate.setLodDistance 5 500
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: BF1942 doesn't display LODs with multiple textures

Post by Swaffy »

Maybe it needs the same texture for all LODs in order to calculate the MipMaps correctly? Just a thought.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: BF1942 doesn't display LODs with multiple textures

Post by exe »

All LODs use the same textures.

Another simpler example: Check the Vanilla Bf109 it only uses two textures, you won't see any changes of the model over distance (besides disappearing rudder, flaps, ailerons). Again all LODs except 01 are just ignored. It doesn't work and nobody every noticed it? :shock:

Change the Geometries.con if you have a hard time seeing it clearly.

Code: Select all

GeometryTemplate.create StandardMesh BF109_Fus_m1
GeometryTemplate.file BF109_Fus_m1
GeometryTemplate.hasDynamicShadow 1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 5
GeometryTemplate.setLodDistance 2 10
GeometryTemplate.setLodDistance 3 15
GeometryTemplate.setLodDistance 4 20
GeometryTemplate.setLodDistance 5 25
Or is there something wrong with my settings? Models with a single texture like Sherman work as intended though.
User avatar
one
Posts: 50
Joined: Thu Sep 15, 2011 4:14 pm

Re: BF1942 doesn't display LODs with multiple textures

Post by one »

Probably you have modified LOD parameters in VideoDefault.con
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: BF1942 doesn't display LODs with multiple textures

Post by exe »

Hmm but how would you explain that LODs of models with just one texture work properly.

But here's my VideoDefault.con, haven't done any changes.

Code: Select all

renderer.setFullScreen 1
renderer.fieldOfView 1
renderer.globalLodRadius 1
renderer.globalLodRadiusScaleFactor 5
console.showStats 0
renderer.allowAllRefreshRates 1
Can you say with 100% certainty that for you all LODs of multitexture models are being displayed correctly?

I did some further testing with the Bf109 and noticed that if you look very closely there is actually one LOD change. It changes to LOD02 but uses the code for LOD06 for it. Can't make any sense of it.
You will see it if you use this code:

Code: Select all

renderer.beginGlobalCluster BF109
GeometryTemplate.create StandardMesh BF109_Fus_m1
GeometryTemplate.file BF109_Fus_m1
GeometryTemplate.hasDynamicShadow 1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 5 10
Image
LOD01

Image
LOD02: I know it's LOD02 because of the black triangle just below the propeller. (Compared it with what the model looks like in 3dsmax.)

I tried a couple of seemingly nonsensical numbers like

Code: Select all

GeometryTemplate.setLodDistance 100 10
but that either crashed the game or had no effect.
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: BF1942 doesn't display LODs with multiple textures

Post by freddy »

I know the Bf109 vanishes before it reaches the view distance limit in some maps, i dont like to use it in coral sea because of that.

It doesnt have the objectTemplate.cullRadiusScale 5 that the other planes have
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: BF1942 doesn't display LODs with multiple textures

Post by Apache Thunder »

Missing textures on other lods is usually the result of incorrect materials assigned to the lod meshes. This might happen if you run a multi-res modifier to create said lods. LIke collision meshes, LOD meshes use material IDs. In 3DS Max each ID corresponds to a material in the Material dialog. This is how materials are assigned to faces on the mesh when it's exported. If you have a vehicle with more then one material assigned to it and the material IDs get reset to the same material, it will end up with the main material assigned to the whole mesh causing obvious problems.

In this case a mult-res modifier might have messed up the material assignments on the other LOD meshes or something went wrong on export. Re-Import the mesh and recheck the lods and see if the meshes all have the same material number. If they do, then that's incorrect and you'll either have to fix them manually or regenerate them.

Another issue is 3DS Max doesn't create enough materials or creates materials with the wrong names in the RS files and they don't match the material names stored in the SM file. This causes any materials in the mesh assigned to that material name to instead display the default shader, which is all black in most cases. If you see all black faces, then that's an indication of broken shaders.

You can open the SM file in the hex-editor and do a quick search to find the material names. They will be in plain text and easy to see when you come across them. Then you can compare them with what you have in the RS file to check if they are correct. If you see material names in the SM file that don't exist in the RS file, then any faces that use that material will be all black. Broken texture paths usually result in "gray" faces instead as in that case the game loads the defaulttexture file for any shaders that link to textures it can't find or load.

freddy wrote:I know the Bf109 vanishes before it reaches the view distance limit in some maps, i dont like to use it in coral sea because of that.

It doesnt have the objectTemplate.cullRadiusScale 5 that the other planes have

The game defaults to cullRadiusScale 1 I think if the command is left unspecified. Also check the lod switcher and compare the distance settings to the distance settings setup in the geometry template of the main hull. But most likely the missing CullRadiusScale command is the source of that issue. ;)


exe wrote: I tried a couple of seemingly nonsensical numbers like

Code: Select all

GeometryTemplate.setLodDistance 100 10
but that either crashed the game or had no effect.
That command is being used incorrectly. The first number is the LOD number. The first and main lod is is "0" and the next is "1", then "2", etc.

Most meshes don't have more then 6 or 7.

The second number defines what distance that lod will activate at. So for example here's a normal setup:

Code: Select all

GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 10
GeometryTemplate.setLodDistance 2 15
GeometryTemplate.setLodDistance 3 30
GeometryTemplate.setLodDistance 4 50
GeometryTemplate.setLodDistance 5 100
Each lod after usually activates at a distance greater then the one before it. If you set some to appear out of order and before previous ones, you might get a crash or it may just not work or do anything.

There's another command that works like this but is little used. Thus far I've only seen it used on the Parachute object and the geometries for soldiers. But it works for all other normal geometry templates too:

Code: Select all

GeometryTemplate.setLodRange 0 0 1 25 2 50
GeometryTemplate.setLodRange 3 128 4 256 5 512
The lod range command excepts a maximum of 6 integers. The very first defines the first lod number (they are usually always 0 0. Since the first LOD is always displayed at zero distance).

The number after that is the distance that lod ID activates. Then the number after that defines the next LOD id. It's easy to see the pattern once you know how to use the command. Since you can't define more then 3 LODs in one command you can create more that start with higher LOD ids like I've shown above.

I sometimes use this just to save on line space in the con file. But since it functions pretty much the same way as the normal setLodDistance command, you don't really have to use one over the other. :P
ImageImageImage
I have cameras in your head!
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: BF1942 doesn't display LODs with multiple textures

Post by exe »

freddy wrote:I know the Bf109 vanishes before it reaches the view distance limit in some maps, i dont like to use it in coral sea because of that.

It doesnt have the objectTemplate.cullRadiusScale 5 that the other planes have
Thanks for your help. Yes this defines when the object vanishes but I don't think it has anything to do with the LODs. I tried it anyway and as expected it didn't change anything.
Apache Thunder wrote:Missing textures on other lods is usually the result of incorrect materials assigned to the lod meshes. This might happen if you run a multi-res modifier to create said lods. LIke collision meshes, LOD meshes use material IDs. In 3DS Max each ID corresponds to a material in the Material dialog. This is how materials are assigned to faces on the mesh when it's exported. If you have a vehicle with more then one material assigned to it and the material IDs get reset to the same material, it will end up with the main material assigned to the whole mesh causing obvious problems.

In this case a mult-res modifier might have messed up the material assignments on the other LOD meshes or something went wrong on export. Re-Import the mesh and recheck the lods and see if the meshes all have the same material number. If they do, then that's incorrect and you'll either have to fix them manually or regenerate them.

Another issue is 3DS Max doesn't create enough materials or creates materials with the wrong names in the RS files and they don't match the material names stored in the SM file. This causes any materials in the mesh assigned to that material name to instead display the default shader, which is all black in most cases. If you see all black faces, then that's an indication of broken shaders.

You can open the SM file in the hex-editor and do a quick search to find the material names. They will be in plain text and easy to see when you come across them. Then you can compare them with what you have in the RS file to check if they are correct. If you see material names in the SM file that don't exist in the RS file, then any faces that use that material will be all black. Broken texture paths usually result in "gray" faces instead as in that case the game loads the defaulttexture file for any shaders that link to textures it can't find or load.
Tried all that but sadly to no avail. As you said if it was just missing a texture or wrong material ID it would show up as grey but it doesn't even show the correct mesh. Thanks for the tip with the Hex editor I opened the .sm file and it only lists materials from the .rs file, so no problems there. As mentioned I haven't done any changes to the Bf109 model this is pure Vanilla. I also checked other MultiSub models like the M10, Mustang etc. and all of them have max one LOD change.

Again please check if it is the same for you, so I know if there's something wrong on my end or indeed BF1942 in general. That would help me the most at the moment I think, thanks.
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: BF1942 doesn't display LODs with multiple textures

Post by freddy »

exe wrote: I also checked other MultiSub models like the M10, Mustang etc. and all of them have max one LOD change.
I think your right.
edit:

User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: BF1942 doesn't display LODs with multiple textures

Post by Swaffy »

Well because there's a simpleMesh and a standardMesh. I think this thread is about the standardMesh.

After a certain distance the standardMesh reaches its last LOD and the game switches to the simpleMesh for long distances. This is why some HandWeapons seem to disappear when far away, cuz they don't have a simpleMesh to switch to.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Post Reply