Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Screenshot log 2: Lights
1 2 3 4 5 Previous Next
- - By PeterW [gb] Date 2011-11-07 10:15
Really slow currently. But this is roughly the direction I want to go with lights: fine-grained software LoS checks, more or less coarsely compressed into rays for the GPU.

Parent - By Zapper [de] Date 2011-11-07 16:43
Looks interesting!
Parent - - By Caesar [de] Date 2011-11-08 17:51
I wonder how the stealth bastard guys do it.
Parent - By PeterW [gb] Date 2011-11-08 18:13 Edited 2011-11-08 18:23
It's pretty easy to do for a static landscape. I imagine BSPs and the likes can then be used to make it ridiculously fast as well. For dynamic landscape one has to employ dynamic spatial indexes like quad-trees so large empty spaces can be skipped fast. That's what I intend to do once I hit a serious performance wall.

But before that, I'll make it retain the rays between frames and only update them on changes (tying into the existing relight stuff) as well as optimizing the free-checks a bit more (using the optimized free-checks for PXS). And if all else fails, we'll just have the light only update every 10 frames and smoothly blend between the states it in the GPU. Also note that even without any of that, the above still runs at 50 FPS in release mode. All in all, I'm pretty certain I have enough tricks up my sleeve that this will end up working.

Edit: Hm, I read a really detailed article on how line-of-sight can work somewhere - even with making shadows "soft" as a non-point line source would (which is something I also want to try at some point!). But sadly I can't find it anymore :/
Parent - - By Newton [de] Date 2011-11-08 18:31
Geometric shapes (polygons) I'd say :-)

The landscape in Stealth bastard is not static I think. I saw several blocks moving around to which the lighting also applied.
Parent - By PeterW [gb] Date 2011-11-08 23:35
Yeah, but most of it is, I think? Well, you're right, the right answer is probably "their geometry is trivial" :)
Parent - - By Nachtfalter [de] Date 2011-11-14 23:12
Add reflecting parameters (depending on entry-angle and material structure) to the lightrays and it will be perfect!
Reply
Parent - - By PeterW [gb] Date 2011-11-15 03:12 Edited 2011-11-15 03:15
Yeah, right. No. ;)

It is hard enough already to find spots that positively won't be reached by light. The last we need is mirror materials somehow routing around blocks of material - that would mean we positively have to check the *whole* landscape. Sorry, that's pretty definetely out.

On the other hand, we might be able to implement glowing materials. One might also be able to sort-of fake reflection for straight surfaces (water?) by adding an additional light source.
Parent - - By Nachtfalter [de] Date 2011-11-15 07:01 Edited 2011-11-15 07:06
The real light is checking the whole universe in real time  .
Sudo make real light ingame!
Reply
Parent - - By Isilkor Date 2011-11-15 12:27
Nachtfalter is not in the sudoers file. This incident will be reported.
Reply
Parent - By Caesar [de] Date 2011-11-15 19:48
Nachtfalter: [ ] nice [x] naughty
Parent - - By PeterW [gb] Date 2011-11-16 03:23 Edited 2011-11-16 03:27


And as usual, on the screenshots marking the biggest improvements there's the least to see. This is now rendered over a texture (using a framebuffer object - that's the right way to do it, right?). Also there's a good bit of code written for updating the rays on-demand.

For now it mainly throws assertions left and right. And I obviously have to do a bit more of jolly coordinate trial-and-error (with extra attention to rounding) to get stuff to render at the right places.
Parent - By PeterW [gb] Date 2011-11-17 15:12
... yeah, I wish. Framebuffers working just like that would have been too good to be true :/
Parent - - By Maikel Date 2012-11-04 14:13
Hey Peter,

Is it okay if I make a teaser trailer of the current state of the lights for our youtube channel?
Parent - By PeterW [gb] Date 2012-11-04 15:32
Sure, go ahead.
Parent - By Pyrit Date 2012-11-04 17:40
I'm very interested in new media about this!
Parent - - By Newton [th] Date 2014-04-21 11:38
Hey Peter, sorry for zombieing the thread. Since you are not working on it anymore, I'd like to ask if you have committed your latest work into the lights branch in the repository. If not, could you do that so that other people might build upon your work so far?
Parent - - By PeterW [de] Date 2014-07-03 11:27
*rezombify*

The lights branch is current - the problem is figuring out where to go from here. Good news is that I have now finished my PhD thesis, so there's a chance I might start working on this again.

Still really unsure how to handle global lights though. And the big rendering pipeline shader-ification looks scary as always.
Parent - By Clonkonaut [de] Date 2014-07-03 11:53
Lights will be finished now \o/

--- breaking news ---
Reply
Parent - - By Maikel Date 2014-07-03 13:09
Congratulations!

Two months until handing in over here ;(
Parent - - By PeterW [de] Date 2014-07-04 11:18
Good luck! Best tip I have is to not try to write so much - the "Write about *all* the things!" attitude is fun when you have the time, but in the end getting lots of non-essential stuff into shape is a huge drag. Also here's my final version with Org & TeX sources, just in case you could use inspiration. The "Status" tracker is a bit outdated, obviously :)



Meanwhile, Heinz felt like there was a lot of work to be done here...
Parent - - By Maikel Date 2014-07-04 11:31
Nice screen and thanks! I am trying to write as little as possible and copy as much from my existing papers, will be max 150 pages.

Btw, your figure hyperlinks do not point to the top of the figure, which can be solved with the hypcap package (to be included after the hyperref package) if I remember correctly.

Otherwise from a brief look at it: Impressive!
Parent - By PeterW [de] Date 2014-07-05 10:04
They have a stupid regulation here that you aren't allowed to copy anything from papers. Not that it would have helped me, given my stellar 1 actual publication record :)

And huh, thanks. Figured there ought to be a solution for that. They will probably give me some more time for corrections, will incorporate that.
Parent - By Newton [de] Date 2014-07-04 21:23
Would you like me to change your nickname? ;-)
- - By PeterW [gb] Date 2011-11-18 03:51


