[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - .lit2 format - request for feedback

.lit2 format - request for feedback

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Re: .lit2 format - request for feedback

Postby Spike » Thu May 14, 2015 3:44 pm

aye, it does need something more reliable than merely the surface count.
checksums of the entire header break when a map gets re-vised or has different ents embedded into it, so I don't think that's an ideal solution, but I don't know what to suggest instead.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: .lit2 format - request for feedback

Postby mh » Thu May 14, 2015 4:37 pm

Just to clarify: I don't like the QuakeSpasm method because it's dependent on a human being to not screw up. :twisted:

For example, say a mapper releases a buggy V1 of a map then a few weeks later a bugfixed V2. They have the same name and go in the same gamedir. Which one does a LIT file belong to?

Maybe rather than just using the surface count, how about embedding some other counts from the original source .bsp into the header? A few other lumps interact with the faces lump, like edges, surfedges, vertexes. Stuff that can survive the hypothetical re-vis or entity embedding. Construct a "magic" from their counts; at the very least the possibility of multiple lumps having the same counts together with the same name should be so low as to be safely ignored.

There may be edge cases I've missed with this, so I'm not religiously welded to the proposal: I just want something more robust is all; how it's achieved isn't too important so long as it's sane.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: .lit2 format - request for feedback

Postby ericw » Thu May 14, 2015 6:27 pm

IMHO, the chance of the filename and numsurfs matching, but the .lit2 still being built against a incompatible (different geometry) version of the map, is small enough to ignore.

I'm just thinking that any geometry change, beyond moving a wall a couple of units, will cause the bsp's numsurfs to change and the .lit2 validation to fail.

That reminds, me I still have to implement that validation in my QuakeSpasm implementation.
ericw
 
Posts: 92
Joined: Sat Jan 18, 2014 2:11 am

Re: .lit2 format - request for feedback

Postby Baker » Thu May 14, 2015 7:53 pm

I think the biggest risk for that scenario is someone working on a map and recompiling and sharing a map in development possibly forgetting to include the lit2 and someone has the previous lit2 in the right place so the "wrong content protection" doesn't help.

A sanity check like if (bsp->numsurfs == lit2->numsurfs) would prevent that most of the time and the wrong map scenario.

I don't have an opinion on any of this ... except I hope to not see a heavy-weight solution in the event an elegant solution cannot be found.

(For a .lit the lightdata is 3x the size of what is in the bsp, wouldn't this the data be 3 x 4 = 12 times the size.)
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: .lit2 format - request for feedback

Postby Spike » Thu May 14, 2015 8:56 pm

you could always validate the extents. if they make no sense (+/- 1) then you know the bsp is wrong. yeah, that's not entirely a serious suggestion, but it would work. reliable, but a hassle.

lit2 has no direct correlation between internal and replacement, on account of surfaces potentially having different counts of valid styles per face. even different surface scales will result in different extents due to rounding (not *4). you can't make trivial assumptions about the size of the contained lighting data withough verifying these things first.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: .lit2 format - request for feedback

Postby Baker » Thu May 14, 2015 9:26 pm

Good to know. numsurfaces it is!! I was with that idea all along, I swear! :D

Still can't believe ericw did fence texture shadows. :D
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: .lit2 format - request for feedback

Postby mankrip » Fri May 15, 2015 12:44 am

The 1:1 texel/lexel (light pixel :P) ratio will help to speed up software rendering.

Just remember to add an option to create lightmaps for water surfaces. For this, their TEX_SPECIAL flag must be ignored by the compilers (but still included for compatibility with engines that doesn't support lightmapped liquids). This will make big water surfaces to be subdivided, but it's no problem.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
/ /
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Re: .lit2 format - request for feedback

Postby ericw » Tue May 19, 2015 8:02 pm

mankrip, yes I can add that to the todo list. Do any engines support that, or I guess you're waiting for a light tool to generate the lightmaps ;)
I think It would be independent of .lit2, though.

I've been continuing work polishing the tyrutils and quakespasm patches.

For Quakespasm, I initially forgot to change the types of the coordinates in glRect_t from unsigned char to int. If you increase BLOCK_WIDTH/BLOCK_HEIGHT to 256, glRect_t needs to go to int.
ericw
 
Posts: 92
Joined: Sat Jan 18, 2014 2:11 am

Re: .lit2 format - request for feedback

Postby ericw » Tue May 19, 2015 9:15 pm

Updated the first post with tyrutils and quakespasm binaries.
ericw
 
Posts: 92
Joined: Sat Jan 18, 2014 2:11 am

Re: .lit2 format - request for feedback

Postby mh » Tue May 19, 2015 11:47 pm

OK, I've implemented this in a research engine. Some comments.

I'm still strongly in favour of an array-of-structs for the per-surface overrides, and this experience just reinforces it. It wasn't painful to implement, but it was annoying. Don't let hypothetical future modification that may never even happen get in the way of a clean implementation now.

It needs to be documented that the offsets in the .lit2 need to be multiplied by 3, and that values of -1 still need to be caught. This didn't affect the QS sample implementation, but I implemented it slightly differently and was caught by it; so might others.

It's necessary to peek ahead at the surfaces lump and calculate the number of surfaces in the .bsp in advance of loading the .lit2 in order to sanity-check. Again, more annoying than painful.

The .lit2 size for an ID1 map is typically about 12mb (I ran with -lmscale 0.25), so be sure to crank up the -heapsize and MAX_LIGHTMAPS (a relighting of e4m4 used 68 lightmaps at 256x256).

Extents in the .lit2 file are just confusing. I don't get why they can't have the same values (but calculated at the higher precision) as those calculated by CalcSurfaceExtents. I'd suggest that if you're going to include extents at all you should also include texturemins (which is dependent on the same calculation).

The visual quality was roughly comparable to realtime lighting with good shadowmap filtering, and I was quite pleased to see that.

QuakeSpasm obviously hasn't completed the implementation so far as R_LightPoint is concerned. That's OK for a sample implementation but you might get bug reports. I wasn't using LordHavoc's interpolation code here and it looks like you're going to have fun when you get round to doing it.

I got good performance with frametimes ranging from 0.2 to 0.4 milliseconds on an Intel HD 4000. This was with GPU lightmaps however, so I wasn't doing any dynamic light uploads. I've no idea how well (or otherwise) they would run with a more traditional model.

There are a lot of surfaces with little light variation across them, and it would be neat if the light tool could detect this and scale down the lightmap in cases where it happens. I'm not sure how complex that would be.

Crisper edges on shadowed areas did tend to show up stair-steps a bit more, even with -extra4. I'd semi-expected that.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: .lit2 format - request for feedback

Postby mh » Wed May 20, 2015 12:02 am

Just adding that when the format is finalized, I'll probably hack up coloured .lit2s for the ID1 maps.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: .lit2 format - request for feedback

Postby mankrip » Wed May 20, 2015 2:41 pm

Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
/ /
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Re: .lit2 format - request for feedback

Postby ericw » Wed May 20, 2015 6:16 pm

ericw
 
Posts: 92
Joined: Sat Jan 18, 2014 2:11 am

Re: .lit2 format - request for feedback

Postby Baker » Wed May 20, 2015 9:59 pm

Dumb question.

What are benefits of this vs. take an upscaling algorithm like () and upsample existing lightmaps in the engine?
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: .lit2 format - request for feedback

Postby ericw » Wed May 20, 2015 10:17 pm

Not dumb, but if you take something like this screenshot: http://i.imgur.com/zwuQv4j.jpg
You can imagine a grid of points on the ground at 16 unit intervals; that would be the vanilla lightmap resolution, and the points would be widely spaced enough that they'll miss the fine details of the bars. Regardless of what kind of upscaling you use, you'll never be able to restore the original detail, at best you'll just get a blur.

Some folks in the tyrutils thread on func have been playing with this: http://www.celephais.net/board/view_thr ... &start=377
I do have a bit of a fear that this is a solution in search of a problem, or that it might only be useful for casting shadows of fences, lol.

edit: Also, hqx is a special scaler for upscaling pixel art, my guess is it wouldn't look so great for lightmaps, would be liable to generate strange looking vectorized shapes in the lightmap.
ericw
 
Posts: 92
Joined: Sat Jan 18, 2014 2:11 am

PreviousNext

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests