Special Aircraft Service

The SAS Factory - Tech Help, Ancient Mods etc. => Tech Help (other than BAT or IL-2 Great Battles) => Tech Help : Making Mods => Topic started by: vpmedia on April 05, 2012, 02:46:11 AM

Title: Problem with object lighting
Post by: vpmedia on April 05, 2012, 02:46:11 AM
started to notice this since DBW I guess, from the side  angle objects looks (1st pic) ok but from different angle it  suddenly becomes 100% white, its way too shiny, too much lighting (2nd pic) + its very unrealistic because I was never blinded in real life by a fuel tank...

how do i fix it?

(https://www.sas1946.rocks/images/imageshit/dead/dead.gif)
Title: Re: Problem with object lightning
Post by: Dakpilot on April 05, 2012, 03:04:07 AM
Have also noticed this with a few things, also some A/C and vehicles, more than before, so you are not alone.

Also some aircraft just do not shine, try a Stuka, even with planeshine turned up, and carsmarsters light and a high quality skin it seems to remain very matte, in the inverse of the shiny tank maybe there is something there?
Title: Re: Problem with object lightning
Post by: vpmedia on April 05, 2012, 11:21:48 AM
Thanks, its more complicated than I thought...I guess I can live with a bit of shine :)
I was hoping for a global parameter in some file like landlight.mat just for objects.
Title: Re: Problem with object lightning
Post by: vpmedia on April 05, 2012, 11:14:48 PM
Tthanks a lot mate!

It was the parameter "SpecularPow 16" in the file tex1_metall_lod0.mat

Default for planes is 4 or 5, same for objects I think, everything higher will be resulted in a burnt out picture (too much white light), so now all i need to do is extract every mat look for that string and batch replace it with specularpow 4.

Cheers
Istvan
Title: Re: Problem with object lightning
Post by: vpmedia on April 05, 2012, 11:57:44 PM
after further checks the problem appears only with Egypt,Tow,Wflyer objects + some weapons

wflyer object meshes (trucks, tanks and artillery) also have a tendency to disappear ingame...do you know the reason for that?
Title: Re: Problem with object lightning
Post by: just champi on April 06, 2012, 01:16:27 AM
Quote
It was the parameter "SpecularPow 16" in the file tex1_metall_lod0.mat

Default for planes is 4 or 5, same for objects I think, everything higher will be resulted in a burnt out picture (too much white light), so now all i need to do is extract every mat look for that string and batch replace it with specularpow 4.

I can't back up this with scientific data, but after being tinkering with materials a little in the past, I found that in IL2, Specular value refers to how much shiny is the specular spot in a surface, so a higher value gives a brighter spot, and viceversa.
SpecularPow value refers to how big is that specular spot in the surface, so a higher value gives a much more spread over the surface specular spot and lower values a much more concentrated spot.
 As the color of specular spot is close to white, when the value of SpecularPow is high enough, the white colour, covers almost all the surface, and combined with the shinyness of the Specular value is what gives this burnout look to objects (as it shows in your lower picture)