Copious amounts of cursing later... How much state does OpenGL carry around anyway?

Here the landscape shader finally uses the information from the calculated light. Note that the nice realistic effect of the upper granite edge being shaded brighter is actually accidental.

This obviously isn't the most exiting application of the FoW... But before I get to more complicated "tunnel" scenarios, I still have to work a bit on the base algorithm. Right now it doesn't even know how to deal with light going anywhere but downwards :)
Parent - By Günther [de] Date 2011-11-18 15:45

> How much state does OpenGL carry around anyway?


Everything, I think. Well, there's some movement away from the giant-state-machine model in the newer versions, but that hasn't reached everywhere yet.
Reply
Parent - - By Newton [de] Date 2011-11-18 19:33
What is this odd darkish border?
Parent - - By PeterW [gb] Date 2011-11-18 19:50
What do you mean?
Parent - - By Newton [de] Date 2011-11-18 19:54
The earth(?) left of the granite is very dark
Parent - - By PeterW [gb] Date 2011-11-18 20:31
Oh, that's not intended? I have had that for quite some time, see the first screenshot in the thread. I was going to rant someday about how ugly that texture is. Maybe I have a corrupted file there or something? Interesting.
Parent - By PeterW [gb] Date 2011-11-18 22:17
Can't see any change here. What texture would be supposed to appear there?
Parent - - By Ringwaul [ca] Date 2011-11-19 04:24
Isn't that just the top-soil texture?
Reply
Parent - - By PeterW [gb] Date 2011-11-19 14:12
Probably. I still think it looks bad right next to the classic earth textures. The one we had before was better.
Parent - - By Ringwaul [ca] Date 2011-11-20 00:05

>I still think it looks bad right next to the classic earth textures.


It's supposed to form a smooth gradient with mid-soil; the way it currently is in that scenario is weird.

>The one we had before was better.


No texture was replaced; they were added.
Reply
Parent - - By PeterW [gb] Date 2011-11-20 00:15
True. It also makes little sense for the lighter layer to be on top, right?
Parent - By Ringwaul [ca] Date 2011-11-20 00:34
I'd say so. As you can see in the link from my previous post, the darkest soil should be at the surface with less saturated soils below.
Reply
- - By PeterW [gb] Date 2011-11-19 16:01


Caves can be really dark now if they aren't reached by light. Somebody somewhere should get ready to place torches all over the place.

Incremental ray updates seem to work now, but invalidation (on changing landscape) still doesn't. Also don't mind those dark dots, they should disappear in due course.

More worrying is that the new shader seems to have somehow introduced a delay into landscape changes getting shown - almost half a second, you see a digging Clonk moving into solid earth. As I know nothing in my code that could cause this, this *might* be a sign that I'm approaching hardware limits here. Or maybe I'm just doing something wrong.
Parent - - By Caesar [de] Date 2011-11-19 17:53
So, how does it look if you place some more light sources?
Parent - By PeterW [gb] Date 2011-11-19 22:38
Well, there's still the light-can-only-go-down issue ;)

I'll probably work the updates out first, then try to fix that. It's a bit tricky technically, as right now the algorithm is pretty specialized. I'm probably going to just "flip" its input data somehow. I just need to decide whether or not to use templates for that.
- - By PeterW [gb] Date 2011-11-22 01:58 Edited 2011-11-22 02:00


You know how I am always talking about the algorithm only working downwards? Meet the result: Carlo the ceiling lamp.

I am obviously working on fixing the lights to objects and moving them with them. The good news is that walking around seeing the shadows move all around you  (okay, actually *below* you) looks pretty good. A tiny bit of flickering due to the rounding of the rays, but hardly noticeable. Hard to convey that in screenshots though :)
Parent - - By AlteredARMOR [ua] Date 2011-11-22 08:20
Realy like the fact that not illuminated areas are not solidly black but can still be seen (though with much bigger effort)
Reply
Parent - By PeterW [gb] Date 2011-11-22 10:34
Yeah, well, that's actually only meant to be a debugging aid right now. Eventually, it should be able to go all the way to pitch-black in a believable way. Scenarios might then decide to have a global ambient light anyway, if it makes sense for them.
Parent - - By Newton [de] Date 2011-11-22 10:09
Parent - - By PeterW [gb] Date 2011-11-22 10:40 Edited 2011-11-22 17:23
Still a long way to go. Just from the top of my head: One obvious missing feature is that it doesn't illuminate objects right now. A less obvious missing feature is that by the light only going down right now, the "light" edge of the material always has the right orientation. I will have to find a more involved solution once light goes up (yay bump mapping).
Parent - - By Newton [de] Date 2011-11-22 22:21
Well yeah, but this kind of stuff is interesting. The development blog is a development blog to keep people up to date, not something where only finished products are presented.
Parent - - By Clonkonaut [ie] Date 2011-11-22 22:54
There's nothing about settlement in the blog!
Reply
Parent - - By Newton [de] Date 2011-11-22 22:56
Well noted. The blog doesn't write itself, though.
Parent - - By Clonkonaut [ie] Date 2011-11-22 23:26
Who does write it then? Certainly not me because of lack of account :P
Reply
Parent - - By PeterW [gb] Date 2011-11-22 23:58
Careful. Newton will give you one and all of sudden you're out of excuses!
Parent - By Clonkonaut [ie] Date 2011-11-23 14:19
Reply
Up Topic Development / Developer's Corner / Screenshot log 2: Lights
1 2 3 4 5 Previous Next

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill