[FFP] Lighting for terrain so dull (dark)

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

You seem to want to get a high-contrast lighting. It is entirely possible to achieve using just FFP.

This is one of the best attempts of mine from the old days of DX 8 to achieve this goal:

I had:

- Shadows (prebaked in lightmap)

- Regular Diffuse + Ambient light

- High-intensity highlights for triangles under certain angle

- Material map blended with procedurally generated texture map

ScreenShotJune003.jpg

ScreenShotJune004.jpg

Obviously, I don't remember the exact combination of the TSS after all these years, but I remember very clearly that I had to use MULTIPLY_2X AND MULTIPLY_4X to achieve this, in combination with one of those states that let you specify if you want to saturate the result or clamp it.

Of course, if you already have a lot of (1.0f,1.0f,1.0f) colors in your base texture map, that is not going to get you anywhere, since no matter how you mulitply the 1.0f, you will still get 1.0f at most.

Thus, the trick is to make the majority of the scene darker, so that only certain parts get brighter - in my case, I wanted to achieve the dynamic light with the time-of-day feature, thus the terrain was dynamically lighted throughout whole day with varied direction of the light.

It is a lot of tweaking, though. You need to be able to dynamically, at run-time, change the intensity of Directional and Ambient RGB, either through key shortcuts or some UI.

It does take few hrs to come with the final look, but it is totally worth it.

To summarize, you need:

- A profile system where you keep good combinations in a code so that you don't have to spend half an hour to figure the best combination you had working 5 minutes ago. Copy/paste the combination into a separate codepath as soon as it looks good enough ( so that later you can choose between the best ones).

- Screenshot system, where you grab screens and compare different combinations of all parameters (texture, diff, ambient, TSS ColorOp)

- Base terrain texture in at least 6 different levels of Brightness / Contrast : Texture_10, Texture_30, Texture_50, Texture_65, Texture_80, Texture_100 (that you can switch between at runtime upon a keypress). I can change the texture by pressing 'T' at runtime and can see right away which brightness is best this way right away

- TSS ColorOp change upon a keypress (from ALL possible ones - see DX Docs)

When you have the system above, then all it takes is just few keypresses and you can come up with some pretty nice combinations.

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

Advertisement

Yeah, I think I found the way for my problem. Generate a prebake LightMap (need a tesselation and generate light intensity at each point in the surface), because there are no changing in light direction, so the lightmap is used for all the game render time. Use modulate2x for the LightMap make it look brighter as expected.

About the Shader limit issue. I havent made a wide investigation, but I remember some game require: Pixel Shader 2.0 . And it seems a lot of Computer/Laptop with integrated cards fail to start it. Example "League of Legend" (There are more like this, I saw some ). Though I'm not a master (more like a newbie) with Shader, so I'm not quite sure a normal lighting like my game may need what kind of Pixel shader : 1.0 ? what about Vertex Shader. In a ps file, there always, go throught VS then PS. Of couse if shader work for my case, I will try it because it seem alot more simple than prepare a prebake light. because there need to be quite a lot of it (slopes above have different light than one at base level).

Yeah, I think I found the way for my problem. Generate a prebake LightMap (need a tesselation and generate light intensity at each point in the surface), because there are no changing in light direction, so the lightmap is used for all the game render time. Use modulate2x for the LightMap make it look brighter as expected.

If you actually want to use a lightmap, then that's obviously fine, but there is absolutely no need to switch from using dynamic vertex lighting to light maps just in order to enable the modulate2x brightening effect. You can enable the modulate2x (or 4x) on the texture stage state which combines the lighting output with the diffuse texture.

Sorry to keep repeating myself in this thread, but for some reason you've concluded that modulate2x only works when combining textures, but that's wrong. You can achieve the effect you want with your existing dynamic lighting. Of course, there's plenty of good reasons for using light maps, but it sounds like you're making the choice for the wrong reasons in this particular situation.

About the Shader limit issue. I havent made a wide investigation, but I remember some game require: Pixel Shader 2.0 . And it seems a lot of Computer/Laptop with integrated cards fail to start it. Example "League of Legend" (There are more like this, I saw some ). Though I'm not a master (more like a newbie) with Shader, so I'm not quite sure a normal lighting like my game may need what kind of Pixel shader : 1.0 ? what about Vertex Shader. In a ps file, there always, go throught VS then PS. Of couse if shader work for my case, I will try it because it seem alot more simple than prepare a prebake light. because there need to be quite a lot of it (slopes above have different light than one at base level).

There always be someone which will not be able to play your game. Integrated cards used to suck, but they all support shaders now. My two years old netbook has support for the DirectX 11 API for example. OpenGL ES 2 is now the standard API used in the mobile world and supports shaders. WebGL have similar requirements. Unity* and other engines do not support the fixed pipeline anymore. If you really want to play something new, you should now probably buy a computer with shader support. Learning to write shaders is also a lot more useful than learning to work with the fixed pipeline.

* The current version still support it actually, but they recently decided to drop it in the next version.

It used to be - about 7-10 yrs ago - that you could say that if your computer cannot run the game, you are probably not a target market.

These days, when even cheapest of laptops ship with SM 2.0 cards, the only PCs you can find that can't run SM 2.0 are the ones that are kept as second/third computer at home - which means that in that household is still at least 1 computer able to run it.

I do, however, understand, your unwillingness to learn the shaders. They are not really that straightforward and debugging them is, by default, PITA - especially compared to FFP.

Long-term, you can't avoid shaders, really.

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

This topic is closed to new replies.

Advertisement