
Smoothed Lighting
#257 posted by Spike [86.135.244.26] on 2015/12/12 21:34:55
http://triptohell.info/moodles/junk/tyr_smoothnstuff.zip
adds a _smooth key to your func_detail entities that smooths the normals across surfaces.
you might want to use -anglescale 1 or the equivelent field in order to prevent quake's harsh boundaries between lit and unlit areas.
the qbsp flags the various surfaces. it doesn't currently support smoothing groups, but it would be the qbsp that would need to generate dupe verts for surfaces with different groups (this ensures that engines with specular effects can work correctly).
also adds a few other things that I've been messing around with. check the readme (be warned that much of the extra stuff only works with fte, but not always to the detriment of other engines - _lmscale has a well-defined fallback).
there's probably other issues with it - I'm not the intended audience so I'm kinda lazy where it comes to testing.
per-surface flags would be really nice right now... but yeah, map editors.

Cool, Thanks Spike!
#258 posted by
ericw [199.7.159.106] on 2015/12/12 21:44:45
Will check it out in a bit

Spike
#259 posted by
FifthElephant [82.24.73.240] on 2015/12/12 21:49:14
not sure how it works..
I made a key in my func_detail as _smooth and put the texture name in the field but it doesn't do anything?

High Five, Spike
#260 posted by
mankrip [66.249.88.204] on 2015/12/12 21:49:24
I'll take a look at it too.

Screenshot
#261 posted by
FifthElephant [82.24.73.240] on 2015/12/12 22:05:14
I'm trying to make the big pipe in the middle lit smooth... even with this util I am not getting smoothing.
http://www.quaketastic.com/files/screen_shots/5thnophong.png
Any ideas?

Fifth
#262 posted by
ericw [108.173.17.134] on 2015/12/12 22:58:09
It's working for me:
http://imgur.com/a/8KLPX
That's with just one light entity, "_anglesense 1" set, delay 3.
What kind of light sources are lighting the pipe currently?
If it's _sunlight, try adding "-anglesense 1" to the light command line, this controls how much sunlight (only regular sunlight, not _sunlight2) is affected by normals, 1 is the maximum amount.
Sunlight2 ignores normals, so try turning it off if you're using it.
You're running both spike's qbsp + light?

Eric
#263 posted by
FifthElephant [82.24.73.240] on 2015/12/12 23:06:06
I just tried it on an indoor area and it seems to work. It's not quite as good as the smoothing in Quake2's tools. I get very weird lighting on pipes for example (it's smooth but it doesn't like pipe bends and I'm getting harsh results)

Cool
#264 posted by
ericw [108.173.17.134] on 2015/12/12 23:21:15
i'd imagine with some polishing it can be made to work as well as Q2's, the Q2 tool source is available too.

Per Surface Flags
#265 posted by mh [213.233.150.23] on 2015/12/12 23:23:11
I haven't given this a whole load of thought, but just wondering how much of a big deal it would be to just use the Q2 .map format but compile it to a Q1 .bsp format.

Ok
#266 posted by
FifthElephant [82.24.73.240] on 2015/12/12 23:23:21
I managed to come up with a solution that works...
I've made just the visible faces have the texture that needs to be smoothed. This seems to only work with indoor lighting though. I do hope it can be applied to outdoor lighting too since I don't want to go back to the horrible method of lighting prior to sunlights.
Here's an example that shows the difference between phong shading and normal quake lighting -
https://twitter.com/GavinEdgington/status/675802921334915072

Specifically
#267 posted by
FifthElephant [82.24.73.240] on 2015/12/12 23:27:24
The pipes have lighting issues if anything but the visible faces have the smooth texture. I made the non-visible connecting faces use a skip texture to avoid these errors.
#268 posted by
ericw [108.173.17.134] on 2015/12/12 23:33:40
Ah, I see what you mean Fifth, sunlight is not phong-shaded. I'll see if I can fix it.

Good!
#269 posted by
mankrip [66.249.88.154] on 2015/12/12 23:52:54

#265
#270 posted by
mankrip [66.249.88.159] on 2015/12/13 00:02:46

Implementation
#271 posted by
FifthElephant [82.24.73.240] on 2015/12/13 00:03:03
is certainly not perfect and I would want to be able to have _smooth work with other brush types like func_group etc.

I'm Sorry For My Sins!
#272 posted by Spike [86.135.244.26] on 2015/12/13 03:44:59
@mankrip
afaik .map format doesn't have that many differences, just 3 extra args. brush contents, face flags, and face light level.
tyrlight already parses q2 maps and generates q1 bsps, however it completely discards the extra 3 args (also, no value texture alignment tweaks).
I don't see why you'd need q2 fgd changes at all, you'd still be targetting q1 mods and tools, and editors that support both would likely continue to support both without really caring.
the real issue is 1) editors that do not support quake2. 2) editors that insist on using wal files instead of wads. 3) editors that assume the palette is that of quake2 instead of quake.
for the editors that are mainitained tbh all it requires is for someone to be vocal enough - its amazing how much of a motivator harasment can be.
@ericw
I didn't change anything to do with sunlight that I remember, so yeah, no support there.
sorry about any other issues with it too. I was going to sit on it while someone else found the kinks for me, before making it public.
but, well, open source matra: release early, release often. I'm too lazy for the second part though.
by releasing I hoped to at least save some time for mankrip.
in theory it should be possible to switch the barrycentric coords part to use the entire polygon instead of a triangle (giving a less-triangular/higher-quality apearance), but I just went with what I understand.
@Fifth, there's nothing specific about classnames, it ought to work with any classname (at parse-time, on account of the way it flags texinfos). certainly there's nothing specific to func_detail.
all I can really suggest is to make sure that there's no tiny cracks between faces, because it calculates normals at each vertex and then just interpolates those over the various triangles that form the surface in a similar way to how a gl engine would interpolate normals.
remember that it'll happily smooth around any angle, 20 degrees, 90 degrees, 170... this means you'll likely want to use some other texture for the top/bottom of your mid-pipe cylinders so that they don't cause it to try to curve around those rings. secondly, sunlight isn't supported right now.
if you're looking at the map in fte or dp, make sure you disable any specular first. the texinfos are flagged to say that normals should be interpolated, but engines don't understand that yet, and yeah, I forgot sunlight, and there can still be harsh (often mid-surface) boundaries due to the maths behind the anglescale thing (at one point I was toying with the idea of these surfaces just always using a value of 1).

