DDS format ObjectLightMaps = performance boost...

For info on the site, community and 'battlefieldy' things
=ArA=DeathFromAbove
Posts: 48
Joined: Sun Oct 18, 2009 11:38 pm

Re: DDS format ObjectLightMaps = performance boost...

Post by =ArA=DeathFromAbove »

BFV uses a blend of both dds and tga files.

All of my PoE custom load screens use the PoE standard dds template with a custom image in the center. These are much more difficult to get configured through photoshop and into the format for the game to read.

Tga files on the other hand are a sinch and there are very little configuration problems with them. But either works.
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

I've heard some graphics cards may have trouble with the game using DDS textures. I normally used DXT5 as compression type, but now I recommend DXT1a (same format terrain DDS files normally uses) as I heard that this is the format BF2 uses for it's lightmaps. ;)

Also it may cause further issues if you mix TGA lightmaps with DDS lightmaps in the same map. I generally have all TGA or all DDS. Only time I have not done this is with Buccaneer Bay Night. I used TGA on all the statics except the ship wreck. Since it's lightmap channel isn't exactly top notch, I had decided to use a high res DDS file on it. I have had one user say the shipwreck appeared all white while all the other objects remained the same. (I forgot who that was now)

I have yet to find out exactly why only a few people get this issue. I believe it may be that ATI brand cards puke on the BF42 engine using DDS files on lightmaps for some reason. My only suggestion at this point is to not use ATI brand cards. :D

Also Intel brand integrated cards (I don't think Intel makes them in the form of add on cards, they are all only exist as integrated motherboard components at this point) will definitely cause possible problems as it's the worst of the bunch. Never settle with using the Intel crap, get Nvidia as that was what the Refractor 2 game engine was meant to be played on. ;)
ImageImageImage
I have cameras in your head!
reegad
Posts: 82
Joined: Mon Nov 09, 2009 3:43 pm

Re: DDS format ObjectLightMaps = performance boost...

Post by reegad »

Hmm, tried with dds files for lightmaps in a custom map.
lightmaps didnt show up, they do when i switched back to TGA... i used dxt3 with mip.
any suggestions? <3
Image
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

DXT1 format is recommended. (DXT5 is known to work, but might cause issues with ATI graphics cards)
ImageImageImage
I have cameras in your head!
reegad
Posts: 82
Joined: Mon Nov 09, 2009 3:43 pm

Re: DDS format ObjectLightMaps = performance boost...

Post by reegad »

ok thanks :)
The most amazing thing happened when i had both tga and dds files in my objectlightmaps folder...
insane lighting and the texture was used as lightmap and the lightmap was used as texture.. funky, could just be a glitch with my ATI card tho. but i lol'd x)
Image
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

My redo's of a couple night maps for my BFH mod is proving that DDS format lightmaps should be the way of the future for any future maps. If you light a map in 3DS Max, go full tilt and use DDS. It will give you full control over the ambient color of the map and you won't be a slave to the limited palette files and grayscale TGA files. You can use different color light sources and HD quality lightmaps for both statics and the terrain. :D

I redid Midnight Mayhem and I think I outdid my self with this one. It's very close in appearance of the BF2 version of the map quality wise if not better: (click to enlarge)


BF1942's BFH mod with my lightmaps:

Image

Image

Image

BF2's version with BFH's stock lightmaps: (basically how it looks in Battlefield Heroes)

Image

Image

Image

Looks like the same color scheme as the BF2 version of the map which was just about impossible to achieve using the standard pallet and grayscale TGAs typically used by BF42. Also note that the light sources are a different color from the moon light. Also something you can't do with standard grayscale TGAs. :D

Basically what I did was use a image editor to get the RGB value of of the pixels in the skydome texture and used that as the sky light color in max. Then used one of the pixels in the moon on the texture as the moon light color. Well it appears I was dead on. Before I had tried using settings derived from BF2Editor's light settings for the map, but it resulted in a map that was too bright and lacked enough contrast from the lit and unlit areas. Turns out settings used from the sky dome texture used on the map provides more accurate results. :D

Ha ha, just wait till I try one of the day maps in 3DS Max. :D
ImageImageImage
I have cameras in your head!
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Senshi »

This is pretty badass indeed.

One question though: I never quite got the hang of editing whole levels in 3ds Max. I recall there being another thread about it already, but I fail finding it atm...Importing the level terrain and the object boxes via the Rexman tools works all fine, but is there a reasonable easy way to replace all the boxes with their "correct" counterparts? I'm thinking File->Replace but that is a shitload of work in itself, not to forget the whole renaming business of every single object.

Question two: what did you use as "light glow" around the lamps or the searchlights? A simple sprite effect?
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

The process is not going to be easy no matter what you try. You will need to import the mesh of every object used in the map into max (without altering their position in the scene and save them as a max file. You don't have to save each object as a separate max file. They can all be in one max file. Just make sure they have the same name in the scene as the name as the box objects in your level. It's case sensitive too. My BFH mod does not have M2 meshes or LOD systems for any of the statics. So for me it's not too complicated as I have already set up the master object max file and keep it updated when I port new objects into the mod, so it's not much trouble getting new maps into max. However for mods like DC/Vanilla you would have to build the max file from nothing and that will take awhile no matter what.

As for my "glow" objects. They are a simple sprite effect: (they do not provide any sort of dynamic lighting obviously and is not tied to the light objects used in 3DS Max)

Code: Select all

ObjectTemplate.create EffectBundle e_glow2
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.cullRadiusScale 5
rem ------------------------------------
ObjectTemplate.addTemplate Em_glow2
rem ------------------------------------
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 1024/0/0
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 1024/0/1024
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 0/0/1024
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 0/1024/0
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 0/-1024/0
rem ------------------------------------
ObjectTemplate.timeToLive CRD_NONE/-1/0/0

ObjectTemplate.create Emitter Em_glow2
ObjectTemplate.template Fx_glow2
ObjectTemplate.lodDistance 512
ObjectTemplate.timeToLive CRD_NONE/1.001/0/0
ObjectTemplate.intensity CRD_NONE/1/0/0
ObjectTemplate.relativePositionInUp CRD_NONE/0/0/0
ObjectTemplate.looping 1
ObjectTemplate.noPhysics 1
ObjectTemplate.startProbability 1
ObjectTemplate.startAtCreation 1

ObjectTemplate.create SpriteParticle Fx_glow2
ObjectTemplate.texture glow2
ObjectTemplate.cullRadiusScale 5
ObjectTemplate.useMipMaps 0
ObjectTemplate.timeToLive CRD_NONE/1.001/0/0
ObjectTemplate.size CRD_NONE/1.8/0/0
ObjectTemplate.gravityModifier CRD_NONE/0/0/0
ObjectTemplate.rotationSpeed CRD_NONE/0/0/0
ObjectTemplate.hasStaticColor 1
(the timeToLive for the emitter must be a value greater then 1. If it's 1 or less it will never emit the sprite unless the effect is used on a projectile or if you are coding this in BFV. Seems to be a engine limitation of BF1942. BFV has new coding that provides for alternate ways of coding glow objects)

The null object child objects on the emitter are used to increase the bounding box of the invisible effect bundle object.

Code: Select all

ObjectTemplate.create DummyObject NULL_OBJECT
(yep that is a valid object class. It's an unused object class in BF42 I believe. Like SimpleObjects, you can't have child objects on DummyObjects)

This prevents the effect from turning off when the camera is turned away from the effect. This effect doesn't refresh the sprite very often so as to save on performance and also due to a certain refresh limit for non projectile effect emitters(effects tied to projectiles seem to allow for much quicker sprite emitting times). So if the player turned away from a lamp and turned back, the player would see it not have a sprite for a split second. This is tacky, so I added the null objects to force the emitter to always emit the sprite no matter if anyone is looking at it or not because the dummy child objects make the "virtual" size of the object so large that in a technical sense, the effect bundle is always visible no matter the camera angle. The emitters decide to emit or not by the bounding box size of the EffectBundle in most instances.

Oh and these would make for terrible vehicle headlights. Don't try it on them. The sprites will never move with the vehicle and it won't look right. You can however use treeMesh sprites to achieve that. I think my El Alamein map shows an example of this. It's a bit buggy on older video cards with outdated drivers though, but for most users it works. ;)

EDIT:

Video of Midnight Mayhem:



Video of Victory Village Nights which I also have redone: (has new skydome with animated clouds texture)



Riverside Rush Nights with new lightmaps:



Pretty much gives you an idea what DDS lightmaps can provide if done right. My lighting work + the weather FX used on the stormy maps pretty much make the maps look like they were pulled off a different game engine and the HUD is the only give a way that your still in BF1942. :P
ImageImageImage
I have cameras in your head!
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Senshi »

Indeed, the weather fake is impressive as well. I recall the troublesome limitations on the snowflakes back then, reaching the particle upper limit ;) . But that rain/storm looks very good, very convincing.

Your way of going on about this is what I had in mind already. I just hoped that was a less time and brainmatter-consuming way of achieving this. Hope always die last in modders ;) .

