Specular Tex issue

Specular Tex issue

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Specular Tex issue

Post by aeonios » 13 Feb 2015, 03:45

I've been trying to set up a specular texture for my map, but for some reason it isn't working properly. The texture is the same size as my diffuse texture and should match up properly.

I suspect that the problem is with the image format being wrong. I tried png and that didn't work, but after checking the image properties I saw that it had a 32bit color depth. So I tried setting the image to indexed mode->255 colors (optimized) in gimp and re-exporting to get a properly 8-bit depth image like the wiki says it should be. Still no luck, so I tried using a bmp image instead but with the same result.

I'm certain I set mapinfo.lua to point to the spectex correctly, and that I put it in the ./maps directory inside the map's sdd. Is there some special setting I need to know about in gimp?
0 x

User avatar
enetheru
Posts: 627
Joined: 11 Jun 2010, 07:32

Re: Specular Tex issue

Post by enetheru » 13 Feb 2015, 03:57

No special setting are needed, also it can be any size AFAIK its stretched over the terrain.

chuck up your mapinfo.lua somewhere to look at.
0 x

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Specular Tex issue

Post by aeonios » 13 Feb 2015, 04:04

enetheru wrote:No special setting are needed, also it can be any size AFAIK its stretched over the terrain.

chuck up your mapinfo.lua somewhere to look at.
Does that mean I can use a standard 32bit RGBa profile?

http://pastebin.com/6eHzZEXh
0 x

User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Specular Tex issue

Post by zoggop » 13 Feb 2015, 07:29

i don't see any problem with the mapinfo.lua, maybe someone else does? i usually use RGBa .tga files, but a png should work. red comet v1.2 uses a 32 bit png as a specular. i believe you need all four channels for specular. i assume by 8bit depth, 8bit per channel was meant.

maybe upload the image somewhere?
0 x

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Specular Tex issue

Post by aeonios » 13 Feb 2015, 08:57

zoggop wrote:i don't see any problem with the mapinfo.lua, maybe someone else does? i usually use RGBa .tga files, but a png should work. red comet v1.2 uses a 32 bit png as a specular. i believe you need all four channels for specular. i assume by 8bit depth, 8bit per channel was meant.

maybe upload the image somewhere?
I think the problem is probably that I can't see speculars at all. I thought I could, but I see nothing on red comet v1.2 that looks like a specular (ie shinies that move with camera angle, which I assume is what it's supposed to look like). Spring and intel graphics don't get along very well, so I'm not terribly surprised, but it kind of sucks that I can't see what it looks like to test it. I do have advanced map shading set to 1, I at least checked on that.

If I understand correctly, the specular map is applied as a color add, so I should probably use the same colors as the diffuse (for gold metal spot graphics) and not a brightened version, right?
0 x

User avatar
enetheru
Posts: 627
Joined: 11 Jun 2010, 07:32

Re: Specular Tex issue

Post by enetheru » 13 Feb 2015, 09:25

Given this is the case, feel free to zip it up and put it on dropbox or something, I'll send back screenshots if you like. otherwise, you can really only simulate in blender what it might look like.

i used to do that before i upgraded my computer and got an nvidia card.
0 x

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Specular Tex issue

Post by aeonios » 13 Feb 2015, 11:44

enetheru wrote:Given this is the case, feel free to zip it up and put it on dropbox or something, I'll send back screenshots if you like. otherwise, you can really only simulate in blender what it might look like.

i used to do that before i upgraded my computer and got an nvidia card.
Well, that's less than ideal but I guess it works.

https://www.dropbox.com/s/jkyzdkqk4lvh5 ... 2.sd7?dl=0

current dev version.
0 x

User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Specular Tex issue

Post by zoggop » 13 Feb 2015, 19:00

are you running windows? i have an intel i5 a few yeas old, and spring advanced map shading & shadows have been broken for me most versions in windows. there was one version that worked, it might've been 95. bizarrely, the same hardware works perfectly with spring in linux, so if you dual boot try that.