Update
#273 posted by
ericw [108.173.17.134] on 2015/12/13 05:22:37
I fixed a few bugs that were causing black fringes in my phong test map, and added support for phong+sunlight.
Here is a build:
http://quakespasm.ericwa.com/job/tyrutils-ericw-spike/3/artifact/dist/tyrutils-ericw-v0.15.3-7-g05de1ad-win32.zip
and the source code:
https://github.com/ericwa/tyrutils-ericw/commits/smoothnstuff
Hopefully this works on your map, Fifth!
Note, this is based on the previous release of tyrutils-ericw (0.15.3), I'll need to do some merging later on.

Editor Support
#274 posted by
SleepwalkR [93.209.70.10] on 2015/12/13 07:54:33
I'd add support for Quake 2 map in Quake games in a jiffy. Would be really easy too.

Eric
#275 posted by
FifthElephant [82.24.73.240] on 2015/12/13 10:07:32
That seems to work actually. Very cool. Have you altered the code at all? It seems slightly less smooth than before (but still a lot better than ordinary lighting).
#276 posted by
FifthElephant [82.24.73.240] on 2015/12/13 12:19:19
Seems like whole number integers on vertices or on texture alignment place a huge role in getting the lightmap to look right. Otherwise you get huge black bars or just errors in the lightmap.

Fifth
#277 posted by
ericw [108.173.17.134] on 2015/12/13 20:15:37
I see what you mean about less smooth / more banding, I messed up something with that last build; trying to fix it..
#278 posted by
ericw [108.173.17.134] on 2015/12/14 00:13:48
@Fifth here's another build to try, I think it fixes the things I broke in the last one:
http://quakespasm.ericwa.com/job/tyrutils-ericw-spike/9/artifact/dist/tyrutils-ericw-v0.15.3-10-g896b821-win32.zip
There is still room for improvement; I still get a few fringe artifacts on some terrain that was rotated 15 degrees, but it's pretty minor and way better than the last build.
@Spike: I switched this build to use SSE; for some reason x87 vs SSE was making a difference in the barycentric coordinates code, with SSE having less artifacts when interpolating points outside the triangles. I will investigate it better at some point :-)
#279 posted by
FifthElephant [178.99.14.242] on 2015/12/14 08:31:59
I will give it a whirl after work. These compilers give me leaks compared to the ones I normally use