|
Posted by ericw on 2015/07/14 00:34:45 |
Hey, I got around to setting up a website for my branch of tyrutils: (complete with lots of screenshots of different settings of AO, sunlight, etc!)
http://ericwa.github.io/tyrutils-ericw
and making an "official" release of it.
Nothing major changed compared with the last snapshot (may 1st), but a couple new things:
* .lux file support from Spike, for deluxemapping
* gamma control with -gamma flag and "_gamma" key
* rename -dirty flag to -dirt for consistency
* fence texture tracing is now opt-in only with the "-fence" flag.
* light should run a bit faster
This doesn't have lit2. Not sure what to do with that, tbh.
If there's a demand for it, I was thinking I could make a tool that upscales all textures in a wad by 2x or 4x, and adds a "-2x"/"-4x" suffix to the names. You could then manually get the higher-res lightmap on certain faces by applying the upscaled texture, and lowering the texture scale to 0.5 or 0.25 in your editor.
The only real disadvantage of this hacky method over lit2 is more face subdivision by qbsp. This isn't great, but it shouldn't be an issue if the hack is used sparingly (and bsp2 can be used if needed for higher face/vert limits.)
Anyway, enjoy, I hope this is pretty bug-free. |
|
|
Try This One
#405 posted by mfx on 2016/04/17 03:25:00
thats an old version, only watervising added to it.
https://www.quaddicted.com/files/tools/wqbsp165.zip
#406 posted by mankrip on 2016/04/17 03:38:07
According to the WQBSP165 docs, it doesn't support -splitspecial, so lit water won't work with it.
The problematic entity is a light torch; I've tried deleting it and creating a new one at the exact same place, and the problem still happens. It's like the tyrutils qbsp compiler is too strict about entity placement.
Light entities should be treated as point entities by the QBSP compiler. I wonder if the tyrutils qbsp is checking whether some default bounding box size is out of map bounds or something.
Mankrip
#407 posted by ericw on 2016/04/17 03:48:54
weird, can't reproduce here.
I have a START.MAP modified 4 Sep 1996. No leaks with qbsp.exe from tyrutils-ericw-v0.15.4-115-gfff8cbf. Adding -splitspecial doesn't cause leaks, either.
Well...
#408 posted by mfx on 2016/04/17 03:50:16
o_O
rebb? eric? carmack? any ideas?
#409 posted by mankrip on 2016/04/17 04:15:59
Anyway, I've confirmed that my code for lit water wasn't implemented. -lightturb doesn't make any difference.
See the result with tyrutils-ericw-v0.15.4-115-gfff8cbf: scr_0778.png
And the proper result with my old modified build: scr_0779_mankrip.png
So, there's still no way to compile maps with both lit water and smooth shading. :( Oh well.
Sorry
#410 posted by ericw on 2016/04/17 05:35:01
I forgot about http://forums.insideqc.com/viewtopic.php?f=12&t=5769
But I'm confused.. now I realize that -splitspecial means water won't have TEX_SPECIAL set. This means lit water should "just work" without changes to light - so the -transwater stuff Spike added is unnecessary. Your patch just makes the bottom face receive light from above, rather than underwater, right? That seems sensible since typically most of the light sources will be above the water, but not having that shouldn't cause the artifacts in your first screenshot.
#411 posted by Spike on 2016/04/17 05:56:19
all I can say is that the water parts of my patch were completely untested, and only half written. yeah, I got bored and then forgot about it, okay? please forgive my sins! so that I can more easily commit them in future! mwahaha!
the bright part of the water is probably a poly with no lightmap info at all (which technically means all-white-but-not-overbright instead of all-black when found on water surfaces).
this would imply that much of that area is normally lit from below.
I don't think it tries to subdivide water either. I guess this means that the controls for whether water should be lit should really be inside the qbsp instead.
#412 posted by mankrip on 2016/04/17 06:04:40
Your patch just makes the bottom face receive light from above, rather than underwater, right?
It makes each face receive light from both under and over the water, to match the lighting on the nearby walls. The normal inversion is done on a per light entity basis - the face's normals will only be inverted for light entities behind it.
now I realize that -splitspecial means water won't have TEX_SPECIAL set. This means lit water should "just work" without changes to light
-splitspecial also splits the water surfaces into the appropriate size for lightmap creation.
typically most of the light sources will be above the water, but not having that shouldn't cause the artifacts in your first screenshot.
As mentioned at InsideQC, my code includes a hack to force liquid surfaces' lightmaps to always be saved, otherwise fully dark liquids would remain fullbright.
BTW
#413 posted by mankrip on 2016/04/17 06:14:07
It would be better if the -splitspecial option in the qbsp was replaced with -splitturb and -splitsky options. There's no need to split sky surfaces, because there's no need to make them receive regular lighting.
#414 posted by ericw on 2016/04/17 06:33:40
It makes each face receive light from both under and over the water, to match the lighting on the nearby walls. The normal inversion is done on a per light entity basis - the face's normals will only be inverted for light entities behind it.
Ok, cool, I'll try merging this in.
As mentioned at InsideQC, my code includes a hack to force liquid surfaces' lightmaps to always be saved, otherwise fully dark liquids would remain fullbright.
I think this bit is missing from your patch?
This does seem like a hack around an engine bug... There shouldn't be any ambiguity; in an engine supporting lit water, a face with face->styles = 255, face->lightofs = -1, TEX_SPECIAL unset, and texture name starting with '*' should be rendered black, right?
#415 posted by mankrip on 2016/04/17 07:35:30
This does seem like a hack around an engine bug... There shouldn't be any ambiguity; in an engine supporting lit water, a face with face->styles = 255, face->lightofs = -1, TEX_SPECIAL unset, and texture name starting with '*' should be rendered black, right?
It's not an engine bug, the lightmap data is missing from the BSP file itself. For some reason, if no lights touches a liquid surface, no lightmap data is generated for it. I've studied the light.exe code for hours and couldn't figure out what causes this, so I've just forced the lightmap data of liquid surfaces to always be generated.
With no lightmap data, the surface cache for the lighting can't be created.
I think this bit is missing from your patch?
It's not missing, I've just implemented it in a subtle way:
/* don't bother with light too far away */
if (dist > entity->fadedist)
if (!backwater) // mankrip
return;
This allows far away lights to be casted on liquid surfaces, therefore forcing the lightmap data to be generated - even though far away lights won't add any brightness to it.
#416 posted by ericw on 2016/04/17 08:06:35
It's not missing, I've just implemented it in a subtle way
Ah, I see :)
It's not an engine bug, the lightmap data is missing from the BSP file itself. For some reason, if no lights touches a liquid surface, no lightmap data is generated for it
This is not specific to lit water.. light.exe will not write fully black lightmaps to the bsp. It was a compression / optimization in the original light tool and engine; lightofs of -1 is rendered black. You can see this by deleting all lights except a small dim one in a large map, the lightdatasize will be only be a few hundred bytes.
here's the early exit in light: (f->lightofs = -1; is set earlier)
https://github.com/id-Software/Quake-Tools/blob/master/qutils/LIGHT/LTFACE.C#L542
and places where it is handled in the engine:
sets surf->samples to NULL if face->lightofs is -1:
https://github.com/id-Software/Quake/blob/bf4ac424ce754894ac8f1dae6a3981954bc9852d/WinQuake/gl_model.c#L795
#417 posted by mankrip on 2016/04/17 08:37:18
This is not specific to lit water.. light.exe will not write fully black lightmaps to the bsp.
I know this.
I don't remember all the details on why the lighting for liquids couldn't be generated if the light data wasn't present in the BSP file, but I will take a look at it again later.
#418 posted by mankrip on 2016/04/17 16:41:55
Alright, I've had some sleep.
Here's the proof why the lightdata for liquid surfaces must always be generated. In Mod_LoadFaces:
if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent
{
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
The SURF_DRAWTILED flag in the engine is similar to the TEX_SPECIAL flag in the tools: it serves to indicate that the surface shouldn't have lightmaps. And it can't be eliminated, otherwise maps compiled without -splitspecial will crash the engine when trying to generate the surface caches.
Right now, I'm using an if(!out->samples) statement to ensure that maps without lit water will have the SURF_DRAWTILED flag set. However, the engine loads the mtexinfo_t data through Mod_LoadTexinfo right before Mod_LoadFaces is called, so in theory it should be possible to replace the (!out->samples) check with a (texinfo.flags & TEX_SPECIAL) check.
I'll modify the light tool to remove the "always save lightdata" hack, compile a map with it and change the check in the engine to see if it works.
#419 posted by mankrip on 2016/04/17 17:09:06
Yeah, it worked. Now instead of this:
if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent
{
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
... the proper way to set SURF_DRAWTILED is this:
// mankrip - begin
if (out->texinfo->flags & TEX_SPECIAL)
out->flags |= SURF_DRAWTILED;
// mankrip - end
if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent
{
out->flags |= SURF_DRAWTURB; // mankrip - edited
:) Thanks for making me look into this.
Bounce Lighting Alpha
#420 posted by ericw on 2016/05/20 22:04:49
been fighting with this for a while now.. it's more or less in a finished state I think.
windows builds source
Command line flags:
-bounce enables 1 bounce (this is all that's supported)
-bouncedebug saves only the indirect lighting to the bsp/lit, for previewing
-bouncescale scales the brightness of bounce lighting, default 1. can try 2 or 0.5 for more/less indirect light.
-bouncecolorscale how much bounce lighting picks up color from the map textures, between 0 and 1. default 0 because this can lead to q2 style everything-is-gaudy. you can try 0.5 or 1.
Note, this is slow! light uses visdata now, I recommend only using -bounce on vised maps because that speeds it up a lot.
Other info: it works more or less like the existing "_surface" light system; point lights are generated on each face to bounce light back into the map. Currently there is no face subdivision for this, so the bounce light given off by really large faces will be coarse (all coming from just 1 point light).
Sounds Interesting
#421 posted by Breezeep_ on 2016/05/21 01:45:56
I'd like to see a screenshot showing the effect though.
NP
#422 posted by mfx on 2016/05/21 02:03:30
Its One Light Source In This Particular Map Shot
#423 posted by mfx on 2016/05/21 02:04:23
mind you.
Breezeep
#424 posted by ericw on 2016/05/21 02:11:22
without
with
"Without" shot used "-lit -extra", 9seconds
"With" shot used "-lit -extra -bounce", 39 seconds
the 39 seconds is with 8 threads, and vised map though. Just -bounce without -extra is something like 16 seconds.
Ericw, You Are Teh Boss.
oh man I am SO hyped for this!
Cool, Ericw
#426 posted by Breezeep_ on 2016/05/21 16:11:34
Will Test Today
I do kind of wish for a more tolerant set of compilers like rebbs.
Ok, this seems to have fixed a couple of issues in my map so I will be using this :)
Fifth
#429 posted by ericw on 2016/05/21 20:22:42
cool.. glad it works.
FWIW mfx and I did a ton of back and forth testing/fixing on phong shading, it's pretty solid now (though one glitch just came up that I need to look into)
check the BJP tools thread, I linked a build of txqbsp that is patch to write the phong shading info.
|
|
You must be logged in to post in this thread.
|
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.
|
|