Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Faster way to light a game level

Author
Message
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 8th May 2010 03:48
I'm trying to find a good shader that can a. Normal map objects and b. calculate shadows. I have tried out evolve's shaders but they make my game's performance go way down once I start adding more complex objects. I need a good way to light my game level. Any ideas?

If it hasn't exploded yet, I haven't touched it.
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 8th May 2010 05:09 Edited at: 8th May 2010 05:11
It's hard to say without knowing what your levels are like. It's pretty standard to prerender light maps for levels.

If you want to use shaders for dynamic lighting, I've found that you can trade some of the prettiness in Evolved's shadow demos for speed. Check out the shader you're using. If it's multisampling from the depth texture to get smooth shadow edges, you can drop that. The shadows will look rough around the edges, but your framerate will improve. You can also try decreasing the shadow resolution etc.

There's loads of shader stuff in the sticky "Learning to Write Shaders" thread on this board.

I imagine what you'd ideally want is some combination of prerendered lighting and realtime shader stuff. What kind of game are you making? What kind of lighting effects do you want? What shaders are you using?
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 8th May 2010 06:38 Edited at: 8th May 2010 06:39
I am programming a mideival fps. My levels are basically dungeons with torture rooms and torches, ect. I want to have dynamic shadows because it will be more flexible with the scene and can be used for a torch lighting effect. I'm currently using evolve's multipass normal mapping shader. How should I go about decreasing the quality of the shader to increase my frame rate?

If it hasn't exploded yet, I haven't touched it.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th May 2010 15:31
One thing I have learned about Evolved's shaders is that they are a little hungry on the framerate. You'll have to try to reduce your polycount and try not to use stencil shadows or too many other effects...

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 11th May 2010 21:59
Well if they reduce my frame rate and I only have a basic test level so far, should I use a different shader?
Are there any other shaders I could use for normal mapping and shadows?

If it hasn't exploded yet, I haven't touched it.
Mugen Wizardry
User Banned
Posted: 11th May 2010 22:02
use darklights
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 11th May 2010 22:30
Use lightmaps (DarkLights is good) and use dynamic lighting only where it's really needed.

You'll end up with a much better result, and a higher framerate.

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 12th May 2010 00:43
Okay but what should I do for faster normal mapping? Should I modify evolve's mutipass shader or use a different one that won't eat up my framerate.

If it hasn't exploded yet, I haven't touched it.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th May 2010 10:40
They will all pretty much take up framerate, just optimise your code to be faster and more efficient, optimise the shader to remove unnecessary passes and lower shadowmap resolutions, optimise the objects to be the lowest poly you can, optimise your textures to be the lowest resolution you can get away with.

Optimise! Optimise! Optimise!

My signature is NOT a moderator plaything! Stop changing it!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th May 2010 11:07
Is DBP bump mapping any quicker than Evolved's Normal mapping shader (it's more or less the same effect)? The difference in quality won't be that noticeable once you have lightmaps etc. in place...

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th May 2010 14:04
Probably. I'm not certain without doing a benchmark test.

My signature is NOT a moderator plaything! Stop changing it!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 12th May 2010 18:59
If you are using a normal map (the funky colored kind) you can use blend mapping without a shader. The resulting details look deeper.

However, here is a simple single pass shader that uses,

- A base color (I use it to allow the player to choose a custom color)
- An Alpha map (to allow the base color to show through)
- A normal map
- A color map (for the actual color details)
- A specular map
- An emissive map

Just strip out the parts you don't need.



Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 13th May 2010 00:22
Well the only thing with the blend mapping is that the shadows from the normal map are really dark and don't look natural. See the attached picture.
This is the code Im using


If it hasn't exploded yet, I haven't touched it.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th May 2010 01:35
Add another blending stage for ambient light, perhaps?
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 13th May 2010 02:01
@GG Well how would I go about doing that?

If it hasn't exploded yet, I haven't touched it.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 13th May 2010 04:51
It might look better on a plane instead of a sphere too.

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 13th May 2010 22:27
Yeah it does look a little better but its not as good as I want.

If it hasn't exploded yet, I haven't touched it.
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 14th May 2010 22:23
Well how do I use blend mapping for a limb? Can I just sepparate the limb from the object, Blend map texture it, and then reattach it?
sry for double post

If it hasn't exploded yet, I haven't touched it.

Login to post a reply

Server time is: 2026-07-26 01:26:08
Your offset time is: 2026-07-26 01:26:08