|
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. |
|
|
#799 posted by PRITCHARD on 2017/05/08 07:43:43
I've never tried using them myself but it's in the docs.
#800 posted by Rick on 2017/05/08 14:21:20
I was thinking of Quake 2 where (all?) liquid textures had surface light. So I guess that's actually irrelevant.
Quake's palette shifting effect tends to make underwater areas too bright anyway but negative light would probably still help.
#801 posted by mh on 2017/05/08 18:14:03
Attenuate faster if the trace crosses a water surface.
How do you see this working with moving liquid bmodels?
MH
#802 posted by mankrip on 2017/05/08 18:53:56
How do you see this working with moving liquid bmodels?
Let's follow the current standard:
"_shadow" "n"
If n is 1, this model will cast shadows on other models and itself (i.e. "_shadow" implies "_shadowself"). Note that this doesn�t magically give Quake dynamic lighting powers, so the shadows will not move if the model moves. Default 0.
Liquid faces from inline bmodel entities should only be taken in consideration if their entity's self._shadow is 1.
Shadows are, essentially, instant attenuation. Faster attenuation can be considered semi-related to shadows.
#802
#803 posted by mankrip on 2017/05/08 18:56:38
#804 posted by ericw on 2017/05/08 20:23:05
The volumetric water attenuation is certainly do-able; the raytracer is already set up to have side effects when a ray hits certain surfaces.
The latest stable release from last fall has "stained glass" support, i.e. if you make bmodel with "_shadow" "1" and "_alpha" "0.5", light rays going through the entity will be partly attenuated and pick up the color of the texture.
So a simplified version of water attenuation would be not considering the distance traveled underwater, but just attenuate the ray when it goes through the surface. But on the other hand, I can imagine it would look cool to have bright sunlight at the water surface fading to black (thinking of an e1m4 type environment).
Anyway it's a cool idea to add to the todo list. My first priority now is fixing the breakage that Pritchard reported a while back, which I'm making good progress on but kind of a bit drained on tbh.
"Bit Drained On..."
#805 posted by Qmaster on 2017/05/08 20:44:01
That's fine, just know that what you are doing is really really great! There is no going back to the old tools now.
Incidentally, is your light or qbsp multithreaded? I know vis is, which changed light to be my current bottleneck (bounce fun notwithstanding).
#806 posted by ericw on 2017/05/08 21:17:09
Thanks, appreciate it :)
Light is multithreaded, qbsp is not. Qbsp could get a lot faster, it spends most of its time in CSGFaces checking if each brush intersects each other brush in the map. Quake 2's qbsp is multhreaded.
The main performance tip for light is to avoid using -extra or -extra4 except on your final compile, and also add -gate 0.1 or something to reduce the overhead of delay 2 lights.
#804
#807 posted by mankrip on 2017/05/09 08:29:36
Thanks!
No problem, I can wait.
Light Diff
#808 posted by mankrip on 2017/05/10 02:22:17
Idea:
When a map is recompiled, compare its entities with the entities in its previously compiled BSP file, and use the radius of each light to determine which surfaces had their lighting changed.
This way, when recompiling lights, the light tool can simply copy all unchanged lightmaps from the BSP file, and compile only the modified lightmaps rather than recompiling all lightmaps.
Bounce lighting can make this complicated, so I'm not sure if it would be possible.
#809 posted by PRITCHARD on 2017/05/10 02:26:18
I feel like if you're testing within each light's radius to see what brushes have changed, you're already doing a lot of the grunt work for compiling a new lightmap...
It could work for a rough and messy sketch if you were willing to let a lot of edge cases slip through and accept the odd corrupted face or two, but then you invite the possibility of someone releasing a map compiled with that option turned on...
#810 posted by mankrip on 2017/05/10 02:53:46
testing within each light's radius
Only for the light entities that changed. Quite often, it will be only 1 light.
#811 posted by ericw on 2017/05/10 03:13:41
What I've been thinking of, that's sort of related to that, is making a light preview tool; it would be a small GUI application with a 3d view with WASD+mouselook. You would open a map file and the tool does qbsp and light and displays the result, except the light baking is done on faces near the camera first, and the 3d view updates as each face finishes baking. Then it would refresh whenever the .map file is re-saved. I think this would be pretty sweet.
#812 posted by metlslime on 2017/05/10 06:24:56
yeah, what I have always wanted is a tool that lets me edit the lighting in realtime. I think that a diff-based approach to recalculating lightmaps would be fast enough to make this possible. Most edits would only affect one light, which has only local effects. Of course editing the sun values would not be as easily optimized.
#813 posted by PRITCHARD on 2017/05/10 07:16:07
I'm not really sure what happens if you use old light data on a new BSP, but wouldn't it be pretty broken if you edited the brushwork around a light that hadn't changed. Say you made a ceiling, put a light on it, ran qbsp/light, then built the rest of the room and tried to patch.
I don't know what that would look like but I imagine it'd be quite bad...
#814 posted by mh on 2017/05/10 21:49:16
Yeah, that would be quite broken.
There are also complexities around light styles, combining lights with the same style, and packing in new lightdata/updating light offsets, which may in theory require to recalc for the entire BSP.
#815 posted by mankrip on 2017/05/11 01:45:10
Question: Does ._phong work across multiple entities when combined with ._shadow, to make multiple func_wall, func_illusionary, etc blend smoothly with the world's func_detail "entities"?
Right now I'm on mobile and can't test it.
Pretty certain it does mankrip
#817 posted by ericw on 2017/05/11 02:55:36
Iirc, separate func_detail / group will be blended if the _phong settings allow it. But other bmodels never blend with each other or world.
The Cursed Words...
#818 posted by PRITCHARD on 2017/05/11 03:04:51
Having a real time lighting renderer like ericw would be really neat. If you were able to cull light calculations to the player's view (You'd have to be very generous - bouncing their view around corners to find lights that should cast but would otherwise be missed), you could potentially have an engine that displayed in the traditional quake style, while keeping the main benefits of lighting in real time like moving lights.
I can already imagine a whole set of horrendous edge cases arising from this sort of thing, but it'd be a pretty neat thing to see and something that I'd hope modern computers would have the power to pull off...
#819 posted by muk on 2017/05/11 03:07:23
I have ZERO issue in paying for a light preview tool to be created. Even if its separate from TB.
Mapper's Most Wanted List
#820 posted by Qmaster on 2017/05/11 22:25:46
�WYSIWYG Editor (lighting, models, anims, particles, the works)
�Leak indicator light: red dot on status bar means leak, green means you're good, updates in realtime during editing. (Plus toggleable prt lines, yes this is same concept as lighting preview)
�Auto entity naming and quick linking/pathing (JACK is pretty good actually)
In earnest, having a simple little window with a 3D fly view and a button click to "render", even if it took about 20sec, would be an awesome help to have over on my 3rd monitor.
sleepwalkr might be able to integrate something into Trenchbroom's 3d view if you mocked it up.
Go for it ericw! Would make adding all the nifty features easier, such as testing phong or bouncescales.
#817
#821 posted by mankrip on 2017/05/13 01:21:26
Yeah, I've just tested, and it doesn't work:
screenshot
The back of the column is a func_detail with _phong 1. The front of the column is a func_wall with _phong 1 and _world 1.
If _phong 1 worked on mixed entity types with _world 1, we could work around some of the BSP's planar/vertex accuracy limitations by alternating between func_detail and func_wall brushes. This would make the engine clip their planes at the rendering level, which is completely accurate and doesn't produce distortions.
#821 @mankrip
#822 posted by Spike on 2017/05/14 02:42:44
quake's lighting logic has some bias on its dotproducts that increses the amount of light on surfaces that are nearly perpendicular to lights (which is important for lights placed near said surface).
You can disable the effect with _anglescale 1 (I think it is now - vanilla hardcoded it to 0.5)
the '_phong' key simply calculates surface normals on a per-sample basis instead of per-surface (thus meaning its misnamed as it doesn't change the lighting formula). It affects the lighting, but not the shadows. While it would be possible to push the sample worldspace positions according to the same calculated normals, and determining shadows based upon those, such things would be quite unreliable in practice - for instance, a concave surface curve would logically push those sample positions inside the surface, which would result in all traces being obscured with the surface shadowing itself.
so yeah, that's why you get sudden lighting changes on the edge of pillars - because -anglescale is biasing the light on one side while the other side is in pure shadow.
if you want to try it anyway, this is the maths I use in FTE for tessellation:
vec3 w = p0*bary[0]+p1*bary[1]+p2*bary[2];
vec3 t0 = w - dot(w-p0,n0)*n0;
vec3 t1 = w - dot(w-p1,n1)*n1;
vec3 t2 = w - dot(w-p2,n2)*n2;
w = w*(1.0-factor) + factor*(bary[0]*t0+bary[1]*t1+bary[2]*t2);
you should be able to shove something like that into GLM_InterpolateNormal (and convert from glsl to cpp - I already renamed stuff from glsl). You'll then need to return the smoothed position back through multiple callers to the point where its copied into the lightmap samples array.
Bonus points if you can calculate the barycentric coords (read: interpolation weights) for general polygons instead of just triangles.
like I say, you'll need to clamp the shadow-point to never be behind the surface to avoid the more obvious glitches. once implemented properly you'll get smoother lighting around corners (although due to the nature of traceline shadows, it'll probably still be somewhat sudden without anglescale 1).
#823 posted by ericw on 2017/05/14 19:16:13
@mankrip, smoothing between separate models is too difficult to attempt, imho, because smoothing relies on the model having been processed by QBSP. i.e. it involves walking around the mesh (exploring neighbouring faces to a vertex, and neighbouring faces to a face, etc.). If the models weren't clipped against each other, the smoothing wouldn't work.
@spike in current git, I wiped out the "traceline to position sample points" thing. Instead I'm trying to use the same code as phong shading, so exploring the mesh by following connections between faces. So in a concave surface, it should work properly and give world space positions that are consistent with the interpolated normals.
Only problem is, it needs some more work.. Pritchard's case in #773 was failing because of t-junctions in the bsp. I want light to work properly if qbsp didn't add t-junc vertices, so I'm making light do it (in memory only).
re: GLM_InterpolateNormal, apologies for the current mess I made in the code and weird names.. I tried using the glm library a bit, then decided I didn't like it. (100 layers of indirection/ abstraction for basic vector operations, slow as hell debug builds,..)
On the plus side the test suite is growing slowly.
|
|
You must be logged in to post in this thread.
|
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.
|
|