Something that should be addressed (new map format)

Something that should be addressed (new map format)

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Something that should be addressed (new map format)

Post by Forboding Angel »

Ok, after doing a lot of experimention I have found what was washing out my textures...

It was the ground ambient color. I set it to 0 0 0 and all of a sudden everything looks uber sexy, however, there is a problem. Everything is very very dark.

To combat that I raised the sun position to a whopping 8 (y coord). Now everything looks absolutely awesome, however, one problem always leads to another.

In my experience with the old map format shadows on units (building shadows still work) dissappear if the sun position is above 1 (y coord), in the old format it wasn't that big of a deal. In the new format it is. It's a huge deal in fact.

Ground ambience actually serves a purpose now (though dubious at best). In my opinion the intensity of the sunlight must be given one hell of a serous kick in the ass.

I'm not real stock full on solutions atm, but I'm hoping that JC will catch what I'm trying to get across, know what is the cause, and what to do to correct it.

Also, raising the sun height poses yet even another problem. The higher the sun is, the more your sun direction ceases to matter. At a sun height of 8 it really doesn't matter where it's pointing because the shadows aren't really cast hardly any. Therefore the luminosity of the sun must be given a heck of a boost, so that it is more intense at lower heights.

At a sun height of 1, the sun should be as bright as it is now with a height of 10 (a la, high noon).
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

I'm not entirely sure what the problem is...
SunDir is the sun direction, which is normalized directly after loading it.

A sundir of (2 10 0) will be directly converted to (0.19 0.98 0) on start, so sundir.y > 1 can never really happen.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

jcnossen wrote:I'm not entirely sure what the problem is...
SunDir is the sun direction, which is normalized directly after loading it.

A sundir of (2 10 0) will be directly converted to (0.19 0.98 0) on start, so sundir.y > 1 can never really happen.
I understand that that is how it is coded, but that is not the case. There is a breakdown somewhere. 2 1 0 is nowhere near as bright as 2 10 0.

1 in this case should be as bright as 10 (the reason I say that is because in my experience, in the new map format, 10 is as bright as the original texture. I have an example at home that I will upload tonight).
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

Whakamatunga Riri with sun position 2 1 0

Image

Whakamatunga Riri with sun position 2 10 0

Image
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

2 10 0: sun shines with an angle of 78,7, sin 78,7 = 0,98
2 1 0: sun shines with an angle of 26,6. sin 26,6 = 0,45

0,98/0,45 = 2,18.

What I just did was calculate the difference in lighting intensity with the two sun angles, if it would be a flat map. The 2 1 0 screenshot might well be a factor 2,18 darker than the 2 10 0 screenshot, so the lighting model really seems to work correctly.

I'll post a new map renderer build in a moment, I have the map lighting completely finished with specular lighting now, and it's looking very nice.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

wow sweet :)

umm, atm I'm feeling a little dumb... Does what you said above point towards an issue or towards something else. I'm confused because you said that it defaults the height to 1 (or at least thats what I thought you meant), were you meaning something else than what I got from it?

:?: :? :?:

Edit: Ok I just reread your post twice, and now I understand what you meant. Umm, so how do I get more luminosity without massively raising the suns y position?
bamb
Posts: 350
Joined: 04 Apr 2006, 14:20

Post by bamb »

Normalizes the length of the direction vector to 1 (sum of elements squared=1). A vector's direction doesn't change if you multiply all the elements with the same number.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

SO instead of raising the sun's height, I've been changing the luminosity of the sun?

That's all fine and good, but unfortunately unit shadows dissappear when the y is set to be above 1.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

SunDir does. not. change. the luminosity. All it changes is the angle of the sun.

What changes luminosity are those four tags:

GroundAmbientColor=0.1 0.1 0.1; //ambient (non sun lit) color of ground (and grass trees etc)
GroundSunColor=0.9 0.9 0.9; //color of ground where fully sun lit (added to ambient)

UnitAmbientColor=0.1 0.1 0.1; //ambient (non sun lit) color of units (and wreckage etc)
UnitSunColor=0.9 0.9 0.9; //color of units where fully sun lit (added to ambient)


So change both "...SunColor" to some very high values for stronly lit map and units, and with high "...SunColor" values and low "..AmbientColor" you get some strong contrast between lit area and shadow area.

If the XAmbientColor is higher or equal to XSunColor, then there is no difference between sun-lit and shadow, and map gets all ugly. Make sure that

XAmbientColor < XSunColor
and that :
XAmbientColor + XSunColor < 1
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

Unfortunately ground ambient color washes out the textures.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Oh and personnaly I increase the contrast and luminosity of my bmp before running mapconv.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Unfortunately ground ambient color washes out the textures.
It did that with the last version I sent you, but I changed it.

Instead of color = Texture * DiffuseLighting + GroundAmbientColor, it's now color = Texture * (DiffuseLighting + GroundAmbientColor), similar to the SMF behavior.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

Hell Yeah!! Sweet!
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

zwzsg wrote:Oh and personnaly I increase the contrast and luminosity of my bmp before running mapconv.

Read the thread title :lol:
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

No reason this wouldn't work in the N.M.F. either. :P
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

zwzsg wrote:No reason this wouldn't work in the N.M.F. either. :P
No what I meant was that you missed the point ;p
Post Reply

Return to “Engine”