Also I believe that SpecularPow should be given only in power of two values. (so maybe better not to use 5 as value)
In short: Specular-> brightness of the specular spot
SpecularPow-> size of the specular spot (power of two values)
hope this help you to better understand.
Title: Re: Problem with object lightning
Post by: vpmedia on April 06, 2012, 01:36:38 AM
champi dont forget I released a 'no planeshine mod' not so long ago ( https://www.sas1946.com/main/index.php/topic,20788.0.html ), that would assue some knowledge of the issue i think ;)

after checking the tow fueltank I've found that the fuel tanks body has its 3d lighting turned off and that the top metal part has too much of it and they have different mat files (tex1_lod0.mat and tex1_metall_lod0.mat) - same problem exist with the buildings so they look flat without 3d lighting

conclusion: the settings need to be corrected in all ToW mat files
whoever imported them wasnt aware of the things just champi wrote above

Title: Re: Problem with object lightning
Post by: vpmedia on April 06, 2012, 01:45:08 AM
after testing I think that Specular Pow is the amount of white being added when sunlight is directly reflected back to your eye  and Specular is the amount of average 3d lighting because I cant seem to change size of reflective area

so specular 0.4 means 3d lighting by increasing lightness of colors by 40%

specular pow 4 means multiple specular 4 times or increase pixel lightness (dunno which of the two) when sun angle is at 90°


I've found that these stock values work best:

Code: [Select]
  Ambient 1.0
  Diffuse 1.0
  Specular 0.4
  SpecularPow 4
Title: Re: Problem with object lightning
Post by: just champi on April 06, 2012, 02:41:58 AM
my apologies vpmedia, I hope I didn't sound to you like a smart ass.
 I was still a bit asleep and with my brain off, but I will take the oportunity to thank you for your planeshine mod that I've being enjoying with great pleasure so far.
Seemed to remember that I took some screenshots back then, but didn't find any. I'll try to get back to it when I can, but probably will just confirm your findings. I find the lightning issue insteresting anyway, so, thanks for the correction.
Title: Re: Problem with object lightning
Post by: vpmedia on April 07, 2012, 12:31:35 AM
You were right Boomer, none of the ToW objects had proper 3d lighting.
These 150 objets use more almost a thousand mat files so correcting them is a huge task in itself.
Do you need the files if I finished them?
Title: Re: Problem with object lightning
Post by: vpmedia on April 07, 2012, 12:37:38 AM
my apologies vpmedia, I hope I didn't sound to you like a smart ass.
 I was still a bit asleep and with my brain off, but I will take the oportunity to thank you for your planeshine mod that I've being enjoying with great pleasure so far.
Seemed to remember that I took some screenshots back then, but didn't find any. I'll try to get back to it when I can, but probably will just confirm your findings. I find the lightning issue insteresting anyway, so, thanks for the correction.

I'm not a too sensitive person, so I took no offense plus I dont know everything about this game so all info is welcomed!
Title: Re: Problem with object lightning
Post by: vpmedia on April 07, 2012, 02:32:59 AM
I was doing further checks and the same problem exist with "New Vehicles Package" in this pack
https://www.sas1946.com/main/index.php/topic,19921.0.html
they often have specular pow 32, stock is 4
also found similar problem with wflyer vehicles....wrong values seem to have spread in all categories

...and this all started by me wanting to correct a weird looking fuel tank  :'(
Title: Re: Problem with object lightning
Post by: Mick on April 07, 2012, 02:47:48 AM
... this is for sure a very useful find Istvan, as it is especialy irritating to watch vehicules disappear for no obvious reason ...!!

I'll give a look at all my Wflyer mat files and correct them by replacing their value with 4 ...

THX for sharing mate ...  ;)
Title: Re: Problem with object lightning
Post by: vpmedia on April 07, 2012, 03:06:58 AM
Mick, we did not know the reason for the disappearing meshes with Wflyer stuff yet

Imho correcting Specular Pow 32 to 4 wont fix that, only the wrong 3d lighting
Title: Re: Problem with object lightning
Post by: Mick on April 07, 2012, 03:43:24 AM
... ah, OK, I must have misunderstood then, thanks for telling me, but I'll however take a look at the mat files ...  ;)
Title: Re: Problem with object lightning
Post by: vpmedia on April 07, 2012, 05:47:34 AM
you can place the object in fmb change the values select a different object then go back to the first and see the changes so you dont have to restart the game
Title: Re: Problem with object lightning
Post by: vpmedia on April 07, 2012, 06:51:14 AM
You were right Boomer, none of the ToW objects had proper 3d lighting.
These 150 objets use more almost a thousand mat files so correcting them is a huge task in itself.
Do you need the files if I finished them?

Yes please,
if you could post a link to the corrected tanks files I would download it  ;)

This cool utility enables you to instantly find and replace words and phrases across multiple files and folders>
http://www.digitalvolcano.co.uk/content/textcrawler/tcdownload

It seems,you've opened up a regular pandora's box with all these objects  :D
ToW,Vehicle,these and those objects...

Really great find though,
it is nice even to just know now what is wrong with all these objects  :)



I'm using Total Commander which is able to find strings in files without the need to opening them, plus it can list all the files in a listbox from where I can drag all at once into Ultra Edit where I do the batch find/replace thing. Here's the link to the corrected ToW objects: http://www.vpmedia.eu/il2/zip/TEXTURES_Buildings3_UP3.zip

After testing I've found these values to give the best look for the Tow objects:

[LightParams]
  Ambient 1.0
  Diffuse 1.0
  Specular 0.2
  SpecularPow  1
  Shine 0.0
Title: Re: Problem with object lightning
Post by: vpmedia on April 08, 2012, 12:13:49 AM
I'm glad youre interested in this...theres going to be a larger pack (one zip file to download) later with all my mods in different subfolders including lots of fixes for buildings.
Title: Re: Problem with object lightning
Post by: Mick on April 08, 2012, 01:40:13 AM
THX in advance Istvan ...  ;)

I took a look at Wflyer's tank packs and found there are a lot of .TGAs that are not in indexed colours, some of them even being as big as 4Mb  ...  ???

So I indexed them all, but I now have a few glitches (mainly in the sides of a few tanks) since some of the TGAs shouldn't be indexed, I suppose because they have alpha layers or something like that ...  ???

So this morning I am going to use my back up (old guys always back up first ...  :P) to fix that ...  ;)

I also corrected all the SpecularPow 16 or 32 that I found and there were a lot ...
Title: Re: Problem with object lightning
Post by: vpmedia on April 08, 2012, 04:00:11 AM
THX in advance Istvan ...  ;)

I took a look at Wflyer's tank packs and found there are a lot of .TGAs that are not in indexed colours, some of them even being as big as 4Mb  ...  ???

So I indexed them all, but I now have a few glitches (mainly in the sides of a few tanks) since some of the TGAs shouldn't be indexed, I suppose because they have alpha layers or something like that ...  ???

So this morning I am going to use my back up (old guys always back up first ...  :P) to fix that ...  ;)

I also corrected all the SpecularPow 16 or 32 that I found and there were a lot ...

I did that 4Mb-1Mb conversion for the artillery by resizing image, in hope to stop dissappearing meshes.
I'm not sure about using indexed color images as texture...this issue needs to be tested somehow or even ask TD about the standards. I'm pretty sure that converting a file with alpha channel to 256 color will delete the channel and the result is not nice.

Other thing:  if Specular is 0.0 then SpecularPow has no effect.
Title: Re: Problem with object lightning
Post by: vpmedia on April 09, 2012, 01:50:36 AM
Well, thanks for the interest. I categorize these as minor proplems since they got no effect on gameplay but its good to fix them anyway. I started with the ToW stuff because those looked flat without Specular lights.
For the indexed color procedure I hope that you've used Photoshop :)
Title: Re: Problem with object lighting
Post by: wolfiz on June 09, 2015, 10:30:50 PM
I'll bump a 3 year old thread with some of my own experiments in object lighting and popup distance, particularly buildings (https://scontent-atl1-1.xx.fbcdn.net/hphotos-xat1/t31.0-8/11288937_884440444946750_8062997948447463387_o.jpg)
Title: Re: Problem with object lighting
Post by: WxTech on June 10, 2015, 03:30:49 PM
'Specular' controls the degree of shininess of a surface.

'SpecularPow' controls the smoothness of the surface, and thus the degree of concentration of the specular light. Increasing this makes the surface more mirror-like, with a narrower range of angle over which the specular light is seen. I commonly use 16, or even 32, for metallic surfaces like storage/fuel tanks.
Title: Re: Problem with object lighting
Post by: vpmedia on June 10, 2015, 11:52:47 PM
This whole topic is about people using wrong values like 16 or 32. :)

Specular pow is a multiplier, it increases the amount of white in each pixel by x so with a 32 value you will get 100% white for most colors which is not realistic. Stock is specular 0.4 and specular pow 4, some of the modded 3d models require less. In some cases the devs turned specular reflection (thats what its called) off because of errors in object lighting, in many cases they probably forgot about it. Every object requires some level of specular reflection, without it they look flat. For a plane 0.4/4 is fine, for a house/ship/tank the optimal value is between 0.1 and 0.2 imho. I also had to extract most modded cockpits to correct these errors. Its very easy to do with a text editor like UltraEdit.

I already corrected many errors with these mods:
planes of UP3/DBW: https://www.sas1946.com/main/index.php/topic,20788.0.html
stock and modded ships: https://www.sas1946.com/main/index.php/topic,24382.0.html
Title: Re: Problem with object lighting
Post by: wolfiz on June 13, 2015, 11:28:10 AM
Thanks for the replies and input getting this subject active again. What I was looking for was a more neutral look for buildings, not too dark and colorless, and with just the slightest bit of reflection, so I don't see rows of glaring shiny buildings always popping up.

