Very dark spheremaps

For collaboration on developing the mod capabilities of VS; request new features, report bugs, or suggest improvements

Moderator: Mod Contributor

Post Reply
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Very dark spheremaps

Post by chuck_starchaser »

The generated spheremaps in .pu/textures/backgrounds, which now are .dds mime type, are extremely dark; almost black, most of them.
safemode
Developer
Developer
Posts: 2150
Joined: Mon Apr 23, 2007 1:17 am
Location: Pennsylvania
Contact:

Post by safemode »

the sphere maps that are generated are not dds, they are png files. They are generated from dds files, which barely differ from the originals. I didn't see such a variance in the generated spheremaps.

can you post a side by side on here? they are pngs so it shouldn't be hard. just do one with the current backgrounds, delete ~/.vegastrike/textures/backgrounds then replace the background images with the previous versions, then regenerate the spheremaps.
Ed Sweetman endorses this message.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

safemode wrote:the sphere maps that are generated are not dds, they are png files.
Very true; my mistake. They are png's. Still, they are darkened for no good reason I can see. The shader could do a better job of darkening environment mapping, at floating point precision. Darkening the generated spheremaps at 8-bit per channel is plain dumb and should be stopped, and change the shaders instead.


Examples: I'll just show the "front" texture for each background, to save time and bandwidth, but you'll get my meaning:

Blue front:

Image

Generated blue light:

Image


Orange front:

Image

Generated orange light:

Image


Somered front:

Image

Generated somered light:

Image
safemode
Developer
Developer
Posts: 2150
Joined: Mon Apr 23, 2007 1:17 am
Location: Pennsylvania
Contact:

Post by safemode »

ok, so just so it's clear. This has nothing to do with DDS.

I dont mind the idea of fixing the brightness of the generated files, I just dont want to be attacked by people thinking it's a DDS related problem and then someone get all trigger happy and replace the background images with png's.
Ed Sweetman endorses this message.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

No, that's right; this is unrelated to dds.

Just the code darkening the backgrounds. It's a mightily BAD idea. Wasting one or two bits of color precision out of a scant 8 is dumb, dumb, DUMB!
No wonder specular reflections look like crap in vegastrike...
Those spheremaps should, in fact, be normalized up to maximum brighness possible without saturating, and it should be the shader that turns down the brightness, at its higher internal precision. That's why GPU's do all their calculations at higher precision, and then dither the result before quantizing back to screen bit-depth; so that there's a single point where quantization happens. 8-bits per channel for textures is bad enough, but what we're doing is putting horrible quantization right at the input; --using only 6 bits per channel of the 8 available.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Keep in mind that the code for that was probably written back in the day before shaders were used for general things like this.

Definitely should be possible to do this in a shader... what should happen if shaders are disabled (an old card, etc)? Is there any other way of darkening them on the GPU without the shader?
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

ace123 wrote:Keep in mind that the code for that was probably written back in the day before shaders were used for general things like this.
Touche. Sorry about the ranting.
Definitely should be possible to do this in a shader... what should happen if shaders are disabled (an old card, etc)? Is there any other way of darkening them on the GPU without the shader?
I'm kind of rusty on OGL, but I'm 99% sure it should be easy. Perhaps using gamma control while writing the background.
If worse comes to worst, in the absence of shaders, one could darken the loaded texture in code, prior to sending it to ogl. Important thing would be to darken by a power of two (50% or 25%) and use dithering. I got code for you, if you need, for dithering a color so that more precision is reserved for luma at the expense of increased chroma jitter; since our eyes are much more sensitive to luma artifacts than chroma ones.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

I just heard a rumor there's a "reflection" attribute in xmesh. If it's true, envColor is set in code to 1,1,1,0; if false then 0.5,0.5,0.5,1.0. envColor is used to modulate env mapping color. Not sure how this is handled when there's no shader support, but in any case, change that to if false 0.25,0.25,0.25,1.0 and you can crank up the spheremap colors, I venture.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Alright, I have a proposal to deal with the problems of dark textures and color precision across the board. But it deserves its own new thread, so here it is:
http://vegastrike.sourceforge.net/forum ... hp?t=10973
Post Reply