[FFP] Lighting for terrain so dull (dark)

Started by
13 comments, last by VladR 10 years, 10 months ago

Hi,

I'm working with an tile based terrain. The terrain is display in an isometric view. I try to limit myself to FFP because I want to target low system computers. The problem is that I tried so many light direction, the world light is so dull. The maximum bright (the surface face the light ? ) is the current texture color. Every other surface look darker. I think the surface that direct the light should get brighter than it's normal texture color! How can I achieve it with old FFP ?
I want to achieve the flat terrain surface should get lit 100% (normal texture color). the slope face the light should get brighter, the other slopes should get darker!

sc3_zps386ada13.png

(same normal for 1 Triangle)

sc4_zps228f11e0.png

(Each vertex have its own Normal - the edge look smooth, but the lighting even darker!)

Original Texture :

15030_zps7e49cc20.png

Advertisement

Nice screenshots!

Have you tried adding an ambient factor to each pixel's color?

Another thing to try is SRGB correct rendering (gamma correct). http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/

I haven't worked with the FFP for a while, so I did a quick test now and it seems that the FFP lighting will never (*) produce enough light for the surface to get brighter than its normal texture color at 100 % intensity. It's quite weird, but even if you combine full while (0xFFFFFFFF) ambient color with as many directional lights shining at the surface from the same direction as you want, you will never get anything brighter than the original texture color. Also emissive color of the material doesn't help.

Maybe there are some combinations in SetTextureStageState that would change it, but I honestly don't know.

If you don't manage to get the desired look by playing with ambient and diffuse colors, you will probably have to use shaders. I don't think that would be such a problem with low-end computers. Well, yea, you would increase your HW requirements to GCs supporting shaders.

(*) The only exception seems to be specular colors, those (of course) get added "on top" of the diffuse and ambient lighting. But I don't think specular would work in your case (ortho view, directional lights, flat terrain).

It's quite weird, but even if you combine full while (0xFFFFFFFF) ambient color with as many directional lights shining at the surface from the same direction as you want, you will never get anything brighter than the original texture color.

That's because the operation is a modulation, which is just a multiply. So multiply original color by 1 and you get the original color, anything less and you get a darker color. if you use an additive operation instead, you can exceed the original color, but not exceed 1.0f.

If you want to go beyond that you can look at high dynamic range lighting and/or SRGB correction.

Your problem is that you can never achieve an output colour brighter than the original texture with your current setup.

The solution is colour doubling/quadrupling. Look into using D3DTOP_MODULATE2X and D3DTOP_MODULATE4X and halfing/quartering the light brightness to compensate.

Yeah I tried to mess with the Lighting setting, Material setting... ambient,emission,specular... It does make it lighter, but never supass the texture real color.
It seem the only solution is to use Multi Texture, using ColorOp = Modulate2x or 4x. It does make thing brighter, how ever it require a lightMap.

This guy seem to solve my problem in his way. Not perfect but I think acceptable : http://age.hys.cz/viewtopic.php?f=5&t=2

15_2D_elevation_small.png

In his post, it seems he does use a lightMap, then modulate the slope surface with it :

elevation_matrix.png

I tries to use his but it not very easy. Cause I'm not sure this is his real lightMap or just a demo, the gray value is not the same in all edge. because we only apply the lightMap to the sloped surface, flat surface surround it is intact. so that the Border must have the same gray value! Although this look quite right, the black region mean the surface need darkening, the white region mean it should be brighter. The gray mean we keep it as normal texture color! Still very headache.

The reason I want to use FFP, because this is just a 2D project using DirectX3D. Also I does use vertex,lighting, multiTexture. Still wonder if 5 year old laptop with integrated card support multi texture 3 stage :(

Use D3DTOP_MODULATE2X/D3DTOP_MODULATE4X on the texture stage state that combines your dynamic lighting result with your texture result to get the overbrightening effect that you want.

The feature does not require your lighting to come from a texture (light map) like you state in your last post.

It's quite weird, but even if you combine full while (0xFFFFFFFF) ambient color with as many directional lights shining at the surface from the same direction as you want, you will never get anything brighter than the original texture color.

That's because the operation is a modulation, which is just a multiply. So multiply original color by 1 and you get the original color, anything less and you get a darker color. if you use an additive operation instead, you can exceed the original color, but not exceed 1.0f.

If you want to go beyond that you can look at high dynamic range lighting and/or SRGB correction.

Modulation between diffuse color of the light and diffuse color of the material, similarly for ambient etc. Yes, that will never go above 1.

But then the lights are summed together (Ambient Light + Diffuse Light + Specular Light + Emissive Light) and there really must be addition, because with modulation you would get complete black look for any material without emissive color, which is not how it really works. And also - what about multiple lights? Their results also cannot be modulated, they must be added together.

It just seems that FFP is adding the lights together, while never going above 1 (clipping the result to 1). So if one light was enough to get to 1, then all other light sources have no effect.

Just a little reality check when you say that you want to limit yourself to FFP because you want to target "low-end" machines.

Direct3D 9.0 was released year 2002 ... that's over 10 years now. It supports shader model 3.0 already.

Direct3D 8.1 was released year 2001 and it supports some shader level already and it doesn't work on anything older than Windows XP.

http://store.steampowered.com/hwsurvey/

Above is the Steam hardware survey. People using hardware with DX8 level GPU (some or none shader support) and below presents 0.41% of the Steam gamers. On the other hand 98.54% of the people using Steam have access to SM3.0 level hardware.

Cheers!

To add to what kauna said, this is the Unity web player statistics (which is thus probably targeted to more causal gamers than Stem). Less than 3% of players use GPUs without shader support.

This topic is closed to new replies.

Advertisement