I'm using TextCrawler Free, and it will batch search and replace entire sections of txt files with the exact indentation and spacing very quickly. I've used a lot of different utilities before to do these kinds of batch functions, and this is definitely one of the easiest and best.
http://www.digitalvolcano.co.uk/textcrawler.html (http://www.digitalvolcano.co.uk/textcrawler.html)

This is almost what I was looking for: clear, 12:00pm on Smolensk map
  Ambient 1.5
  Diffuse 0.2
  Specular 0.1
  SpecularPow 2
  Shine 0.0
....

(https://scontent-atl1-1.xx.fbcdn.net/hphotos-xtp1/t31.0-8/11270520_885963794794415_1622177837879985207_o.jpg)
.....
I might have Jeronimo's new hangars in a different folder, so is why they are not as neutral, need to check on that.

Ambient values under 1.0 become very dark grey and flat, and with the higher specular, dark and shiny, so this might be close to a good mix of values. Also I'm using Avala's Terrain lighting values with CloudShadows.mat and Landlight.mat, so that is affecting the object lighting too.

I havent tested dawn/dusk yet, but I can continue to tweak the values on my entire 3do/buildings folder very easily and test in flight in just a few minutes and compare screenshots.

EDIT: At dusk these setting are way too bright, so apparently any ambient settings over 1.0 are unusable..so back to the drawing board to find a good balance. One problem is the actual lighting distance on objects is much shorter than the object appearing distance.
Title: Re: Problem with object lighting
Post by: wolfiz on June 14, 2015, 08:37:06 AM
Object lighting distance is directly related to LOD values in the .msh

....
(https://scontent-atl1-1.xx.fbcdn.net/hphotos-xap1/v/t1.0-9/1920026_886301124760682_5416997795226879719_n.jpg?oh=0563e80c577032ea2054d6e1a27aed79&oe=562E10CA)

.....

Using the (modded since it already had a msh in txt format - credit needed) industrial chimneys as a reference, since they display lighting at a much farther distance that most objects, while the small FactoryHouse1 was losing light and disappearing at a very short distance. Converted to txt and new lod values the house now displays the same as the chimney.. In this screenshot I am zoomed in: when I zoom back out to default FOV the smaller building in the town will disappear until I get closer.
Title: Re: Problem with object lighting
Post by: WxTech on June 14, 2015, 06:23:28 PM
I prefer to not treat all buildings the same. Metal storage tanks are given a higher specular value of 0.3-0.5 and SpecularPow 16. Other buildings with metal roofs I give Specular 0.15-0.3 and SpecularPow 8-16. Sure, the non-metallic parts like brick walls will take on some shine, but this appears only when the Sun is nearly on the horizon and one's viewpoint is from ground level.  I can put up with that in order to have more 'dynamically' lit roofs as seen from above.

Incidentally, I modded the tops of the big industrial tanks which have noticeably rounded tops. I made those bulging tops--which to me look a bit cartoonish--significantly more gently curved. And this also looks better with my metallic shine settings.

Another thing worth trying. Make the Marsten mat (called PCP) runway surfaces shinier. I use Ambient 1, Diffuse 1, Specular 0.15 and SpecularPow 8. I've seen bits of real PSP planking in the Arctic, and it does have a diffuse shininess.
Title: Re: Problem with object lighting
Post by: wolfiz on June 16, 2015, 09:15:58 AM
Here's an example of the difference with dusk lighting with stock  Ambient 1.0  Diffuse 1.0  Specular 0  SpecularPow 0  Shine 0.0 on the Crimea CountryHouse1 and   Ambient 0.8 Diffuse 0.5 Specular 0.1 SpecularPow  16 Shine 0.0  on the Crimea CountryBarn. I think I'll use the modded value for now and adjust it with more testing over time. 
....

(https://scontent-atl1-1.xx.fbcdn.net/hphotos-xta1/t31.0-8/11099479_887145691342892_6725477143416292006_o.jpg)

...

Here's what I wanted to achieve with LODs: the sun lighting on statics at dusk will disappear at distance when the lighted object renders less than 1 pixel. The downside is the increased CPU use, and there still seems to be an static object limit per cell you notice when over large cities, so swaths of buildings still are popping up when nearby..

...

(https://scontent-atl1-1.xx.fbcdn.net/hphotos-xtf1/t31.0-8/11402368_886939861363475_7499140564320932436_o.jpg)