I'm curious about this because a new mapper for BG42 has created some pretty sweet night maps, sadly he's using BC42 (can't even get him to use Ed42...) so every time I play the map the modder in me comes out and cries "this could look SOOOOOO much more awesome if done right!" I already alleviated the worst problems by fine-tuning the dynamic shadow settings plus the lightmap settings and twiddling and refining the palette.pal, but there's only so much one can do with that. Especially if it's a close-combat-city map...

This dummyobject thing is new to me as well. Back then when I modded vanilla BF42 I had the problem that I wanted to alter the flak gun exp effect. Problem was that on "far range" the effect would very abruptly fade out when size changed (changeovertime). I assume if I added this dummyobject with a bit of a spread (just some 10 units in any direction) this would enlarge the BBox cull distance? If so, this might be awesome. Especially as we are currently planning a Retro-BF42-campaign with vanilla and only the old custom mod I created for it.
If I were to add these dummies to the exp effect with the huge distance (1024) like you did, would this also mean the effect would become visible from the other side of the battlefield (provided the viewdistance is sufficiently high)? If so, this would provide some even more interesting and immersive possibilities :) .

Also, I'm REALLY certain that there was a thread explaining this already, but I never did it, so a stupid question in the end: Could you give me a pointer how I'd get 3ds Max to render the lightmaps to textures?
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

View distance is probably separate and it might not help to extend it's bbox. What you can try is increasing the lod distance setting on the emitters and add a large cullRadiusScale on all the sprites/particles used on the effect. You can set it upwards of 500 and it should work at further distances.

For for rendering for lightmaps, you use the Rexman tools to "set up" the objects in the scene (found in the utilities dialog for the rexmen scripts) so that the position of the object gets added to the texture name. To render/set up the texture sizes, press the 0 key when you have objects selected. I would recommend grouping them by size. I group all small objects under one group, medium on another and large for another. I then set up different texture sizes for each group. Prior to rendering besure the "render to files only" check box is checked and make sure it isn't going to do any automatic uv mapping to any of the objects. (except for terrain, all objects should lightmap on channel 3 uvmap. Terrain uses channel 1 uvmap)

By default it will output them as TGAs. Just convert them to DDS using DDS Converter 2 or via an alternate batch conversion method. I have found that DXT1a works best as I confirm that works on ATI cards with my older computer I got recently and BF2 also uses this format for it's lightmaps. :P

Oh and be sure there is a skylight in your scene! Without one unlit areas will be ultra dark and you don't want that. How dark and the color of the unlit areas can be adjusted via the sky light once it's added to the scene. ;)
ImageImageImage
I have cameras in your head!
Post Reply