Create an account


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More Engine Suggestions - Different Lighting Handling

#1
Before I get flak, this only applies to non dynamic(not flashing, changing, or moving) world lights. Why are they realtime? Here is my thinking, unless shadowing is handled differently, use the shadow map independent of the realtime lighting and bake the non dynamic realtime world lights into the lightmap. It will look identical(think stormkeep) but run much faster. This doesn't apply to dynamic lights such as weapons, projectiles, and blinking electrical shorts(red planted) but it will help like crazy and keep the atmosphere the author was shooting for. I am gonna look at this one tomorrow. Maybe this affects how normal maps are handled? But what about a simple cubemap to fake it? Even a low resolution realtime cube map. Only need to sample 1563 pixels to get it looking good.
Reply

#2
Those are real-time? No wonder shadows are so taxing. Unreal and Unreal Tournament had baked shadows on the maps over a decade ago when they came out. Finding a way to do that would seriously boost performance in Xonotic, I wonder if that's doable.
ECKZBAWKZ HUGE LIST OF ACHIEVEMENTS GOES HERE....


Oh wait.
Reply

#3
Environment shadows are baked into the lightmap. It's the dynamic shadows from players and objects that are being rendered by realtime world light occlusion. I say, for example, the red glow from the lava in stormkeep could baked into the lightmap and the shadow handled independently as a shadow volume. Instant performance improvement. The flickering lights would not work though. They and moving lightsources are excluded. Red Planet would become playable again. Tongue
Reply

#4
Ahem... I AGREE COMPLETELY WITH MASTERMIND, I THINK THIS IS A GREAT IDEA AND SHOULD BE IMPLEMENTED RIGHT AWAY; AND I ASSURE YOU, I AM IN NO WAY INFLUENCED IN THIS PREFERENCE WHATSOEVER.

(pssst, how did that sound man, ok?)

Shameless bump, this is a simple idea that could save me some of those precious frames in each second.
bye / bad luck and have boredom
Reply

#5
Actually you can't bake the "dynamic" lighting into the lightmap as lightmaps can be shared between several surfaces.

Also note I don't think there's a speed difference between "light surfaces, unless the shadowmap tells otherwise" and "darken surface, unless the shadowmap tells otherwise". You'd still have to setup the light (even if it only casts shadows), render the shadowmap and run all possibly affected surfaces through the pixel shader.

Also note you'd have to come up with a color value for the shadowed areas. Well, you could try to substract the light value the dynamic light would have cast in there to approximate the original lightmap before baking the dynamic light in, but the precision of the lightmap is somewhat limited and you may run into over-/underflow.

There are good reasons why lighting is the way it is.
Reply

#6
(03-21-2011, 02:54 AM)SavageX Wrote: Actually you can't bake the "dynamic" lighting into the lightmap as lightmaps can be shared between several surfaces.

Also note I don't think there's a speed difference between "light surfaces, unless the shadowmap tells otherwise" and "darken surface, unless the shadowmap tells otherwise". You'd still have to setup the light (even if it only casts shadows), render the shadowmap and run all possibly affected surfaces through the pixel shader.

Also note you'd have to come up with a color value for the shadowed areas. Well, you could try to substract the light value the dynamic light would have cast in there to approximate the original lightmap before baking the dynamic light in, but the precision of the lightmap is somewhat limited and you may run into over-/underflow.

There are good reasons why lighting is the way it is.

iirc, placing lights in netradiant and generating a light map will produce the same(if not better) results as a static, non-moving, changing light source. I realize surfaces share lights, but the lightmap handles that already(or should). The red glow from the lava in stormkeep could easily be in the lightmap instead. So,

The slowness of the realtime lighting comes from having to apply a non-static lightsource to relief-mapping, normals, etc. The actual shadows(when turned on or off for me) make little difference in final FPS. Most of the hit comes from having to recalculate the entire light data for all textures in a scene for each frame. Since the lightmap is baked, that only has to be calculated once. I may not have the engine concept down, but the performance speaks for itself. The actual shadows could be rendered, without color, to a texture and applied with multiply blending on the original surface, or post process with occlusion. Either way, your only checking light data on a few points on screen, not for all textures in view. Again, maybe in theory this seems shaky, but performance comparisons prove otherwise.
Reply

#7
All I'm saying is:

- You cannot add light to the lightmap after map-compile as the light may show up in several places because several surfaces may share parts of the lightmap
- Creating the shadowmaps is a somewhat expensive operation, as it involves rendering the scene from the light's POV (albeit geometry-only). You don't save on that.
- You still need to run the very same surfaces through the pixel-shader to evaluate the shadowmap.

So personally, I'm a bit sceptical, but also am prepared to be surprised.


Quote:Again, maybe in theory this seems shaky, but performance comparisons prove otherwise.

There's a working implementation?
Reply

#8
(03-21-2011, 07:44 AM)SavageX Wrote: All I'm saying is:

- You cannot add light to the lightmap after map-compile as the light may show up in several places because several surfaces may share parts of the lightmap
- Creating the shadowmaps is a somewhat expensive operation, as it involves rendering the scene from the light's POV (albeit geometry-only). You don't save on that.
- You still need to run the very same surfaces through the pixel-shader to evaluate the shadowmap.

So personally, I'm a bit sceptical, but also am prepared to be surprised.


Quote:Again, maybe in theory this seems shaky, but performance comparisons prove otherwise.

There's a working implementation?

The lights would be compiled with the map. Instead of placing a realtime world light, the light would be added and compiled in netradiant and a "shadow" object would be added from which shadows would be rendered. No lighting required.

There isn't a working implementation, I'm just comparing fps difference between shadows on and off in game. This would be handled completely differently than the current shadow method(occlusion).

See, the shadows would be...traced maybe? off the source against scene objects on a low resolution(depending on the blur desired on the shadow) then trilinear upscale and multiply blend. You just add the shadow as black. For quality, one could apply a simple blur to the upscaled image, maybe just use the current HDR blur. I would think that would work better for realtime shadows than requiring a world light and occluding out the shadow portion. It's the light that really hurts performance.
Reply

#9
Another thing that would be great:
Improve the performance of snow or rain
It totally kills the FPS Sad
MY NOOB STATS:
[Image: 788.png]
Reply

#10
You are certainly right!
But how would one make non-realtime snow and rain effects? Would you resort to having a set of sequenced animated GIF's placed in the air?
Reply

#11
(03-30-2011, 03:15 PM)Friskydingo Wrote: You are certainly right!
But how would one make non-realtime snow and rain effects? Would you resort to having a set of sequenced animated GIF's placed in the air?

That could just be a post process sprite blit. The zBuffer provides depth cutoff information.
Reply

#12
master[mind], I'm not too keen on how difficult this would be to implement it, but how about you attempt a demonstration (make a branch) and see how it fares? Do you have the time?
bye / bad luck and have boredom
Reply

#13
Yeah, I did branch recently, I just haven't gotten around to working on it yet...I have a feeling, I have to write the entire shadow handling to get shadow volumes working...
Reply

#14
(03-21-2011, 07:44 AM)SavageX Wrote: All I'm saying is:

- You cannot add light to the lightmap after map-compile as the light may show up in several places because several surfaces may share parts of the lightmap

how is that even possible ? how q3map2 knows that several places will have same lightining ? doesnt it need uvmap already done before baking ?
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [META] Xonotic reboot/port in modern engine ballerburg9005 32 14,095 02-22-2022, 05:11 PM
Last Post: ballerburg9005
  [TUTORIAL] How to create a command - DarkPlaces engine C programming LegendGuard 1 2,612 03-31-2021, 03:43 PM
Last Post: LegendGuard
  Engine: thread handling kingtiger01 0 3,413 11-06-2015, 12:57 AM
Last Post: kingtiger01
  Engine: cpu extensions kingtiger01 0 3,011 11-06-2015, 12:39 AM
Last Post: kingtiger01
  Ongoing port to the Unvanquished engine? poVoq 9 14,515 11-05-2015, 11:09 PM
Last Post: Danfun64
  [Script] Full realtime world lighting, using static light entities MirceaKitsune 4 6,665 03-23-2015, 12:33 PM
Last Post: Lee_Stricklin
Brick A script engine written in QuakeC Melanosuchus 9 13,559 10-14-2014, 02:01 AM
Last Post: Melanosuchus
  Xonotic Game Engine, Mapping, Development - General Developer Questions p14r 6 10,893 08-04-2014, 10:24 AM
Last Post: p14r
  weapon with different effects according to team soukaina 23 20,900 06-06-2013, 01:20 PM
Last Post: Mr. Bougo
  More dynamic environment CuBe0wL 34 36,831 12-02-2011, 09:27 AM
Last Post: Sarge999

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-