Commit Graph

215 Commits

Author SHA1 Message Date
Joshua Yanovski
cf74d55f2e Fix map image artifacts and remove unneeded allocations.
Specifically, we address three concerns (the image stretching during
rotation, artifacts around the image due to clamping to the nearest
border color when the image is drawn to a larger space than the image
itself takes up, and potential artifacts around a rotated image which
accidentally ended up in an atlas and didn't have enough extra space to
guarantee the rotation would work).

The first concern was addressed by fixing the dimensions of the map
images drawn from the UI (so that we always use a square source
rectangle, rather than a rectangular one according to the dimensions of
the map).  We also fixed the way rotation was done in the fragment
shader for north-facing sources to make it properly handle aspect ratio
(this was already done for north-facing targets).  Together, these fix
rendering issues peculiar to rectangular maps.

The second and third concerns were jointly addressed by adding an
optional border color to every 2D image drawn by the UI.  This turns
out not to waste extra space even though we hold a full f32 color
(to avoid an extra dependency on gfx's PackedColor), since voxel
images already take up more space than Optiion<[f32; 4]> requires.
This is then implemented automatically using the "border color"
wrapping method in the attached sampler.

Since this is implemented in graphics hardware, it only works (at
least naively) if the actual image bounds match the texture bounds.
Therefore, we altered the way the graphics cache stores images
with a border color to guarantee that they are always in their own
texture, whose size exactly matches their extent.  Since the easiest
currently exposed way to set a border color is to do so for an
immutable texture, we went a bit further and added a new "immutable"
texture storage type used for these cases; currently, it is always
and automatically used only when there is a specified border color,
but in theory there's no reason we couldn't provide immutable-only
images that use the default wrapping mdoe (though clamp to border
is admittedly not a great default).

To fix the maps case specifically, we set the border color to a
translucent version of the ocean border color.  This may need
tweaking going forward, which shouldn't be hard.

As part of this process, we had to modify graphics replacement to
make sure immutable images are *removed* when invalidated, rather
than just having a validity flag unset (this is normally done by
the UI to try to reuse allocations in place if images are updated
in benign ways, since the texture atlases used for Ui do not
support deallocation; currently this is only used for item images,
so there should be no overlap with immutable image replacement,
so this was purely precautionary).

Since we were already touching the relevant code, we also updated
the image dependency to a newer version that provides more ways
to avoid allocations, and made a few other changes that should
hopefully eliminate redundant most of the intermediate buffer
allocations we were performing for what should be zero-cost
conversions.  This may slightly improve performance in some
cases.
2020-07-29 18:29:52 +02:00
Joshua Yanovski
2101113b46 Higher detail LOD. 2020-07-18 18:55:25 +02:00
Joshua Yanovski
add2cfae04 Revert some irrelevant stuff. 2020-07-16 01:57:39 +02:00
Joshua Yanovski
2e2ab3dc1e Fixing various things about shadows.
* Correcting optimal LISPSM parameter.
* Figure shadows are cast when they're not visible.
* Chunk shadows stay cast until you look away.
* Seamless cubemaps for point lights.
* Etc.
2020-07-15 13:30:49 +02:00
Joshua Yanovski
6c31e6b562 Fix shadow creation. 2020-07-12 19:50:26 +02:00
Joshua Yanovski
be438657c3 Tweaks to shadows.
Added shadow map resolution configuration, added seamless cubemaps,
documented all existing rendering options, and fixed a few Clippy
errors.
2020-07-12 18:28:08 +02:00
Joshua Yanovski
23b4058906 Fix moon, use nonlinear noise for terrain.
Note that the latter has a bit of performance cost.
2020-07-08 10:11:19 +02:00
Joshua Yanovski
0e66f02b25 All sprites sway in the wind now. 2020-07-07 20:09:01 +02:00
Joshua Yanovski
db1401a691 Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes 2020-07-07 19:34:17 +02:00
Joshua Barretto
30619771af Improved block picking 2020-07-06 23:04:13 +01:00
Joshua Barretto
62b59de95a Fixed sprite select flickering 2020-07-06 22:41:21 +01:00
Joshua Yanovski
ffe0f5928c Fix some issues with underwater rendering. 2020-07-04 21:21:12 +02:00
Joshua Yanovski
bfda6da42f Fix some minor display issues. 2020-07-04 19:17:59 +02:00
Joshua Yanovski
ccc6a06a8d Some minor changes. 2020-07-04 18:04:34 +02:00
Joshua Yanovski
7dd06da34c Add shadows.glsl. 2020-07-02 22:25:35 +02:00
Joshua Yanovski
618a18c998 Adding shadows, greedy meshing, and more. 2020-07-02 22:10:22 +02:00
Joshua Yanovski
f8376fd5dc Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes 2020-05-21 17:53:57 +02:00
Joshua Yanovski
654f7e0492 Correct backface culling. 2020-05-20 21:22:30 +02:00
Joshua Yanovski
560501df05 Greedy messhing for shadows. 2020-05-19 17:22:06 +02:00
Joshua Barretto
f1b166d15d Innumerable camera improvements 2020-05-18 23:40:28 +01:00
Joshua Barretto
68e77f43f8 Made figure placement correct with warping 2020-05-18 15:15:58 +01:00
Joshua Yanovski
a4d87e1875 Shadow maps work for lantern. 2020-05-17 05:59:00 +02:00
Joshua Yanovski
04382dc286 WIP: better graphics config, better LOD, shadow maps. 2020-05-15 14:22:17 +02:00
Joshua Yanovski
22ddbad3eb Minor shader fixes. 2020-05-02 18:54:09 +02:00
Joshua Yanovski
746a10e8d0 Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes 2020-05-02 04:02:09 +02:00
Joshua Yanovski
0f4a0e763d Switch back to pop-in terrain. 2020-05-01 23:03:24 +02:00
Joshua Yanovski
dd74fa7e4a LOD shading closer to voxel shading. 2020-05-01 22:58:55 +02:00
Joshua Barretto
1e91f7a0ab Added 1 extra bit per figure vertex position component, resolved char screen bug 2020-04-29 15:22:08 +01:00
Marcel Märtens
83af40a460 Allow for 0.5 offsets in figures 2020-04-29 14:10:46 +02:00
Joshua Yanovski
ef67bd58ba Experimental underwater lighting. 2020-04-28 20:49:03 +02:00
Joshua Yanovski
7482798354 Replace discard in figure-frag. 2020-04-27 21:59:55 +02:00
Joshua Yanovski
d83b4ae69b Fix sprite lighting, HDR from focus_pos. 2020-04-27 18:45:57 +02:00
Joshua Yanovski
0594238004 Proper HDR from point lights. 2020-04-27 18:14:10 +02:00
Joshua Yanovski
48c93d2b41 Brighter ambiance, darker LOD shadows. 2020-04-27 14:01:43 +02:00
Joshua Yanovski
e0452e895c More proper HDR. 2020-04-27 13:13:23 +02:00
Joshua Yanovski
4c6da3ed16 Trying LOD noise. 2020-04-27 00:13:10 +02:00
Joshua Yanovski
682a3d74c8 Fix LOD heights in towns. 2020-04-26 23:11:08 +02:00
Joshua Yanovski
cc39e5734e More LOD fixes. 2020-04-26 21:01:23 +02:00
Joshua Yanovski
8116b21c2e I like this coloring. 2020-04-25 23:54:43 +02:00
Joshua Yanovski
bc2560ea90 Merge remote-tracking branch 'origin/master' into sharp/small-fixes 2020-04-25 23:48:33 +02:00
Joshua Barretto
8e95444d85 Made GPU bone updates more conservative for moar fps 2020-04-25 21:44:23 +01:00
Joshua Barretto
7208b37dc5 Squashed figure vertices for better performance 2020-04-25 21:44:23 +01:00
Joshua Barretto
37301706d4 Reduced size of terrain sprite vertices 2020-04-25 21:44:23 +01:00
Joshua Barretto
c05f4fe009 Added configurable sprite view distance, minor bug fixes 2020-04-25 21:44:23 +01:00
Joshua Barretto
3e62f7edc3 Better LoD distance scaling 2020-04-25 21:44:23 +01:00
Joshua Yanovski
14effdd5db Re-saturate. 2020-04-25 22:24:35 +02:00
Joshua Yanovski
48a643955d Various fixes. 2020-04-25 22:23:57 +02:00
Joshua Yanovski
f7b497a0c2 Render figures again. 2020-04-25 03:22:49 +02:00
Joshua Yanovski
44e4aad48d Merge remote-tracking branch 'origin/master' into sharp/small-fixes 2020-04-25 02:01:04 +02:00
Joshua Yanovski
e6f0a5a981 Add atmospheric scattering. 2020-04-24 16:12:20 +02:00