don't have time to reboot right now, but i can see that your specular image is 100% opacity the whole thing, and approaches white on the metal spots, which will make those metal spots blindingly shiny if the sun's at the right angle. these are the things you could test easily if advmapshading worked :-(
0 x

User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Specular Tex issue

Post by qray » 13 Feb 2015, 19:32

aeonios wrote:If I understand correctly, the specular map is applied as a color add, so I should probably use the same colors as the diffuse (for gold metal spot graphics) and not a brightened version, right?
I would even rather try a darkened version (especially when using together with splat detail textures). Else it probably get's too shiny.

Screenshots:

With adv. map shading:
Image

Without adv. map shading:
Image

Specular image seems to work just fine. Could probably be resized to a smaller size without noticable impact.

Overall specularity is very (too?) high (the glare on the mountains is blinding in-game). AFAIK, tuning down groundSpecularColor (which is not set at all) would help here. Also groundDiffuseColor is set to 2.0, 2.0, 2.0 ; seems very high to me.
Attachments
woadvmapshading1.jpg
Without Advanced Map Shading
(66.26 KiB) Not downloaded yet
wadvmapshading.jpg
With Advanced Map Shading
(78.57 KiB) Not downloaded yet
0 x

User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Specular Tex issue

Post by jK » 13 Feb 2015, 20:00

iirc spectex uses all channels of the RGBA.

RGB for the specular color & A for the reflection term.


edit: yes it does, see https://github.com/spring/spring/blob/d ... .glsl#L369
0 x

User avatar
smoth
Posts: 22300
Joined: 13 Jan 2005, 00:46

Re: Specular Tex issue

Post by smoth » 13 Feb 2015, 21:43

specular uses all colors. Confirming


Specular is NOT for making the map brighter. It is for simulating a shiny surface. If you use it to brighten your map, you are going to have issues with it at different viewing angles.
0 x

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Specular Tex issue

Post by aeonios » 14 Feb 2015, 02:53

woah, ok the background specularity really is too high. I can't even tell what the mexes look like with all that noise, and it's really not supposed to look like that. The specmap is also pure black except for the metal spots and should contribute nothing at all to the specularity of anything else. I suspect a bad setting in mapinfo.

Unfortunately, I had to rip gentoo off this machine and destroy it with windows in order to get zero-k working. :| On the other hand linux had some weird performance issues with epic gui hangs and things. As is I'm basically stuck with windblows.

EDIT: ok new version is up here https://www.dropbox.com/s/c2mdriza0kfc5 ... 3.sd7?dl=0

I turned down anything that should affect general specularity so nothing except the mexes should have any noticeable shine.
0 x

User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Specular Tex issue

Post by zoggop » 14 Feb 2015, 04:20

i just updated my intel gpu drivers and suddenly advmapshading and shadows work in windows spring 98. you might try that, too? http://www.intel.com/p/en_US/support/detect

the problem is your specmap.png has no alpha channel. as far as i can tell, a png's opacity channel is not the same as an alpha channel, and an alpha channel cannot be saved in a png. i think this is why i use tga. it's less confusing. here's my suggestion for the specmap: https://dl.dropboxusercontent.com/u/275 ... pecmap.tga
0 x

User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Specular Tex issue

Post by zoggop » 14 Feb 2015, 04:42

Image
took this screenshot with the following lighting settings:

Code: Select all

		--// dynsun
		sunStartAngle = 0.0,
		sunOrbitTime  = 9000.0,
		sunDir        = { -0.25, 0.5, -0.5 },

		--// unit & ground lighting
		groundAmbientColor  = {0.5, 0.5, 0.5},
		groundDiffuseColor  = {0.5, 0.5, 0.5},
		groundSpecularColor = {1.0, 1.0, 1.0},
		groundShadowDensity = 0.8,
		unitAmbientColor    = {0.4, 0.4, 0.4},
		unitDiffuseColor    = {0.7, 0.7, 0.7},
		unitSpecularColor   = {0.7, 0.7, 0.7},
		unitShadowDensity   = 0.8,
		specularExponent    = 100.0,
okay i'll stop being a busybody now
0 x

User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Specular Tex issue

Post by qray » 14 Feb 2015, 05:11

zoggop wrote:...as far as i can tell, a png's opacity channel is not the same as an alpha channel, and an alpha channel cannot be saved in a png.
Are you sure? Wiki states that PNG and TGA are valid formats. Would be interesting to confirm this.
0 x

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Specular Tex issue

Post by aeonios » 14 Feb 2015, 05:36

zoggop wrote:i just updated my intel gpu drivers and suddenly advmapshading and shadows work in windows spring 98. you might try that, too? http://www.intel.com/p/en_US/support/detect
Thanks, I think that should help. Kinda wish I'd known about that earlier.
zoggop wrote:the problem is your specmap.png has no alpha channel. as far as i can tell, a png's opacity channel is not the same as an alpha channel, and an alpha channel cannot be saved in a png.
No, png is fully capable of alpha. I applied the mex graphic to my map as a png with alpha border. I merely took the resulting layer and pasted it on a black bg for the specmap. :P I didn't bother using alpha for two reasons:

First is that if alpha is zero it creates visual artifacts, but a black bg should produce zero specular reflection regardless. It also compresses very well.

The second is that, since I can't see what I'm doing I can't make any sensible adjustments to it either. I think adjusting the alpha of the whole image to control the brightness would probably be the best approach here though.
zoggop wrote:i think this is why i use tga. it's less confusing. here's my suggestion for the specmap: https://dl.dropboxusercontent.com/u/275 ... pecmap.tga
I kind of don't like that you scaled it. The original was only like 300KB (while your scaled tga is 4MB!). :( I think the black bg should have worked, and I think reducing the alpha of the whole image would have been better than making the mexes darker. Maybe.

In your screenshot the mexes at bottom right looked too dark to me. I think that's because you have ground diffuse set so low though, which has nothing to do with the specmap. 1.0 1.0 1.0 would probably work, or 0.75** or something like that, but what you see and what I see are probably not the same given monitor settings, etc.
0 x

User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Specular Tex issue

Post by jK » 14 Feb 2015, 05:56

zoggop wrote:the problem is your specmap.png has no alpha channel. as far as i can tell, a png's opacity channel is not the same as an alpha channel, and an alpha channel cannot be saved in a png. i think this is why i use tga.
just no, and NEVER use tga
0 x

User avatar
smoth
Posts: 22300
Joined: 13 Jan 2005, 00:46

Re: Specular Tex issue

Post by smoth » 14 Feb 2015, 06:13

qray wrote:
zoggop wrote:...as far as i can tell, a png's opacity channel is not the same as an alpha channel, and an alpha channel cannot be saved in a png.
Are you sure? Wiki states that PNG and TGA are valid formats. Would be interesting to confirm this.
PNG supports an alpha channel.
0 x

User avatar
enetheru
Posts: 627
Joined: 11 Jun 2010, 07:32

Re: Specular Tex issue

Post by enetheru » 14 Feb 2015, 07:38

aeonios wrote:I didn't bother using alpha for two reasons:

First is that if alpha is zero it creates visual artifacts, but a black bg should produce zero specular reflection regardless. It also compresses very well.

The second is that, since I can't see what I'm doing I can't make any sensible adjustments to it either. I think adjusting the alpha of the whole image to control the brightness would probably be the best approach here though.
In regards to this, if the alpha channel is missing, when loaded by image loaders it will assume a fully opaque alpha channel. and since this channel is being used as the specular exponent it creates a super shiny map.

Since this isnt super clear in the documentation do you mind editing it?
https://springrts.com/wiki/Mapdev:specular
0 x

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Specular Tex issue

Post by aeonios » 14 Feb 2015, 08:05

Ok, the intel updater didn't work worth anything so I had to upgrade my graphics driver manually, which also didn't help. Go figure.

What I ended up doing with the specmap is basically I set the black bg to 50% alpha and lowered the brightness of the mex layer. I may have to set the bg to 10% alpha, but a pure black specmap should reflect nothing either way.

@zoggop: I ended up adjusting the lighting settings sort of as a compromise to yours. Getting the lighting right is still an ongoing process though.

the current version is here: https://www.dropbox.com/s/7k9m92z248isb ... 4.sd7?dl=0
enetheru wrote:In regards to this, if the alpha channel is missing, when loaded by image loaders it will assume a fully opaque alpha channel. and since this channel is being used as the specular exponent it creates a super shiny map.

Since this isnt super clear in the documentation do you mind editing it?
https://springrts.com/wiki/Mapdev:specular
I don't quite understand it yet. :|
0 x

Post Reply

Return to “Map Creation”