2023-10-28 15:53:35 +00:00
|
|
|
#version 440 core
|
2020-06-30 14:29:35 +00:00
|
|
|
|
(See sharp/lod-history) LOD, shadows, greedy meshing, new lighting, perf
---
Pretty much a Veloren fork at this point. Here's a high level overview of the changes (will be added to CHANGELOG just before merge).
At a high level this MR incorporates roughly two groups of changes.
The first group consists of new game features: more flexible map sizes, level of detail terrain, shadow maps, and a new lighting
engine. This is "feature work" that (mostly) only adds new things to Veloren, and mostly shouldn't affect old stuff.
The second big group of changes are those addressing the fallout from all the new features. These include performance fixes of
various sorts: the addition of multiple graphics options and optimization of the cheap ones to avoid work, switching all voxel
models to use some variant of greedy meshing, switching over much of our CPU-side vector math to exploit SIMD instructions
(coinciding with a fork of `vek`), and a rewrite of how the UI handles text rendering (coinciding with updates to our fork
of `conrod`). Making Veloren's hardcoded colors appear correct under the new lighting engine also required considerably
changes (TODO: Fill in this section when it's complete).
The second category of changes often heavily touches code owned by other people, including frequently modified code "owned" by a
handful of people, so I recommend that this code be reviewed particularly carefully.
---
At a high level (each will be described in more detail below):
- The world map has been refactored.
- The world size is no longer hardcoded (@zesterer).
- The map generation code was made generic to allow using it outside of the `world` crate (@zesterer).
- On world creation, we now compute *horizon maps* (@zesterer).
- The way we pass the world from the server to the client has been updated (@xMAC94x).
- Artifacts related to image rotation were fixed (@imbris).
- Multiflow rivers were enabled (@zesterer).
- In the process of making changes related to the world map, various incidental fixes and optimizations were required.
- The new *level of detail* feature was added (@zesterer wrote part of this and has checked out the rest).
- A new LOD terrain rendering step was added to the pipeline.
- The LOD terrain quality was made configurable via a graphics setting.
- Horizon maps were used to cast shadows from LOD chunks on both LOD and non-LOD terrain.
- A "voxelization" effect was incorporated into rendered LOD terrain to make it blend better into the world.
- In the process of making changes related to LOD, various incidental fixes and optimizations were required.
- Veloren's lighting has been completely overhauled (@zesterer has already checked most of this out).
- A semi-accurate index of refraction was assigned to our materials.
- A new, more realistic, physically based approach to lighting was used using the *Ashikhmin Shirley* BRDF.
- We emulate *atmospheric scattering* using equations designed for measuring solar panel light exposure.
- We attempt to compute *realistic light attenuation* in water using its real material properties.
- In the process of making changes related to LOD, various incidental fixes and optimizations were required.
- Point and directional lights now cast realistic shadows, using *shadow mapping.* (@imbris, @zesterer, @Treeco, @YuriMomo)
- Point light shadow maps were added to the rendering pipeline, using geometry shaders and *seamless cube maps*.
- Directional light shadows were added to the rendering pipeline, using LISPSM together with disabling *depth clamping*.
- "Shadow-only" chunks and NPCs were added to prevent shadows from models behind you from disappearing.
- In the process of making changes related to shadow maps, various incidental fixes and optimizations were required.
The addition of shadow maps, LOD terrain, and the new lighting all led to significant performance degradation, on top of other
changes happening in master. Therefore, a large number of performance improvements were also needed:
- The graphics options were made much more flexible and configurable, and shaders were optimize.
- New options were provided for how to render lights and shadows (@Pfauenauge, @zesterer).
- Graphic setting storage and configuration were overhauled to make adding new features easier (@Pfauenauge, @imbris).
- Shaders were rewritten to utilize GLSL's preprocessor to avoid overhead (@zesterer, @YuriMomo).
- In the process of making changes related to providing additional rendering options, various incidental fixes and optimizations were required.
- Voxel model creation was switched to use *greedy meshing.*
- A new voxel meshing method, greedy meshing, was added (@imbris).
- Uses of the older meshing methods were migrated to use greedy meshing (@imbris, @jshipsey, @Pfauenauge).
- New restrictions were added to terrain, figure, and sprites to future proof them for further optimizations (@jshipsey, @Pfauenauge, @zesterer).
- Most positions are now relative to either chunk or player position for better precision (@imbris, @zesterer, @scottc).
- In the process of making changes related to greedy meshing, various incidental fixes and optimizations were required.
- Animation and terrain math were switched to use SIMD where possible.
- Fixes were made to vek to make its SIMD feature usable for us (@zesterer, @imbris).
- The interface and types used in bone animation were changed in various ways (@jshipsey, @Snowram, @Pfauenauge).
- Redundant code generation for body animation is now partly taken care of by a macro (@jshipsey, @Snowram, @Pfauenauge).
- Animation code was modified to to use vek's SIMD representation where possible (@jshipsey, @Snowram, @Pfauenauge).
- Terrain meshing code and shadow map math were also modified to use vek's SIMD representation (@imbris).
- SIMD instruction generation was enabled (@YuriMomo, @jshipsey, @Snowram, @imbris, @Angelonfira, @xMAC94x).
- In the process of making changes related to greedy meshing, various incidental fixes and optimizations were required.
- The way we cache glyphs was completely refactored, fixed, and optimized.
- Our fork of `conrod` was optimized in various ways (@imbris).
- Our fork of `conrod` now exposes whether a widget was updated during the current frame (@imbris).
- Our use of the glyph cache was rewritten for correctness (@imbris).
- A *text cache* was introduced that lets us skip remeshing glyphs that have not changed (@imbris).
- Various changes were made to reduce pressure on the glyph cache, with more planned (@imbris, @Pfauenauge).
- In the process of making changes related to the glyph cache, various incidental fixes and optimizations were required.
- Colors were changed to keep Veloren's look consistent with master.
- Some older tree models were brought back (@Pfauenauge).
- TODO(@Sharp): All hardcoded colors were extracted and made hotloadable.
- TODO(@Treeco, @Pfauenauge, @imbris, @jshipsey): Hardcoded colors were fixed to conform to Veloren's style.
- TODO(@Treeco, @Pfauenauge, @imbris, @jshipsey): Color models were fixed to conform to Veloren's style.
A detailed description of the involved changes follows.
---
- The world size is no longer hardcoded. All functions dependent on world size now take a `WorldSizeLg`, which holds the base 2 logarithm of each actual world dimension and is guaranteed to maintain certain properties (outlined in `common/src/terrain/map.rs`). Additionally, many utility functions that utilize the world size were moved into `common` as well (mostly `common/src/terrain/mod.rs`). Finally, the world map format was updated in order to store its size explicitly, with a migration path from the old format that should work whenever the old formatted map was a square (practically always). See `world/src/sim/mod.rs` for these changes.
- The map generation code was made generic to allow using it outside of the `world` crate. The parts of the map generating code that do not need to query the world were moved over to `common/src/terrain/map.rs`, allowing them to be used from the client without creating a dependency on `world`. The rest of it was turned into helper functions in `world/src/sim/map.rs`, which can be passed as closures to the generic map generation code to complete its construction. This also means that colors are now passed in separately to the map generation function. See <https://veloren.net/devblog-78/> for more details.
- On world creation, we now compute *horizon maps*. See the function in `world/src/sim/util.rs`.
Given a height map and a plane intersecting that height map, our horizon maps allow us to encode enough information to reconstruct shadows for each point on the height map using only the *horizon angle* (the angle at which the sun starts to become visible). As Veloren's sun only covers one plane, this is sufficient for encoding sun shadows for LOD terrain, by encoding two angles per chunk (one for each 90 degrees the sun covers). We can also use this for the moon, if we want, since the moon follows the same path. Additionally, we store the *height* of the furthest occluder, to try to make the shadows volumetric; so this means 4 bytes in total for each chunk.
Support for horizon maps has been merged into the map functionality in common as well.
- The way we pass the world from the server to the client has been updated. Rather than passing the prerendered map, we instead pass three maps with values for each chunk; one with the color information, a second with altitude information, and a third with horizon map information. We then reconstruct the map on the client, together with some additional information we send from the server (like the sea level and maximum height). See `common/src/msg/server.rs` for a detailed description of the format of `WorldMapMsg`, and `server/src/libr.rs` and `client/src/lib.rs` for details of the map construction and parsing.
- Artifacts related to image rotation were fixed. See the commit message for commit SHA `cf74d55f2e3d2ae7d25fd68d5c73b01a6afde86e` for a detailed explanation. This involved changes to shaders, the addition of a new type of graphic (also reflected in the graphic cache) that allows specifying a border color (which automatically makes the associated texture immutable), and some related fixes. I reproduce the first two paragraphs of the MR description as well:
```
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).
```
- Multiflow rivers were enabled.
This does not really need to be part of this MR, and would be easy to revert, but since it seemed to provide a nice improvement it's currently packaged with it.
We already computed multiple outflows from each chunk for erosion purposes long before this MR.
However, we never modified river rendering to be able to handle this case (just a single downhill river flow is complex enough!) so this was not exposed when deciding which chunks were rivers.
Now that
- In the process of making changes related to the world map, various incidental fixes and optimizations were required. Some examples of fixes include making sure terrain is never lowered to below sea level (to make the shadow maps report correct values), fixing map altitudes and colors to understand things like cliffs and "block level" coloring (that doesn'te xist on the column level), and fixing a crashbug when rendering images for the UI where source pixels are strongly rectangular. Some examples of related performance fixes include avoiding allocating a fresh vector for all the maps (i.e. copying it over to change the format from `[u32; n]` to `DynamicImage` and then copying again to convert to `RgbaImage`), and instead using the `gfx::memory::slice` function to accomplish the same thing. These sorts of changes are spread all arond the code.
This includes the additon of a new scene, `voxygen/src/scene/lod.rs`, a new pipeline `voxygen/src/render/pipeline/lod_terrain.rs`, and new shaders `assets/vxygen/shaders/lod-terrain-vert.glsl` and `assets/vxygen/shaders/lod-terrain-frag.glsl`, as well as associated changes to the renderer in `voxygen/src/render/renderer.rs`.
The main idea behind our initial approach to LOD was to take the world data we now get from the server (altitude, color, and horizon mapping).
- Some previously computed values were turned into shader uniforms for better prediction on weak processors. (@zesterer)
- Calls to power or trig functions were removed or replaced with multiplications, where possible.
- After some deliberation
- To properly handle sprite "waving" for nearby sprites,
We explicitly designed the greedy meshing system with figures and sprites in mind.
In both cases, we want to be able to *efficiently* pack many different models into the same texture, especially in cases where we know
we will either not be removing any of the grouped-together from the models from the texture, or will remove all of them at once (so
they can be packed into some specific subtexture).
For sprites, since we know every model in advance and never intend to deallocate them, we currently pack them all as efficiently as
possible into one giant tetxure atlas. However, in the future we might opt to pack them slightly less efficiently in exchange for
shrinking the sprite vertex size.
For figures, we pack all the textures for each *model* into the same atlas.
is a global texture atlas used for every sprite, and for figures which is why we have the ability to mesh multiple
models to the same texture area (using the simple texture atlas allocator) without requiring intermediate vector allocations.
This is accomplished by delaying the time when we actually write the color and light data to the texture until *after* all the
model vertices have been meshed; then, we can just allocate the whole color/light array at once, making the atlas we use an
exact fit. In computer science-y terms, we accomplish this delay by, after we perform the initial greedy meshing (without
texture information), not continuing to create the texture data, but instead constructing a *continuation*--that is, a function
that, when called, will execute the rest of the computation. We push this continuation (which in Rust terms is a `FnOnce` closure
that takes the `ColLightsInfo` that it is supposed to write to as context) onto a
onto a vector
resizing. To allow for suspended writes to texture data, Rust pointed out to me that the continuation that would eventually write the color and light data to the texture atlas (the one that is shared by all models sharing the same greedy mesher) would have to *own* whatever data it mshed. Because we often generate the model data to mesh as a temporary in `voxygen/src/load.rs`, the
- Matrix multiplications in the shader were reduced for figure data (@zesterer).
- Vertex "waves" for fluid data were removed.
- Terrain "bending" near edges was removed.
- Scaling was fixed to make sure empty space was not introduced in a space previously occupied by a block. It was also changed to take ownership of its voxel data,
rather than sharing it, to let it be used with meshing.
- Rust's nightly version was bumped in order to use the `array_map` function, which lets us reuse more code between the simple map and `FigureModelCache`.
- PositionedGlyph::standalone.
---
I tried to cite sources in many cases[^realtime],[^lloyd],[^lispsm],[^pbrt],[^greedy],[^tjunctions]
where I needed features from elsewhere but I am particularly grateful for the following resources,
esepcially where they have accompanying source code. I linked all of them that are accessible to the public (those that are not were
obtained through legal means).
[^realtime]: Eisemann, Elmar, Michael Schwarz, Ulf Assarsson, Michael Wimmer. Real-Time Shadows. A K Peters/CRC Press (T&F), 20160419.
[^lloyd]: Lloyd,B. 2007. [Logarithmic perspective shadow maps](http://gamma.cs.unc.edu/papers/documents/dissertations/lloyd07.pdf). PhD thesis, University of North Carolina.
[^lispsm]: Wimmer, M., Scherzer, D., and Purgathofer, W. 2004. [Light space perspective shadow maps](http://gamma.cs.unc.edu/papers/documents/dissertations/lloyd07.pdf). In Proceedings of Eurographics Symposium on Rendering 2004, pp. 143– 152.
[^pbrt]: Pharr, Matt, et al. [http://gamma.cs.unc.edu/papers/documents/dissertations/lloyd07.pdf](Physically Based Rendering: From Theory to Implementation). Third edition, Morgan Kaufmann Publishers/Elsevier, 2017.
[^greedy]: mikolalysenko. “Meshing in a Minecraft Game.” 0 FPS, 30 June 2012, <https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/>.
[^tjunctions]: blackflux. “Meshing in Voxel Engines – Part 1.” Blackflux.Com, 23 Feb. 2014, <https://blackflux.wordpress.com/2014/02/23/meshing-in-voxel-engines-part-1/>.
I am also especially grateful to Khronos, Wikiepdia, and stackoverflow for answering many of my specific questions while writing the MR.
---
Squashed commit of the following:
commit 300505e7305a2fdac722a808ee8538323f215f39
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 18:46:25 2020 +0200
Fixing cargo doc and typo in CHANGELOG.
commit ec0aeb18e8499d7d84ef818331b4b65c3d76cea6
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 15:38:50 2020 +0200
Hopefully final commit for the LOD branch.
commit 5e8ea0b1eaac02903a02feb2eb038d195de4872f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 10:14:26 2020 +0200
Falling back to power as stopgap.
commit e44a1cbf46504ee9931a01bdc9033e145500d557
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 09:25:41 2020 +0200
Address imbris feedback.
Temporarily disables shiny water, lowers max VD.
These restrictions will be lifted soon after merging.
commit 561e25778a108ac3712f5ec2ce3a51234c4430d3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 08:31:13 2020 +0200
Tweaking shaders a bit.
commit 7d19259078ce0dd7b3742ad7d0cb3fab3ece3fdc
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 07:59:43 2020 +0200
Fix view example as well.
commit 051cd4934e0fad2c0b15db4380a4189fa318679f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 07:29:06 2020 +0200
Fix meshing benchmark.
commit c95e07db3b4dcca285678985e65e31b927cb1c61
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 05:46:22 2020 +0200
Address MR feedback, fix scene clouds.
commit 1bfb816cabdb3ffc1e507a009c2d98696b4b573a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 04:39:36 2020 +0200
Incorporating Pfau's figure color changes.
New eyes and new humanoid colors.
commit 3f9b89a3ac7b3356b1dba0d1a8f6541357f81469
Merge: e2f5162e4 62c53963a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 04:29:41 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit e2f5162e4f96f4124aa43488f7245d341b3dcfd4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 04:28:38 2020 +0200
World colors are all hotloadable.
They live in assets/world/style/colors.ron.
Only a small handful of hardcoed colors remain in World; they are either
part of the map, or difficult to disentangle from the rest of the
computation. Comments are made where appropriate.
commit 62c53963abe1975009d34a8f9515a355bef24f31
Author: Marcel Märtens <marcel.cochem@googlemail.com>
Date: Wed Aug 19 15:59:00 2020 +0200
replace pretty_env_logger with tracing
commit 5b1625f99d9586fe80e2232f583ec5af9f953099
Merge: d71003acd 4942b5b39
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 19 05:15:56 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit d71003acdabeff970b3928e97c26af6847b5b78e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 19 05:14:34 2020 +0200
Hotloading colors, part 1: colors in common.
Currently, this just entails humanoid colors. There are only three
colors not handled; the light emitter colors in
common/src/comp/inventory/item/tool.rs. These don't seem important
enough to me to warrant making hotloadable, at least not right now, but
if it's needed later we can always add them to the file.
commit 63b5e0e553eb2ea49276f192a6fc7dd65254270d
Merge: c32b337a4 6d2c4b9c1
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 17 13:05:37 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit c32b337a46e10d9de473d178a94a3ccd61c39bb3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 17 05:52:04 2020 +0200
Fixing LOD grid, for real.
commit a166ae0360395387e09fb35a1f84210c2ce5ec24
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 17 05:28:05 2020 +0200
Addressing imbris's initial feedback.
Fixes two minor bugs: explosion particles were no longer spawning
randomly, and LOD grids were not perfectly even.
commit 4cbad004f44060994252dd3d38647a14a589712f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 16 19:27:58 2020 +0200
Bumping nightly per request.
commit 548680276aac77c25d43d16b5622f847d474dbef
Merge: acc098604 8f8b20c91
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 16 19:26:06 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit acc0986040589a3492f88a740bc3c3fc693b26d3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 15 22:28:32 2020 +0200
Lower resolution due to lying drivers.
commit d3b878de2a52c358d2944a6bbd0555dad7fbdb10
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 15 22:15:38 2020 +0200
Fix issues msh encountered with Intel 4600.
commit 10245e0c1b0cb6fae10d86409435364edc6102ef
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 15 21:15:02 2020 +0200
Merge more models into one mesh than we did previously.
commit 3155c31e663c52ae5c3a53d5fb5665892a1a498a
Merge: 7204cc8a7 3c199280e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 22:35:22 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 7204cc8a7a4f74a30306bd205d9834fee4bb944f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 22:34:43 2020 +0200
Fix not yet done NPC animations.
This forces them all to be the idle animation if not specified.
This fixes issues where you'd have giant NPCs in water.
commit bc83360f2a08918f19d417b5f772e1ff554dba08
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 19:36:37 2020 +0200
Try to fix some bugs:
- Z fighting with LOD terrain and water.
- Audio SFX not playing.
commit 1fd104aa603bf3781b6526a5cada46aeca3049dd
Merge: 862df3c99 7c2c392a3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 12:02:31 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 862df3c9976c4da9bd7cfd784f1a85973127968a
Merge: 0a4218ed9 75c1d4401
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 05:52:56 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 0a4218ed9d541a2b34c133351bea38a99ddf4ea7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 22:27:14 2020 +0200
Fix particle depth.
commit f51dfdeb442d0dd5243dd2f344fa4be295bd0875
Merge: c6251a956 5e6dc0471
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 20:19:04 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit c6251a956ad376400dca5c23420cf8d213dc8fdf
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 20:15:46 2020 +0200
Cache figures more intelligently.
Cache figures for longer, and don't cache character states for the
player except where they actually affect the rendered model.
commit 0ed801d5404982c6fb63b1eaa4567d908b294c9d
Merge: c11b9bdf0 eea64f78f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 16:32:24 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit c11b9bdf0a53bf9884d2f5a48fec9b01d582df1a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 11:47:15 2020 +0200
Remove unneeded Clippy annotation.
commit 16aa9ef40af56d69289d00aafb3deadfb8bd4f35
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 8 00:53:02 2020 +0200
Fix hotloading and Clippy.
commit 3dc973e0be5b758da1e9805eb764ad401374cd0c
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 23:50:27 2020 +0200
Major speedups with SIMD.
commit fba64a7d93d5a96077ce87287bbce6ab9b7fbcae
Merge: 76429d00e d1e10b178
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 13:23:19 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 76429d00eea00d212fbd672a84ee91e75b19b938
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 13:23:10 2020 +0200
Add clippy.toml.
commit c79f512f84dbb83cb82b7954db68ff241dfd8e41
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 11:55:20 2020 +0200
Fix all clippy issues, clean up Rust code.
commit 6f90e010b3fbefb53b0d632e819931350015b6b8
Merge: 77a8c7c26 5929cfa5c
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 06:47:30 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit 77a8c7c267d3f44a1a62bd6b2274359973c5e4d4
Merge: b44e44232 44febaabd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 06:47:10 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 5929cfa5c713aa392110bbb62407f76caf53c3df
Author: jshipsey <jshipsey18@gmail.com>
Date: Thu Aug 6 20:47:27 2020 -0400
fixed in-hand arrow bug
commit b44e442325d828f1cd564d66908f89d09e80474b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 6 13:40:35 2020 +0200
Miscellaneous performance improvements.
commit be37acf287c1360d8085862526ac3365ffd1d768
Merge: 125d7fc6c c11876547
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 3 05:49:27 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 125d7fc6c4dcd8c8c5f27b8268a4d64f409f3644
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 3 04:55:31 2020 +0200
Abstract over simd vs. repr_c vectors.
Also some minor improvements to Event size.
commit d4d4956e9252e1241ce110b2aa85076c6b1e2a23
Merge: 5f3b7294a aced5f979
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 2 20:56:54 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 5f3b7294af1f8533edc2620b58863c248e2b07af
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 2 20:43:52 2020 +0200
Fix formatting issues I missed before.
commit a428a3ebba70dcab63dd0f8cd983120c90617271
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 2 20:41:51 2020 +0200
Fix clippy warnings, part 1.
There aer still a bunch of type too complex and
function takes too many arguments warnings that I'll fix later
(or ignore, since in the one case I did fix a function takes too
many arguments warning I think it made the code *less* readable).
commit ba54307540ed8a937ac08209730284fc653af85b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 30 13:22:42 2020 +0200
Fix light animations so they are removed when the light turns off.
commit 7e0f4bcbf0f4717145d8beac40d52e3acebbe2aa
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 29 21:10:20 2020 +0200
Fix crash in edge case for pixel art.
commit 56da06f7a351e2b949e9b014a90b974d511a0924
Merge: cf74d55f2 9f53a4a19
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 29 18:56:52 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit cf74d55f2e3d2ae7d25fd68d5c73b01a6afde86e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 29 18:29:52 2020 +0200
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.
commit ad18ce939940a8c697270f6e9b94db9942fd8295
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 28 13:21:09 2020 +0200
Fix continent scale hack.
commit 36b1cb074f5b195aebd7dbbc3da7f0246a1a18ec
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 28 12:11:40 2020 +0200
Enable loading different sized maps without a recompile.
We may want to tweak the effects of the continent_scale_hack.
commit 13b6d4d534cc4814b7cb3294ca41bbfea0a6b186
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 28 10:55:48 2020 +0200
Removing WORLD_SIZE, part 1.
Erased almost every instance of WORLD_SIZE and replaced it with a local
power of two, map_size_lg (which respects certain invariants; see
common/src/terrain/map.rs for more details about MapSizeLg). This also
means we can avoid a dependency on the world crate from client, as
desired.
Now that the rest of the code is not expecting a fixed WORLD_SIZE, the
next step is to arrange for maps to store their world size, and to use
that world size as a basis prior to loading the map (as well, probably,
as prior to configuring some of the noise functions).
commit 30b1d2c6428230a9eaa0d749cdcbbd6f1cbccd78
Merge: 7d56ba31b 1377b369f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Jul 27 13:16:58 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit 7d56ba31b445441461b28a07fc495d7d4f047c17
Merge: 2101113b4 598f14b25
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Jul 27 13:16:27 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 1377b369f6db2258e910d467a5740f31789e3ded
Author: Monty Marz <m.marzouq@gmx.de>
Date: Sun Jul 19 23:25:38 2020 +0200
more saturated pumpkins
commit ae8d50527f93bb0616c2ad46ce4dacb63bc37c6d
Author: Monty Marz <m.marzouq@gmx.de>
Date: Sat Jul 18 20:29:56 2020 +0200
acacia models
commit 2101113b467e691de787392d7f20f1745f5637bd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 18 18:55:25 2020 +0200
Higher detail LOD.
commit add2cfae04b4385fa5590e11e2bd5229d9dee0aa
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 16 01:57:39 2020 +0200
Revert some irrelevant stuff.
commit 2e2ab3dc1eaa59a4aef7f8d34a53d8aae4c8553a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 15 13:30:49 2020 +0200
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.
commit 6c31e6b56217274285b597af297036691ea5d897
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Jul 12 19:50:26 2020 +0200
Fix shadow creation.
commit 6332cbe006115ae205597529cd8bbccd146c2cca
Merge: be438657c 930e0028b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Jul 12 18:47:00 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit be438657c33d7b5bfb0a9582c3ed3fd366637323
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Jul 12 18:28:08 2020 +0200
Tweaks to shadows.
Added shadow map resolution configuration, added seamless cubemaps,
documented all existing rendering options, and fixed a few Clippy
errors.
commit 23b4058906013c7d2a40c286e20e32c5fbd897ed
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 10:11:19 2020 +0200
Fix moon, use nonlinear noise for terrain.
Note that the latter has a bit of performance cost.
commit 7fbe5cbfbb9dc29607957b8e62f432a4deed193d
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 02:23:02 2020 +0200
Address lies about max texture size.
commit bcfc62b5e13a1cdd83f57535fde4694720bebfd9
Merge: 75e3626a7 18a08e8fe
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 02:22:08 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit 75e3626a785919f43fdcf2127c2b10e3e4df2f9f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 02:21:52 2020 +0200
OpenGL 3.3 minimum.
commit 18a08e8fe2739f02af99a5d2cb4e7c38c49e858b
Author: Monty Marz <m.marzouq@gmx.de>
Date: Tue Jul 7 23:57:52 2020 +0200
settings localization
commit 90c5d1ca3620092bc3ae10b2211489eb1cf6f5e8
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 21:11:48 2020 +0200
Lower near distance.
commit 0e66f02b25aaddaa2dfddbbc89cd67de54a9a7b4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 20:09:01 2020 +0200
All sprites sway in the wind now.
commit db1401a6910bf42dcf502462c90038752ff5fbdb
Merge: 69e508d8c e8b4b29d7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 19:34:17 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 69e508d8c94d8973033817ca86f357e466fc7c4d
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 18:41:37 2020 +0200
Make it easy to switch to SIMD for math.
commit ffe0f5928c7a7e87d00cb5426b3b1d831d7e02fd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 21:21:12 2020 +0200
Fix some issues with underwater rendering.
commit bfda6da42f38fd02c31ee92c81ab785a3e50c2a0
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 19:17:59 2020 +0200
Fix some minor display issues.
commit 0ed752e087968cf901301884aaeae698e32ef8a5
Merge: ccc6a06a8 518edcb85
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 18:14:21 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit ccc6a06a8d4504d6b9f7af7905a414d2ee06ab76
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 18:04:34 2020 +0200
Some minor changes.
commit 4e020246702889269efe1a191788992164c508d6
Merge: 50a64d927 e05c9267a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 16:17:40 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 50a64d927e6c4f4b0e4688e4cbfca694bc3f922a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 13:07:03 2020 +0200
Fix far plane.
commit 7dd06da34cae8f9ea3b6c889fe965181f3fd3949
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 2 22:25:35 2020 +0200
Add shadows.glsl.
commit 618a18c998778bf871b905a74657440fcc384c80
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 2 22:10:22 2020 +0200
Adding shadows, greedy meshing, and more.
commit eaea83fe6a5cb1cb0ba8beef888183c718258496
Merge: 267018495 2f89b863e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu May 21 22:47:07 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 2670184954a13e4a9e7a4e35ba79aac0c5fac2f7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu May 21 21:20:01 2020 +0200
Make civsim and sites deterministic.
For anything in worldgen where you use a HashMap, *please* think
carefully about which hasher you are going to use! This is
especially true if (for some reason) you are depending on hashmap
iteration order remaining stable for some aspect of worldgen.
commit f8376fd5dc72b4a9c2f51a6b4570d59c8b8e9343
Merge: 654f7e049 cdee191dd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu May 21 17:53:57 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 654f7e049258d9da27c09608bbe6a46ffa8787e5
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed May 20 21:22:30 2020 +0200
Correct backface culling.
commit 560501df05ca725409b0f2e4eb31bdfdc15fd0c7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue May 19 17:22:06 2020 +0200
Greedy messhing for shadows.
commit a4d87e1875ca543436e6bbbeb20348facc5a52d7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun May 17 05:59:00 2020 +0200
Shadow maps work for lantern.
commit 243d0837b8a3b08172c9a3c348d964d7ddc2a0a8
Merge: 04382dc28 71dd520cd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 15 14:53:13 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 04382dc28632b6c66e8821f6870c0daaa1c1901a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 15 14:22:17 2020 +0200
WIP: better graphics config, better LOD, shadow maps.
commit 22ddbad3eb32bfa70f0932176022208fe67ded81
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat May 2 18:54:09 2020 +0200
Minor shader fixes.
commit 746a10e8d01ac235f994b0cde78fa48998602a1f
Merge: 0f4a0e763 40ab94673
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat May 2 04:02:09 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 0f4a0e763db3afbdc4fb0558611f38326ca87151
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 1 23:03:24 2020 +0200
Switch back to pop-in terrain.
commit dd74fa7e4a53667b38811d7aec58d7f6a68889bb
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 1 22:58:55 2020 +0200
LOD shading closer to voxel shading.
commit ef67bd58ba0bdaf622b078892d768263b6cba268
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Apr 28 20:49:03 2020 +0200
Experimental underwater lighting.
commit 2c5ad9d07605e80d5fd5679dd3a5d70c605b86a9
Merge: 748279835 303967a6f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 22:35:24 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 7482798354eda18c8207950080fc24d443a369de
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 21:59:55 2020 +0200
Replace discard in figure-frag.
commit d83b4ae69be4912f69bf7835f509c68a1c7770a4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 18:45:57 2020 +0200
Fix sprite lighting, HDR from focus_pos.
commit 0594238004f116274905fa0ed7c2b6c417ed1d29
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 18:14:10 2020 +0200
Proper HDR from point lights.
commit 48c93d2b41ce5743103d18e76cc228f5ac766492
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 14:01:43 2020 +0200
Brighter ambiance, darker LOD shadows.
commit e0452e895ccfa8a43f368cae3b8b8aedc24dad93
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 13:13:23 2020 +0200
More proper HDR.
commit 4c6da3ed16cfeebb455e40da5f557b4af9a499d7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 00:13:10 2020 +0200
Trying LOD noise.
commit 682a3d74c85df5503ffe1fc1cc891bce789df1ad
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Apr 26 23:11:08 2020 +0200
Fix LOD heights in towns.
commit cc39e5734e8b18f9077bf42e66337c1319dd6b6e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Apr 26 21:01:23 2020 +0200
More LOD fixes.
commit 8116b21c2e51c836e77894e309ac273caf2917b3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 23:54:43 2020 +0200
I like this coloring.
commit bc2560ea90b36f4b46190005344232d993043ac3
Merge: 14effdd5d e690efe71
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 23:48:33 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 14effdd5db8747fcf3eb34f03b46b7792e92d1c5
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 22:24:35 2020 +0200
Re-saturate.
commit 48a643955d4435b78179acba0beb4a979905cc31
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 22:23:57 2020 +0200
Various fixes.
commit f7b497a0c25f4ad4682c71dd1ed6f608052feb9b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 03:22:49 2020 +0200
Render figures again.
commit 44e4aad48deba8266b9f8bdfd3db096b381f5327
Merge: e6f0a5a98 9ec319a18
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 02:01:04 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit e6f0a5a981a82533ba188fff0a54ce98577bb152
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 24 16:12:20 2020 +0200
Add atmospheric scattering.
commit f2953087f691a8edbc001cb98ebf5059fc6f8ac0
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 23 00:01:20 2020 +0200
Fix shadowing for specular reflections.
commit ddd4a67a9799b8d08c7dc0c2bec90621c2bed0e3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Apr 22 22:56:12 2020 +0200
HDR fixes.
commit 1015e60deef3c447381996277df7496707a63bd0
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Apr 21 18:25:19 2020 +0200
More lighting changes.
commit 80c264abd111fb237e57843efcb5c071d4f84613
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 13 00:29:59 2020 +0200
Lighting experiments.
commit 8414987e589dd5102bad89762a3adaccc0bfe957
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 9 02:38:40 2020 +0200
WIP -- lighting changes and soft shadows.
commit 9cd2b3fb0d6b49776c6dfe463e4169637250b11a
Merge: c7ea687eb 8b149ad11
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 4 02:33:29 2020 +0200
Merge branch 'sharp/new-lighting' into sharp/small-fixes
commit c7ea687ebbc5aace1b455f134a5bf49ce2c7434a
Merge: 476441531 22f3319b4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 4 02:33:02 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 8b149ad11ad4bb75018fcf9519baec27d1c95951
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 4 02:32:39 2020 +0200
Trying out a new lighting model.
commit b0ac9f36f755dd06f7c17c46150568064790864f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 3 07:56:11 2020 +0200
Use bicubic interpolation for terrain.
commit f6fc9307a121514b614bc50ef8eb055953e7da8a
Merge: 33140a295 22f3319b4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 3 05:01:41 2020 +0200
Merge remote-tracking branch 'origin/master' into zesterer/lod
commit 4764415312aae6e9ac2d00e86e84577cb958f1ab
Merge: ed2d0111d 13388ee6a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 3 04:54:48 2020 +0200
Merge branch 'sharp/map-colors' into sharp/small-fixes
commit 13388ee6a42943f3f79a9cb488346cef18e272fe
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 20:30:08 2020 +0200
Various fixes (to coloring and to soft shadows).
commit fbd084a94a067082a87cd6d28b82054709bc9265
Merge: 5a089863b 4fdf6896a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 18:50:38 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/map-colors
commit ed2d0111d994262ae836d84d1fe5a45e4de72a0b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 06:49:27 2020 +0200
Combining colors and LOD.
commit 88342640c6b835114d01c797b89fdede3b0a2108
Merge: 33140a295 5a089863b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 04:49:20 2020 +0200
Merge branch 'sharp/map-colors' into sharp/small-fixes
commit 33140a2951b8212725f42c758b277aaec4d888f7
Merge: 4c65a5aed f34d4b379
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 04:36:21 2020 +0200
Merge remote-tracking branch 'origin/master' into zesterer/lod
commit 5a089863beb01d4794bbe3580ada47b278715ea2
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 03:17:49 2020 +0200
Making maps brighter.
This is probably not the right way to do it, but oh well!
commit 32b2c99109dd486aa922886081068f9c550c83f2
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 02:46:36 2020 +0200
Horizon mapping and "layered" map generation.
Horizon mapping is a method of shadow mapping specific to height maps.
It can handle any angle between 0 and 90 degrees from the ground, as
long as know the horizontal direction in advance, by remembering only a
single angle (the "horizon angle" of the shadow map). More is explained
in common/src/msg/server.rs. We also remember the approximate height of
the largest occluder, to try to be able to generate soft shadows and
create a vertical position where the shadows can't go higher.
Additionally, map generation has been reworked. Instead of computing
everything from explicit samples, we pass in sampling functions that
return exactly what the map generator needs. This allows us to cleanly
separate the way we sample things like altitudes and colors from the map
generation process. We exploit this to generate maps *partially* on the
server (with colors and rivers, but not shading). We can then send the
partially completed map to the client, which can combine it with shadow
information to generate the final map. This is useful for two reasons:
first, it makes sure the client can apply shadow information by itself,
and second, it lets us pass the unshaded map for use with level of
detail functionality.
For similar reasons, river generation is split
out into its own layer, but for now we opt to still generate rivers on
the server (since the river wire format is more complicated to compress
and may require some extra work to make sure we have enough precision to
draw rivers well enough for LoD).
Finally, the mostly ad-hoc lighting we were performing has been (mostly)
replaced with explicit Phong reflection shading (including specular
highlights). Regularizing this seems useful and helps clarify the
"meaning" of the various light intensities, and helps us keep a more
physically plausible basis. However, its interaction with soft shadows
is still imperfect, and it's not yet clear to me what we need to do to
turn this into something useful for LoD.
commit f8926a5737ddc51f3d585c651a64c43677aae0f4
Merge: a1aee931e 875ae6ced
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Mar 13 13:32:42 2020 +0100
Merge remote-tracking branch 'origin/master' into sharp/map-colors
commit 4c65a5aed353b119aea65a2aaeb94549b67beb42
Author: Treeco <5021038-Treeco@users.noreply.gitlab.com>
Date: Mon Feb 24 16:48:05 2020 +0000
Made LOD setting slider exponential
commit 2fa7b2d20d7233dc8bfd64f9f7f54617575248f1
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 17:49:53 2020 +0000
Added mist to LoD
commit aab059a450b5f635777129ff82cc15b662965c3c
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 15:14:06 2020 +0000
Added LoD slider
commit 779c36b538121c5ade3633ae5cb67bb14c8c3877
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 12:54:55 2020 +0000
Reduced cost of vertex pushing
commit 9fea150473906b166365b738ebcea07c697daf3d
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 12:38:53 2020 +0000
Fixed maths, improved LoD resolution
commit 5481df38fea5bf183ff376a3337179cfaa5233dc
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 11:22:50 2020 +0000
Dynamically relocate LoD vertices to enhance details
commit a3e36a50ababd615da7db1b26158c7906a5def01
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 18:13:51 2020 +0000
Simpler terrain spiral rendering
commit 255f450ae9ac8763db4bede075fb409161ed57cc
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 16:53:17 2020 +0000
Better LoD precision
commit 3d027aebe812a5b8658a4eb8123dc9f61b3776d2
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 16:04:03 2020 +0000
Better falloff
commit be775c9484b457b2c0b1a494aec03392d0c70e76
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 15:30:45 2020 +0000
Applied good ideas from experimental branch
commit 58587b68545a23c5c04ab4574a4b94b3bc982246
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 16:15:13 2020 +0000
Minor fixes to LoD merging
commit 7b42aebd709c14df2db766aad61d9280ad24d84d
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 15:04:44 2020 +0000
Capped LoD dragging
commit 8aafc559f87124e1ea5ca6e3ddc2aa0c242d793c
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 14:54:37 2020 +0000
Better blending between LoD and terrain border
commit edd3455d5161792d87ddc8eadc0ecbad5532b284
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 14:40:19 2020 +0000
Fixed LoD z depth, added sea level offset
commit b9b06744620114dd5556e73f64fa93c145503a7c
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 14:27:43 2020 +0000
Better LoD smoothing
commit a1aee931e790431560cd2d953ad61d9497072afd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Feb 21 14:52:17 2020 +0100
Adding shadows.
commit 2400786c13dd891c131ed86d48d05df516a8a778
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 13:48:40 2020 +0000
Use world map as LoD source
commit dbf650f504a4c25fbbc2096ac3616c736bf52d23
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Jan 20 00:48:14 2020 +0000
Better clouds at distance
commit 5e6f81b86cdb9730b9b056877b19257075fd5fa8
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Jan 19 23:59:02 2020 +0000
sync
commit 745e7540ddb000cc645f612767b337c2ddc3f7c0
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Nov 22 12:40:48 2019 +0000
Improved cloud falloff mist, faster noise sampling
commit f6a200d0cb866196ba57697466755f9e0c7ea5d8
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Nov 22 10:09:00 2019 +0000
Improved long-range depth precision, removed unnecessary LoD polygons
commit 63d1b2bb2292898d59fb4f4e502201103dfeb86f
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Thu Nov 21 20:57:46 2019 +0000
Working LoD shader
commit f13d98ee3e58f881e8b978861a67663b59ed91ec
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Thu Nov 21 11:03:40 2019 +0000
LoD first attempt (stack overflow issue)
2020-08-20 18:34:59 +00:00
|
|
|
#include <constants.glsl>
|
|
|
|
|
|
|
|
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
|
|
|
|
|
|
|
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
|
|
|
|
|
|
|
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
|
|
|
|
|
|
|
#define LIGHTING_DISTRIBUTION_SCHEME LIGHTING_DISTRIBUTION_SCHEME_MICROFACET
|
|
|
|
|
|
|
|
#define LIGHTING_DISTRIBUTION LIGHTING_DISTRIBUTION_BECKMANN
|
|
|
|
|
2020-06-30 14:29:35 +00:00
|
|
|
#include <globals.glsl>
|
|
|
|
#include <srgb.glsl>
|
2020-07-31 09:32:13 +00:00
|
|
|
#include <random.glsl>
|
2021-01-31 15:15:17 +00:00
|
|
|
#include <lod.glsl>
|
2020-06-30 14:29:35 +00:00
|
|
|
|
2020-11-29 21:38:03 +00:00
|
|
|
layout(location = 0) in vec3 v_pos;
|
(See sharp/lod-history) LOD, shadows, greedy meshing, new lighting, perf
---
Pretty much a Veloren fork at this point. Here's a high level overview of the changes (will be added to CHANGELOG just before merge).
At a high level this MR incorporates roughly two groups of changes.
The first group consists of new game features: more flexible map sizes, level of detail terrain, shadow maps, and a new lighting
engine. This is "feature work" that (mostly) only adds new things to Veloren, and mostly shouldn't affect old stuff.
The second big group of changes are those addressing the fallout from all the new features. These include performance fixes of
various sorts: the addition of multiple graphics options and optimization of the cheap ones to avoid work, switching all voxel
models to use some variant of greedy meshing, switching over much of our CPU-side vector math to exploit SIMD instructions
(coinciding with a fork of `vek`), and a rewrite of how the UI handles text rendering (coinciding with updates to our fork
of `conrod`). Making Veloren's hardcoded colors appear correct under the new lighting engine also required considerably
changes (TODO: Fill in this section when it's complete).
The second category of changes often heavily touches code owned by other people, including frequently modified code "owned" by a
handful of people, so I recommend that this code be reviewed particularly carefully.
---
At a high level (each will be described in more detail below):
- The world map has been refactored.
- The world size is no longer hardcoded (@zesterer).
- The map generation code was made generic to allow using it outside of the `world` crate (@zesterer).
- On world creation, we now compute *horizon maps* (@zesterer).
- The way we pass the world from the server to the client has been updated (@xMAC94x).
- Artifacts related to image rotation were fixed (@imbris).
- Multiflow rivers were enabled (@zesterer).
- In the process of making changes related to the world map, various incidental fixes and optimizations were required.
- The new *level of detail* feature was added (@zesterer wrote part of this and has checked out the rest).
- A new LOD terrain rendering step was added to the pipeline.
- The LOD terrain quality was made configurable via a graphics setting.
- Horizon maps were used to cast shadows from LOD chunks on both LOD and non-LOD terrain.
- A "voxelization" effect was incorporated into rendered LOD terrain to make it blend better into the world.
- In the process of making changes related to LOD, various incidental fixes and optimizations were required.
- Veloren's lighting has been completely overhauled (@zesterer has already checked most of this out).
- A semi-accurate index of refraction was assigned to our materials.
- A new, more realistic, physically based approach to lighting was used using the *Ashikhmin Shirley* BRDF.
- We emulate *atmospheric scattering* using equations designed for measuring solar panel light exposure.
- We attempt to compute *realistic light attenuation* in water using its real material properties.
- In the process of making changes related to LOD, various incidental fixes and optimizations were required.
- Point and directional lights now cast realistic shadows, using *shadow mapping.* (@imbris, @zesterer, @Treeco, @YuriMomo)
- Point light shadow maps were added to the rendering pipeline, using geometry shaders and *seamless cube maps*.
- Directional light shadows were added to the rendering pipeline, using LISPSM together with disabling *depth clamping*.
- "Shadow-only" chunks and NPCs were added to prevent shadows from models behind you from disappearing.
- In the process of making changes related to shadow maps, various incidental fixes and optimizations were required.
The addition of shadow maps, LOD terrain, and the new lighting all led to significant performance degradation, on top of other
changes happening in master. Therefore, a large number of performance improvements were also needed:
- The graphics options were made much more flexible and configurable, and shaders were optimize.
- New options were provided for how to render lights and shadows (@Pfauenauge, @zesterer).
- Graphic setting storage and configuration were overhauled to make adding new features easier (@Pfauenauge, @imbris).
- Shaders were rewritten to utilize GLSL's preprocessor to avoid overhead (@zesterer, @YuriMomo).
- In the process of making changes related to providing additional rendering options, various incidental fixes and optimizations were required.
- Voxel model creation was switched to use *greedy meshing.*
- A new voxel meshing method, greedy meshing, was added (@imbris).
- Uses of the older meshing methods were migrated to use greedy meshing (@imbris, @jshipsey, @Pfauenauge).
- New restrictions were added to terrain, figure, and sprites to future proof them for further optimizations (@jshipsey, @Pfauenauge, @zesterer).
- Most positions are now relative to either chunk or player position for better precision (@imbris, @zesterer, @scottc).
- In the process of making changes related to greedy meshing, various incidental fixes and optimizations were required.
- Animation and terrain math were switched to use SIMD where possible.
- Fixes were made to vek to make its SIMD feature usable for us (@zesterer, @imbris).
- The interface and types used in bone animation were changed in various ways (@jshipsey, @Snowram, @Pfauenauge).
- Redundant code generation for body animation is now partly taken care of by a macro (@jshipsey, @Snowram, @Pfauenauge).
- Animation code was modified to to use vek's SIMD representation where possible (@jshipsey, @Snowram, @Pfauenauge).
- Terrain meshing code and shadow map math were also modified to use vek's SIMD representation (@imbris).
- SIMD instruction generation was enabled (@YuriMomo, @jshipsey, @Snowram, @imbris, @Angelonfira, @xMAC94x).
- In the process of making changes related to greedy meshing, various incidental fixes and optimizations were required.
- The way we cache glyphs was completely refactored, fixed, and optimized.
- Our fork of `conrod` was optimized in various ways (@imbris).
- Our fork of `conrod` now exposes whether a widget was updated during the current frame (@imbris).
- Our use of the glyph cache was rewritten for correctness (@imbris).
- A *text cache* was introduced that lets us skip remeshing glyphs that have not changed (@imbris).
- Various changes were made to reduce pressure on the glyph cache, with more planned (@imbris, @Pfauenauge).
- In the process of making changes related to the glyph cache, various incidental fixes and optimizations were required.
- Colors were changed to keep Veloren's look consistent with master.
- Some older tree models were brought back (@Pfauenauge).
- TODO(@Sharp): All hardcoded colors were extracted and made hotloadable.
- TODO(@Treeco, @Pfauenauge, @imbris, @jshipsey): Hardcoded colors were fixed to conform to Veloren's style.
- TODO(@Treeco, @Pfauenauge, @imbris, @jshipsey): Color models were fixed to conform to Veloren's style.
A detailed description of the involved changes follows.
---
- The world size is no longer hardcoded. All functions dependent on world size now take a `WorldSizeLg`, which holds the base 2 logarithm of each actual world dimension and is guaranteed to maintain certain properties (outlined in `common/src/terrain/map.rs`). Additionally, many utility functions that utilize the world size were moved into `common` as well (mostly `common/src/terrain/mod.rs`). Finally, the world map format was updated in order to store its size explicitly, with a migration path from the old format that should work whenever the old formatted map was a square (practically always). See `world/src/sim/mod.rs` for these changes.
- The map generation code was made generic to allow using it outside of the `world` crate. The parts of the map generating code that do not need to query the world were moved over to `common/src/terrain/map.rs`, allowing them to be used from the client without creating a dependency on `world`. The rest of it was turned into helper functions in `world/src/sim/map.rs`, which can be passed as closures to the generic map generation code to complete its construction. This also means that colors are now passed in separately to the map generation function. See <https://veloren.net/devblog-78/> for more details.
- On world creation, we now compute *horizon maps*. See the function in `world/src/sim/util.rs`.
Given a height map and a plane intersecting that height map, our horizon maps allow us to encode enough information to reconstruct shadows for each point on the height map using only the *horizon angle* (the angle at which the sun starts to become visible). As Veloren's sun only covers one plane, this is sufficient for encoding sun shadows for LOD terrain, by encoding two angles per chunk (one for each 90 degrees the sun covers). We can also use this for the moon, if we want, since the moon follows the same path. Additionally, we store the *height* of the furthest occluder, to try to make the shadows volumetric; so this means 4 bytes in total for each chunk.
Support for horizon maps has been merged into the map functionality in common as well.
- The way we pass the world from the server to the client has been updated. Rather than passing the prerendered map, we instead pass three maps with values for each chunk; one with the color information, a second with altitude information, and a third with horizon map information. We then reconstruct the map on the client, together with some additional information we send from the server (like the sea level and maximum height). See `common/src/msg/server.rs` for a detailed description of the format of `WorldMapMsg`, and `server/src/libr.rs` and `client/src/lib.rs` for details of the map construction and parsing.
- Artifacts related to image rotation were fixed. See the commit message for commit SHA `cf74d55f2e3d2ae7d25fd68d5c73b01a6afde86e` for a detailed explanation. This involved changes to shaders, the addition of a new type of graphic (also reflected in the graphic cache) that allows specifying a border color (which automatically makes the associated texture immutable), and some related fixes. I reproduce the first two paragraphs of the MR description as well:
```
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).
```
- Multiflow rivers were enabled.
This does not really need to be part of this MR, and would be easy to revert, but since it seemed to provide a nice improvement it's currently packaged with it.
We already computed multiple outflows from each chunk for erosion purposes long before this MR.
However, we never modified river rendering to be able to handle this case (just a single downhill river flow is complex enough!) so this was not exposed when deciding which chunks were rivers.
Now that
- In the process of making changes related to the world map, various incidental fixes and optimizations were required. Some examples of fixes include making sure terrain is never lowered to below sea level (to make the shadow maps report correct values), fixing map altitudes and colors to understand things like cliffs and "block level" coloring (that doesn'te xist on the column level), and fixing a crashbug when rendering images for the UI where source pixels are strongly rectangular. Some examples of related performance fixes include avoiding allocating a fresh vector for all the maps (i.e. copying it over to change the format from `[u32; n]` to `DynamicImage` and then copying again to convert to `RgbaImage`), and instead using the `gfx::memory::slice` function to accomplish the same thing. These sorts of changes are spread all arond the code.
This includes the additon of a new scene, `voxygen/src/scene/lod.rs`, a new pipeline `voxygen/src/render/pipeline/lod_terrain.rs`, and new shaders `assets/vxygen/shaders/lod-terrain-vert.glsl` and `assets/vxygen/shaders/lod-terrain-frag.glsl`, as well as associated changes to the renderer in `voxygen/src/render/renderer.rs`.
The main idea behind our initial approach to LOD was to take the world data we now get from the server (altitude, color, and horizon mapping).
- Some previously computed values were turned into shader uniforms for better prediction on weak processors. (@zesterer)
- Calls to power or trig functions were removed or replaced with multiplications, where possible.
- After some deliberation
- To properly handle sprite "waving" for nearby sprites,
We explicitly designed the greedy meshing system with figures and sprites in mind.
In both cases, we want to be able to *efficiently* pack many different models into the same texture, especially in cases where we know
we will either not be removing any of the grouped-together from the models from the texture, or will remove all of them at once (so
they can be packed into some specific subtexture).
For sprites, since we know every model in advance and never intend to deallocate them, we currently pack them all as efficiently as
possible into one giant tetxure atlas. However, in the future we might opt to pack them slightly less efficiently in exchange for
shrinking the sprite vertex size.
For figures, we pack all the textures for each *model* into the same atlas.
is a global texture atlas used for every sprite, and for figures which is why we have the ability to mesh multiple
models to the same texture area (using the simple texture atlas allocator) without requiring intermediate vector allocations.
This is accomplished by delaying the time when we actually write the color and light data to the texture until *after* all the
model vertices have been meshed; then, we can just allocate the whole color/light array at once, making the atlas we use an
exact fit. In computer science-y terms, we accomplish this delay by, after we perform the initial greedy meshing (without
texture information), not continuing to create the texture data, but instead constructing a *continuation*--that is, a function
that, when called, will execute the rest of the computation. We push this continuation (which in Rust terms is a `FnOnce` closure
that takes the `ColLightsInfo` that it is supposed to write to as context) onto a
onto a vector
resizing. To allow for suspended writes to texture data, Rust pointed out to me that the continuation that would eventually write the color and light data to the texture atlas (the one that is shared by all models sharing the same greedy mesher) would have to *own* whatever data it mshed. Because we often generate the model data to mesh as a temporary in `voxygen/src/load.rs`, the
- Matrix multiplications in the shader were reduced for figure data (@zesterer).
- Vertex "waves" for fluid data were removed.
- Terrain "bending" near edges was removed.
- Scaling was fixed to make sure empty space was not introduced in a space previously occupied by a block. It was also changed to take ownership of its voxel data,
rather than sharing it, to let it be used with meshing.
- Rust's nightly version was bumped in order to use the `array_map` function, which lets us reuse more code between the simple map and `FigureModelCache`.
- PositionedGlyph::standalone.
---
I tried to cite sources in many cases[^realtime],[^lloyd],[^lispsm],[^pbrt],[^greedy],[^tjunctions]
where I needed features from elsewhere but I am particularly grateful for the following resources,
esepcially where they have accompanying source code. I linked all of them that are accessible to the public (those that are not were
obtained through legal means).
[^realtime]: Eisemann, Elmar, Michael Schwarz, Ulf Assarsson, Michael Wimmer. Real-Time Shadows. A K Peters/CRC Press (T&F), 20160419.
[^lloyd]: Lloyd,B. 2007. [Logarithmic perspective shadow maps](http://gamma.cs.unc.edu/papers/documents/dissertations/lloyd07.pdf). PhD thesis, University of North Carolina.
[^lispsm]: Wimmer, M., Scherzer, D., and Purgathofer, W. 2004. [Light space perspective shadow maps](http://gamma.cs.unc.edu/papers/documents/dissertations/lloyd07.pdf). In Proceedings of Eurographics Symposium on Rendering 2004, pp. 143– 152.
[^pbrt]: Pharr, Matt, et al. [http://gamma.cs.unc.edu/papers/documents/dissertations/lloyd07.pdf](Physically Based Rendering: From Theory to Implementation). Third edition, Morgan Kaufmann Publishers/Elsevier, 2017.
[^greedy]: mikolalysenko. “Meshing in a Minecraft Game.” 0 FPS, 30 June 2012, <https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/>.
[^tjunctions]: blackflux. “Meshing in Voxel Engines – Part 1.” Blackflux.Com, 23 Feb. 2014, <https://blackflux.wordpress.com/2014/02/23/meshing-in-voxel-engines-part-1/>.
I am also especially grateful to Khronos, Wikiepdia, and stackoverflow for answering many of my specific questions while writing the MR.
---
Squashed commit of the following:
commit 300505e7305a2fdac722a808ee8538323f215f39
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 18:46:25 2020 +0200
Fixing cargo doc and typo in CHANGELOG.
commit ec0aeb18e8499d7d84ef818331b4b65c3d76cea6
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 15:38:50 2020 +0200
Hopefully final commit for the LOD branch.
commit 5e8ea0b1eaac02903a02feb2eb038d195de4872f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 10:14:26 2020 +0200
Falling back to power as stopgap.
commit e44a1cbf46504ee9931a01bdc9033e145500d557
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 09:25:41 2020 +0200
Address imbris feedback.
Temporarily disables shiny water, lowers max VD.
These restrictions will be lifted soon after merging.
commit 561e25778a108ac3712f5ec2ce3a51234c4430d3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 08:31:13 2020 +0200
Tweaking shaders a bit.
commit 7d19259078ce0dd7b3742ad7d0cb3fab3ece3fdc
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 07:59:43 2020 +0200
Fix view example as well.
commit 051cd4934e0fad2c0b15db4380a4189fa318679f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 07:29:06 2020 +0200
Fix meshing benchmark.
commit c95e07db3b4dcca285678985e65e31b927cb1c61
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 05:46:22 2020 +0200
Address MR feedback, fix scene clouds.
commit 1bfb816cabdb3ffc1e507a009c2d98696b4b573a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 04:39:36 2020 +0200
Incorporating Pfau's figure color changes.
New eyes and new humanoid colors.
commit 3f9b89a3ac7b3356b1dba0d1a8f6541357f81469
Merge: e2f5162e4 62c53963a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 04:29:41 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit e2f5162e4f96f4124aa43488f7245d341b3dcfd4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 20 04:28:38 2020 +0200
World colors are all hotloadable.
They live in assets/world/style/colors.ron.
Only a small handful of hardcoed colors remain in World; they are either
part of the map, or difficult to disentangle from the rest of the
computation. Comments are made where appropriate.
commit 62c53963abe1975009d34a8f9515a355bef24f31
Author: Marcel Märtens <marcel.cochem@googlemail.com>
Date: Wed Aug 19 15:59:00 2020 +0200
replace pretty_env_logger with tracing
commit 5b1625f99d9586fe80e2232f583ec5af9f953099
Merge: d71003acd 4942b5b39
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 19 05:15:56 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit d71003acdabeff970b3928e97c26af6847b5b78e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 19 05:14:34 2020 +0200
Hotloading colors, part 1: colors in common.
Currently, this just entails humanoid colors. There are only three
colors not handled; the light emitter colors in
common/src/comp/inventory/item/tool.rs. These don't seem important
enough to me to warrant making hotloadable, at least not right now, but
if it's needed later we can always add them to the file.
commit 63b5e0e553eb2ea49276f192a6fc7dd65254270d
Merge: c32b337a4 6d2c4b9c1
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 17 13:05:37 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit c32b337a46e10d9de473d178a94a3ccd61c39bb3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 17 05:52:04 2020 +0200
Fixing LOD grid, for real.
commit a166ae0360395387e09fb35a1f84210c2ce5ec24
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 17 05:28:05 2020 +0200
Addressing imbris's initial feedback.
Fixes two minor bugs: explosion particles were no longer spawning
randomly, and LOD grids were not perfectly even.
commit 4cbad004f44060994252dd3d38647a14a589712f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 16 19:27:58 2020 +0200
Bumping nightly per request.
commit 548680276aac77c25d43d16b5622f847d474dbef
Merge: acc098604 8f8b20c91
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 16 19:26:06 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit acc0986040589a3492f88a740bc3c3fc693b26d3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 15 22:28:32 2020 +0200
Lower resolution due to lying drivers.
commit d3b878de2a52c358d2944a6bbd0555dad7fbdb10
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 15 22:15:38 2020 +0200
Fix issues msh encountered with Intel 4600.
commit 10245e0c1b0cb6fae10d86409435364edc6102ef
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 15 21:15:02 2020 +0200
Merge more models into one mesh than we did previously.
commit 3155c31e663c52ae5c3a53d5fb5665892a1a498a
Merge: 7204cc8a7 3c199280e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 22:35:22 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 7204cc8a7a4f74a30306bd205d9834fee4bb944f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 22:34:43 2020 +0200
Fix not yet done NPC animations.
This forces them all to be the idle animation if not specified.
This fixes issues where you'd have giant NPCs in water.
commit bc83360f2a08918f19d417b5f772e1ff554dba08
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 19:36:37 2020 +0200
Try to fix some bugs:
- Z fighting with LOD terrain and water.
- Audio SFX not playing.
commit 1fd104aa603bf3781b6526a5cada46aeca3049dd
Merge: 862df3c99 7c2c392a3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 12:02:31 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 862df3c9976c4da9bd7cfd784f1a85973127968a
Merge: 0a4218ed9 75c1d4401
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 13 05:52:56 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 0a4218ed9d541a2b34c133351bea38a99ddf4ea7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 22:27:14 2020 +0200
Fix particle depth.
commit f51dfdeb442d0dd5243dd2f344fa4be295bd0875
Merge: c6251a956 5e6dc0471
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 20:19:04 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit c6251a956ad376400dca5c23420cf8d213dc8fdf
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 20:15:46 2020 +0200
Cache figures more intelligently.
Cache figures for longer, and don't cache character states for the
player except where they actually affect the rendered model.
commit 0ed801d5404982c6fb63b1eaa4567d908b294c9d
Merge: c11b9bdf0 eea64f78f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 16:32:24 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit c11b9bdf0a53bf9884d2f5a48fec9b01d582df1a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Aug 12 11:47:15 2020 +0200
Remove unneeded Clippy annotation.
commit 16aa9ef40af56d69289d00aafb3deadfb8bd4f35
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Aug 8 00:53:02 2020 +0200
Fix hotloading and Clippy.
commit 3dc973e0be5b758da1e9805eb764ad401374cd0c
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 23:50:27 2020 +0200
Major speedups with SIMD.
commit fba64a7d93d5a96077ce87287bbce6ab9b7fbcae
Merge: 76429d00e d1e10b178
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 13:23:19 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 76429d00eea00d212fbd672a84ee91e75b19b938
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 13:23:10 2020 +0200
Add clippy.toml.
commit c79f512f84dbb83cb82b7954db68ff241dfd8e41
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 11:55:20 2020 +0200
Fix all clippy issues, clean up Rust code.
commit 6f90e010b3fbefb53b0d632e819931350015b6b8
Merge: 77a8c7c26 5929cfa5c
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 06:47:30 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit 77a8c7c267d3f44a1a62bd6b2274359973c5e4d4
Merge: b44e44232 44febaabd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Aug 7 06:47:10 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 5929cfa5c713aa392110bbb62407f76caf53c3df
Author: jshipsey <jshipsey18@gmail.com>
Date: Thu Aug 6 20:47:27 2020 -0400
fixed in-hand arrow bug
commit b44e442325d828f1cd564d66908f89d09e80474b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Aug 6 13:40:35 2020 +0200
Miscellaneous performance improvements.
commit be37acf287c1360d8085862526ac3365ffd1d768
Merge: 125d7fc6c c11876547
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 3 05:49:27 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 125d7fc6c4dcd8c8c5f27b8268a4d64f409f3644
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Aug 3 04:55:31 2020 +0200
Abstract over simd vs. repr_c vectors.
Also some minor improvements to Event size.
commit d4d4956e9252e1241ce110b2aa85076c6b1e2a23
Merge: 5f3b7294a aced5f979
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 2 20:56:54 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 5f3b7294af1f8533edc2620b58863c248e2b07af
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 2 20:43:52 2020 +0200
Fix formatting issues I missed before.
commit a428a3ebba70dcab63dd0f8cd983120c90617271
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Aug 2 20:41:51 2020 +0200
Fix clippy warnings, part 1.
There aer still a bunch of type too complex and
function takes too many arguments warnings that I'll fix later
(or ignore, since in the one case I did fix a function takes too
many arguments warning I think it made the code *less* readable).
commit ba54307540ed8a937ac08209730284fc653af85b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 30 13:22:42 2020 +0200
Fix light animations so they are removed when the light turns off.
commit 7e0f4bcbf0f4717145d8beac40d52e3acebbe2aa
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 29 21:10:20 2020 +0200
Fix crash in edge case for pixel art.
commit 56da06f7a351e2b949e9b014a90b974d511a0924
Merge: cf74d55f2 9f53a4a19
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 29 18:56:52 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit cf74d55f2e3d2ae7d25fd68d5c73b01a6afde86e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 29 18:29:52 2020 +0200
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.
commit ad18ce939940a8c697270f6e9b94db9942fd8295
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 28 13:21:09 2020 +0200
Fix continent scale hack.
commit 36b1cb074f5b195aebd7dbbc3da7f0246a1a18ec
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 28 12:11:40 2020 +0200
Enable loading different sized maps without a recompile.
We may want to tweak the effects of the continent_scale_hack.
commit 13b6d4d534cc4814b7cb3294ca41bbfea0a6b186
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 28 10:55:48 2020 +0200
Removing WORLD_SIZE, part 1.
Erased almost every instance of WORLD_SIZE and replaced it with a local
power of two, map_size_lg (which respects certain invariants; see
common/src/terrain/map.rs for more details about MapSizeLg). This also
means we can avoid a dependency on the world crate from client, as
desired.
Now that the rest of the code is not expecting a fixed WORLD_SIZE, the
next step is to arrange for maps to store their world size, and to use
that world size as a basis prior to loading the map (as well, probably,
as prior to configuring some of the noise functions).
commit 30b1d2c6428230a9eaa0d749cdcbbd6f1cbccd78
Merge: 7d56ba31b 1377b369f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Jul 27 13:16:58 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit 7d56ba31b445441461b28a07fc495d7d4f047c17
Merge: 2101113b4 598f14b25
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Jul 27 13:16:27 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 1377b369f6db2258e910d467a5740f31789e3ded
Author: Monty Marz <m.marzouq@gmx.de>
Date: Sun Jul 19 23:25:38 2020 +0200
more saturated pumpkins
commit ae8d50527f93bb0616c2ad46ce4dacb63bc37c6d
Author: Monty Marz <m.marzouq@gmx.de>
Date: Sat Jul 18 20:29:56 2020 +0200
acacia models
commit 2101113b467e691de787392d7f20f1745f5637bd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 18 18:55:25 2020 +0200
Higher detail LOD.
commit add2cfae04b4385fa5590e11e2bd5229d9dee0aa
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 16 01:57:39 2020 +0200
Revert some irrelevant stuff.
commit 2e2ab3dc1eaa59a4aef7f8d34a53d8aae4c8553a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 15 13:30:49 2020 +0200
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.
commit 6c31e6b56217274285b597af297036691ea5d897
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Jul 12 19:50:26 2020 +0200
Fix shadow creation.
commit 6332cbe006115ae205597529cd8bbccd146c2cca
Merge: be438657c 930e0028b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Jul 12 18:47:00 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit be438657c33d7b5bfb0a9582c3ed3fd366637323
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Jul 12 18:28:08 2020 +0200
Tweaks to shadows.
Added shadow map resolution configuration, added seamless cubemaps,
documented all existing rendering options, and fixed a few Clippy
errors.
commit 23b4058906013c7d2a40c286e20e32c5fbd897ed
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 10:11:19 2020 +0200
Fix moon, use nonlinear noise for terrain.
Note that the latter has a bit of performance cost.
commit 7fbe5cbfbb9dc29607957b8e62f432a4deed193d
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 02:23:02 2020 +0200
Address lies about max texture size.
commit bcfc62b5e13a1cdd83f57535fde4694720bebfd9
Merge: 75e3626a7 18a08e8fe
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 02:22:08 2020 +0200
Merge remote-tracking branch 'origin/sharp/small-fixes' into sharp/small-fixes
commit 75e3626a785919f43fdcf2127c2b10e3e4df2f9f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Jul 8 02:21:52 2020 +0200
OpenGL 3.3 minimum.
commit 18a08e8fe2739f02af99a5d2cb4e7c38c49e858b
Author: Monty Marz <m.marzouq@gmx.de>
Date: Tue Jul 7 23:57:52 2020 +0200
settings localization
commit 90c5d1ca3620092bc3ae10b2211489eb1cf6f5e8
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 21:11:48 2020 +0200
Lower near distance.
commit 0e66f02b25aaddaa2dfddbbc89cd67de54a9a7b4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 20:09:01 2020 +0200
All sprites sway in the wind now.
commit db1401a6910bf42dcf502462c90038752ff5fbdb
Merge: 69e508d8c e8b4b29d7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 19:34:17 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 69e508d8c94d8973033817ca86f357e466fc7c4d
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Jul 7 18:41:37 2020 +0200
Make it easy to switch to SIMD for math.
commit ffe0f5928c7a7e87d00cb5426b3b1d831d7e02fd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 21:21:12 2020 +0200
Fix some issues with underwater rendering.
commit bfda6da42f38fd02c31ee92c81ab785a3e50c2a0
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 19:17:59 2020 +0200
Fix some minor display issues.
commit 0ed752e087968cf901301884aaeae698e32ef8a5
Merge: ccc6a06a8 518edcb85
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 18:14:21 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit ccc6a06a8d4504d6b9f7af7905a414d2ee06ab76
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 18:04:34 2020 +0200
Some minor changes.
commit 4e020246702889269efe1a191788992164c508d6
Merge: 50a64d927 e05c9267a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 16:17:40 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 50a64d927e6c4f4b0e4688e4cbfca694bc3f922a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Jul 4 13:07:03 2020 +0200
Fix far plane.
commit 7dd06da34cae8f9ea3b6c889fe965181f3fd3949
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 2 22:25:35 2020 +0200
Add shadows.glsl.
commit 618a18c998778bf871b905a74657440fcc384c80
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Jul 2 22:10:22 2020 +0200
Adding shadows, greedy meshing, and more.
commit eaea83fe6a5cb1cb0ba8beef888183c718258496
Merge: 267018495 2f89b863e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu May 21 22:47:07 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 2670184954a13e4a9e7a4e35ba79aac0c5fac2f7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu May 21 21:20:01 2020 +0200
Make civsim and sites deterministic.
For anything in worldgen where you use a HashMap, *please* think
carefully about which hasher you are going to use! This is
especially true if (for some reason) you are depending on hashmap
iteration order remaining stable for some aspect of worldgen.
commit f8376fd5dc72b4a9c2f51a6b4570d59c8b8e9343
Merge: 654f7e049 cdee191dd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu May 21 17:53:57 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 654f7e049258d9da27c09608bbe6a46ffa8787e5
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed May 20 21:22:30 2020 +0200
Correct backface culling.
commit 560501df05ca725409b0f2e4eb31bdfdc15fd0c7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue May 19 17:22:06 2020 +0200
Greedy messhing for shadows.
commit a4d87e1875ca543436e6bbbeb20348facc5a52d7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun May 17 05:59:00 2020 +0200
Shadow maps work for lantern.
commit 243d0837b8a3b08172c9a3c348d964d7ddc2a0a8
Merge: 04382dc28 71dd520cd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 15 14:53:13 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 04382dc28632b6c66e8821f6870c0daaa1c1901a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 15 14:22:17 2020 +0200
WIP: better graphics config, better LOD, shadow maps.
commit 22ddbad3eb32bfa70f0932176022208fe67ded81
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat May 2 18:54:09 2020 +0200
Minor shader fixes.
commit 746a10e8d01ac235f994b0cde78fa48998602a1f
Merge: 0f4a0e763 40ab94673
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat May 2 04:02:09 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 0f4a0e763db3afbdc4fb0558611f38326ca87151
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 1 23:03:24 2020 +0200
Switch back to pop-in terrain.
commit dd74fa7e4a53667b38811d7aec58d7f6a68889bb
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri May 1 22:58:55 2020 +0200
LOD shading closer to voxel shading.
commit ef67bd58ba0bdaf622b078892d768263b6cba268
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Apr 28 20:49:03 2020 +0200
Experimental underwater lighting.
commit 2c5ad9d07605e80d5fd5679dd3a5d70c605b86a9
Merge: 748279835 303967a6f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 22:35:24 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 7482798354eda18c8207950080fc24d443a369de
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 21:59:55 2020 +0200
Replace discard in figure-frag.
commit d83b4ae69be4912f69bf7835f509c68a1c7770a4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 18:45:57 2020 +0200
Fix sprite lighting, HDR from focus_pos.
commit 0594238004f116274905fa0ed7c2b6c417ed1d29
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 18:14:10 2020 +0200
Proper HDR from point lights.
commit 48c93d2b41ce5743103d18e76cc228f5ac766492
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 14:01:43 2020 +0200
Brighter ambiance, darker LOD shadows.
commit e0452e895ccfa8a43f368cae3b8b8aedc24dad93
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 13:13:23 2020 +0200
More proper HDR.
commit 4c6da3ed16cfeebb455e40da5f557b4af9a499d7
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 27 00:13:10 2020 +0200
Trying LOD noise.
commit 682a3d74c85df5503ffe1fc1cc891bce789df1ad
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Apr 26 23:11:08 2020 +0200
Fix LOD heights in towns.
commit cc39e5734e8b18f9077bf42e66337c1319dd6b6e
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sun Apr 26 21:01:23 2020 +0200
More LOD fixes.
commit 8116b21c2e51c836e77894e309ac273caf2917b3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 23:54:43 2020 +0200
I like this coloring.
commit bc2560ea90b36f4b46190005344232d993043ac3
Merge: 14effdd5d e690efe71
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 23:48:33 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit 14effdd5db8747fcf3eb34f03b46b7792e92d1c5
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 22:24:35 2020 +0200
Re-saturate.
commit 48a643955d4435b78179acba0beb4a979905cc31
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 22:23:57 2020 +0200
Various fixes.
commit f7b497a0c25f4ad4682c71dd1ed6f608052feb9b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 03:22:49 2020 +0200
Render figures again.
commit 44e4aad48deba8266b9f8bdfd3db096b381f5327
Merge: e6f0a5a98 9ec319a18
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 25 02:01:04 2020 +0200
Merge remote-tracking branch 'origin/master' into sharp/small-fixes
commit e6f0a5a981a82533ba188fff0a54ce98577bb152
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 24 16:12:20 2020 +0200
Add atmospheric scattering.
commit f2953087f691a8edbc001cb98ebf5059fc6f8ac0
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 23 00:01:20 2020 +0200
Fix shadowing for specular reflections.
commit ddd4a67a9799b8d08c7dc0c2bec90621c2bed0e3
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Wed Apr 22 22:56:12 2020 +0200
HDR fixes.
commit 1015e60deef3c447381996277df7496707a63bd0
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Tue Apr 21 18:25:19 2020 +0200
More lighting changes.
commit 80c264abd111fb237e57843efcb5c071d4f84613
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Mon Apr 13 00:29:59 2020 +0200
Lighting experiments.
commit 8414987e589dd5102bad89762a3adaccc0bfe957
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 9 02:38:40 2020 +0200
WIP -- lighting changes and soft shadows.
commit 9cd2b3fb0d6b49776c6dfe463e4169637250b11a
Merge: c7ea687eb 8b149ad11
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 4 02:33:29 2020 +0200
Merge branch 'sharp/new-lighting' into sharp/small-fixes
commit c7ea687ebbc5aace1b455f134a5bf49ce2c7434a
Merge: 476441531 22f3319b4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 4 02:33:02 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/small-fixes
commit 8b149ad11ad4bb75018fcf9519baec27d1c95951
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Sat Apr 4 02:32:39 2020 +0200
Trying out a new lighting model.
commit b0ac9f36f755dd06f7c17c46150568064790864f
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 3 07:56:11 2020 +0200
Use bicubic interpolation for terrain.
commit f6fc9307a121514b614bc50ef8eb055953e7da8a
Merge: 33140a295 22f3319b4
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 3 05:01:41 2020 +0200
Merge remote-tracking branch 'origin/master' into zesterer/lod
commit 4764415312aae6e9ac2d00e86e84577cb958f1ab
Merge: ed2d0111d 13388ee6a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Apr 3 04:54:48 2020 +0200
Merge branch 'sharp/map-colors' into sharp/small-fixes
commit 13388ee6a42943f3f79a9cb488346cef18e272fe
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 20:30:08 2020 +0200
Various fixes (to coloring and to soft shadows).
commit fbd084a94a067082a87cd6d28b82054709bc9265
Merge: 5a089863b 4fdf6896a
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 18:50:38 2020 +0200
Merge branch 'master' of gitlab.com:veloren/veloren into sharp/map-colors
commit ed2d0111d994262ae836d84d1fe5a45e4de72a0b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 06:49:27 2020 +0200
Combining colors and LOD.
commit 88342640c6b835114d01c797b89fdede3b0a2108
Merge: 33140a295 5a089863b
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 04:49:20 2020 +0200
Merge branch 'sharp/map-colors' into sharp/small-fixes
commit 33140a2951b8212725f42c758b277aaec4d888f7
Merge: 4c65a5aed f34d4b379
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 04:36:21 2020 +0200
Merge remote-tracking branch 'origin/master' into zesterer/lod
commit 5a089863beb01d4794bbe3580ada47b278715ea2
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 03:17:49 2020 +0200
Making maps brighter.
This is probably not the right way to do it, but oh well!
commit 32b2c99109dd486aa922886081068f9c550c83f2
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Thu Apr 2 02:46:36 2020 +0200
Horizon mapping and "layered" map generation.
Horizon mapping is a method of shadow mapping specific to height maps.
It can handle any angle between 0 and 90 degrees from the ground, as
long as know the horizontal direction in advance, by remembering only a
single angle (the "horizon angle" of the shadow map). More is explained
in common/src/msg/server.rs. We also remember the approximate height of
the largest occluder, to try to be able to generate soft shadows and
create a vertical position where the shadows can't go higher.
Additionally, map generation has been reworked. Instead of computing
everything from explicit samples, we pass in sampling functions that
return exactly what the map generator needs. This allows us to cleanly
separate the way we sample things like altitudes and colors from the map
generation process. We exploit this to generate maps *partially* on the
server (with colors and rivers, but not shading). We can then send the
partially completed map to the client, which can combine it with shadow
information to generate the final map. This is useful for two reasons:
first, it makes sure the client can apply shadow information by itself,
and second, it lets us pass the unshaded map for use with level of
detail functionality.
For similar reasons, river generation is split
out into its own layer, but for now we opt to still generate rivers on
the server (since the river wire format is more complicated to compress
and may require some extra work to make sure we have enough precision to
draw rivers well enough for LoD).
Finally, the mostly ad-hoc lighting we were performing has been (mostly)
replaced with explicit Phong reflection shading (including specular
highlights). Regularizing this seems useful and helps clarify the
"meaning" of the various light intensities, and helps us keep a more
physically plausible basis. However, its interaction with soft shadows
is still imperfect, and it's not yet clear to me what we need to do to
turn this into something useful for LoD.
commit f8926a5737ddc51f3d585c651a64c43677aae0f4
Merge: a1aee931e 875ae6ced
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Mar 13 13:32:42 2020 +0100
Merge remote-tracking branch 'origin/master' into sharp/map-colors
commit 4c65a5aed353b119aea65a2aaeb94549b67beb42
Author: Treeco <5021038-Treeco@users.noreply.gitlab.com>
Date: Mon Feb 24 16:48:05 2020 +0000
Made LOD setting slider exponential
commit 2fa7b2d20d7233dc8bfd64f9f7f54617575248f1
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 17:49:53 2020 +0000
Added mist to LoD
commit aab059a450b5f635777129ff82cc15b662965c3c
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 15:14:06 2020 +0000
Added LoD slider
commit 779c36b538121c5ade3633ae5cb67bb14c8c3877
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 12:54:55 2020 +0000
Reduced cost of vertex pushing
commit 9fea150473906b166365b738ebcea07c697daf3d
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 12:38:53 2020 +0000
Fixed maths, improved LoD resolution
commit 5481df38fea5bf183ff376a3337179cfaa5233dc
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Feb 24 11:22:50 2020 +0000
Dynamically relocate LoD vertices to enhance details
commit a3e36a50ababd615da7db1b26158c7906a5def01
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 18:13:51 2020 +0000
Simpler terrain spiral rendering
commit 255f450ae9ac8763db4bede075fb409161ed57cc
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 16:53:17 2020 +0000
Better LoD precision
commit 3d027aebe812a5b8658a4eb8123dc9f61b3776d2
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 16:04:03 2020 +0000
Better falloff
commit be775c9484b457b2c0b1a494aec03392d0c70e76
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Feb 23 15:30:45 2020 +0000
Applied good ideas from experimental branch
commit 58587b68545a23c5c04ab4574a4b94b3bc982246
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 16:15:13 2020 +0000
Minor fixes to LoD merging
commit 7b42aebd709c14df2db766aad61d9280ad24d84d
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 15:04:44 2020 +0000
Capped LoD dragging
commit 8aafc559f87124e1ea5ca6e3ddc2aa0c242d793c
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 14:54:37 2020 +0000
Better blending between LoD and terrain border
commit edd3455d5161792d87ddc8eadc0ecbad5532b284
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 14:40:19 2020 +0000
Fixed LoD z depth, added sea level offset
commit b9b06744620114dd5556e73f64fa93c145503a7c
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 14:27:43 2020 +0000
Better LoD smoothing
commit a1aee931e790431560cd2d953ad61d9497072afd
Author: Joshua Yanovski <pythonesque@gmail.com>
Date: Fri Feb 21 14:52:17 2020 +0100
Adding shadows.
commit 2400786c13dd891c131ed86d48d05df516a8a778
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Feb 21 13:48:40 2020 +0000
Use world map as LoD source
commit dbf650f504a4c25fbbc2096ac3616c736bf52d23
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Mon Jan 20 00:48:14 2020 +0000
Better clouds at distance
commit 5e6f81b86cdb9730b9b056877b19257075fd5fa8
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Sun Jan 19 23:59:02 2020 +0000
sync
commit 745e7540ddb000cc645f612767b337c2ddc3f7c0
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Nov 22 12:40:48 2019 +0000
Improved cloud falloff mist, faster noise sampling
commit f6a200d0cb866196ba57697466755f9e0c7ea5d8
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Fri Nov 22 10:09:00 2019 +0000
Improved long-range depth precision, removed unnecessary LoD polygons
commit 63d1b2bb2292898d59fb4f4e502201103dfeb86f
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Thu Nov 21 20:57:46 2019 +0000
Working LoD shader
commit f13d98ee3e58f881e8b978861a67663b59ed91ec
Author: Joshua Barretto <joshua.s.barretto@gmail.com>
Date: Thu Nov 21 11:03:40 2019 +0000
LoD first attempt (stack overflow issue)
2020-08-20 18:34:59 +00:00
|
|
|
// in uint v_col;
|
2020-11-29 21:38:03 +00:00
|
|
|
layout(location = 1) in uint v_norm_ao;
|
|
|
|
layout(location = 2) in float inst_time;
|
|
|
|
layout(location = 3) in float inst_lifespan;
|
|
|
|
layout(location = 4) in float inst_entropy;
|
|
|
|
layout(location = 5) in int inst_mode;
|
|
|
|
layout(location = 6) in vec3 inst_dir;
|
|
|
|
layout(location = 7) in vec3 inst_pos;
|
|
|
|
|
|
|
|
layout(location = 0) out vec3 f_pos;
|
|
|
|
layout(location = 1) flat out vec3 f_norm;
|
|
|
|
layout(location = 2) out vec4 f_col;
|
|
|
|
//layout(location = x) out float f_ao;
|
|
|
|
//layout(location = x) out float f_light;
|
|
|
|
layout(location = 3) out float f_reflect;
|
2020-06-30 14:29:35 +00:00
|
|
|
|
|
|
|
const float SCALE = 1.0 / 11.0;
|
|
|
|
|
2020-07-15 15:45:47 +00:00
|
|
|
// Modes
|
|
|
|
const int SMOKE = 0;
|
|
|
|
const int FIRE = 1;
|
2020-07-19 07:16:06 +00:00
|
|
|
const int GUN_POWDER_SPARK = 2;
|
2020-08-03 11:56:12 +00:00
|
|
|
const int SHRAPNEL = 3;
|
2020-08-11 14:05:34 +00:00
|
|
|
const int FIREWORK_BLUE = 4;
|
|
|
|
const int FIREWORK_GREEN = 5;
|
|
|
|
const int FIREWORK_PURPLE = 6;
|
|
|
|
const int FIREWORK_RED = 7;
|
2021-03-06 12:31:18 +00:00
|
|
|
const int FIREWORK_WHITE = 8;
|
|
|
|
const int FIREWORK_YELLOW = 9;
|
|
|
|
const int LEAF = 10;
|
|
|
|
const int FIREFLY = 11;
|
|
|
|
const int BEE = 12;
|
|
|
|
const int GROUND_SHOCKWAVE = 13;
|
2021-07-14 01:54:43 +00:00
|
|
|
const int ENERGY_HEALING = 14;
|
2021-03-06 12:31:18 +00:00
|
|
|
const int ENERGY_NATURE = 15;
|
|
|
|
const int FLAMETHROWER = 16;
|
|
|
|
const int FIRE_SHOCKWAVE = 17;
|
|
|
|
const int FIRE_BOWL = 18;
|
|
|
|
const int SNOW = 19;
|
|
|
|
const int EXPLOSION = 20;
|
|
|
|
const int ICE = 21;
|
2021-03-03 04:56:09 +00:00
|
|
|
const int LIFESTEAL_BEAM = 22;
|
2021-03-20 17:29:57 +00:00
|
|
|
const int CULTIST_FLAME = 23;
|
2021-03-28 23:29:48 +00:00
|
|
|
const int STATIC_SMOKE = 24;
|
2021-03-29 00:06:30 +00:00
|
|
|
const int BLOOD = 25;
|
2021-04-28 04:23:28 +00:00
|
|
|
const int ENRAGED = 26;
|
|
|
|
const int BIG_SHRAPNEL = 27;
|
2021-05-04 23:02:18 +00:00
|
|
|
const int LASER = 28;
|
2021-05-24 00:45:22 +00:00
|
|
|
const int BUBBLES = 29;
|
2021-05-29 22:27:55 +00:00
|
|
|
const int WATER = 30;
|
2021-06-04 23:11:56 +00:00
|
|
|
const int ICE_SPIKES = 31;
|
2021-06-05 22:24:31 +00:00
|
|
|
const int DRIP = 32;
|
2021-05-26 00:37:31 +00:00
|
|
|
const int TORNADO = 33;
|
2021-06-27 21:45:07 +00:00
|
|
|
const int DEATH = 34;
|
2022-02-09 18:16:00 +00:00
|
|
|
const int ENERGY_BUFFING = 35;
|
2022-04-23 14:54:01 +00:00
|
|
|
const int WEB_STRAND = 36;
|
2022-04-30 22:17:01 +00:00
|
|
|
const int BLACK_SMOKE = 37;
|
2022-07-09 00:59:18 +00:00
|
|
|
const int LIGHTNING = 38;
|
2022-09-22 01:04:01 +00:00
|
|
|
const int STEAM = 39;
|
|
|
|
const int BARRELORGAN = 40;
|
2023-01-19 00:11:55 +00:00
|
|
|
const int POTION_SICKNESS = 41;
|
2023-02-15 00:10:37 +00:00
|
|
|
const int GIGA_SNOW = 42;
|
2023-04-12 22:53:38 +00:00
|
|
|
const int CYCLOPS_CHARGE = 43;
|
2023-05-19 12:24:45 +00:00
|
|
|
const int PORTAL_FIZZ = 45;
|
2023-08-02 07:55:10 +00:00
|
|
|
const int INK = 46;
|
2023-10-08 11:35:01 +00:00
|
|
|
const int WHIRLWIND = 47;
|
2023-11-28 11:13:18 +00:00
|
|
|
const int FIERY_BURST = 48;
|
|
|
|
const int FIERY_BURST_VORTEX = 49;
|
|
|
|
const int FIERY_BURST_SPARKS = 50;
|
|
|
|
const int FIERY_BURST_ASH = 51;
|
|
|
|
const int FIERY_TORNADO = 52;
|
|
|
|
const int PHOENIX_CLOUD = 53;
|
|
|
|
const int FIERY_DROPLET_TRACE = 54;
|
|
|
|
const int ENERGY_PHOENIX = 55;
|
|
|
|
const int PHOENIX_BEAM = 56;
|
|
|
|
const int PHOENIX_BUILD_UP_AIM = 57;
|
2024-01-20 17:45:23 +00:00
|
|
|
const int CLAY_SHRAPNEL = 58;
|
2020-08-11 14:05:34 +00:00
|
|
|
|
2020-08-04 10:59:38 +00:00
|
|
|
// meters per second squared (acceleration)
|
2020-07-19 07:16:06 +00:00
|
|
|
const float earth_gravity = 9.807;
|
|
|
|
|
2020-07-31 09:32:13 +00:00
|
|
|
struct Attr {
|
2020-10-21 21:05:25 +00:00
|
|
|
vec3 offs;
|
|
|
|
vec3 scale;
|
|
|
|
vec4 col;
|
|
|
|
mat4 rot;
|
2020-07-31 09:32:13 +00:00
|
|
|
};
|
|
|
|
|
2023-09-28 11:18:03 +00:00
|
|
|
float lifetime = time_since(inst_time);
|
2023-09-27 23:03:42 +00:00
|
|
|
|
2023-09-28 15:21:52 +00:00
|
|
|
// Retrieves inst_time, repeating over a period. This will be consistent
|
|
|
|
// over a time overflow.
|
2023-10-11 18:46:44 +00:00
|
|
|
float loop_inst_time(float period, float scale) {
|
2023-09-28 11:18:03 +00:00
|
|
|
if (tick.x < inst_time) {
|
2023-10-11 18:46:44 +00:00
|
|
|
return mod(mod(tick_overflow * scale, period) + inst_time * scale, period);
|
2023-09-28 11:18:03 +00:00
|
|
|
} else {
|
2023-10-11 18:46:44 +00:00
|
|
|
return mod(inst_time * scale, period);
|
2023-09-28 11:18:03 +00:00
|
|
|
}
|
2023-09-27 23:03:42 +00:00
|
|
|
}
|
2020-07-31 09:32:13 +00:00
|
|
|
|
|
|
|
vec3 linear_motion(vec3 init_offs, vec3 vel) {
|
2020-10-21 21:05:25 +00:00
|
|
|
return init_offs + vel * lifetime;
|
2020-07-31 09:32:13 +00:00
|
|
|
}
|
|
|
|
|
2023-01-19 00:11:55 +00:00
|
|
|
vec3 quadratic_bezier_motion(vec3 start, vec3 ctrl0, vec3 end) {
|
|
|
|
float t = lifetime;
|
|
|
|
float u = 1 - lifetime;
|
|
|
|
return u*u*start + t*u*ctrl0 + t*t*end;
|
|
|
|
}
|
|
|
|
|
2020-07-31 09:32:13 +00:00
|
|
|
vec3 grav_vel(float grav) {
|
2020-10-21 21:05:25 +00:00
|
|
|
return vec3(0, 0, -grav * lifetime);
|
2020-07-31 09:32:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
float exp_scale(float factor) {
|
2020-10-21 21:05:25 +00:00
|
|
|
return 1 / (1 - lifetime * factor);
|
2020-07-31 09:32:13 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 18:10:18 +00:00
|
|
|
float linear_scale(float factor) {
|
2020-10-21 21:05:25 +00:00
|
|
|
return lifetime * factor;
|
2020-08-12 18:10:18 +00:00
|
|
|
}
|
|
|
|
|
2021-01-08 22:09:47 +00:00
|
|
|
float percent() {
|
|
|
|
return lifetime / inst_lifespan;
|
|
|
|
}
|
|
|
|
|
|
|
|
float slow_end(float factor) {
|
|
|
|
return (1 + factor) * percent() / (percent() + factor);
|
|
|
|
}
|
|
|
|
|
|
|
|
float slow_start(float factor) {
|
|
|
|
return 1-(1 + factor) * (1-percent()) / ((1-percent()) + factor);
|
|
|
|
}
|
|
|
|
|
2020-08-19 20:59:17 +00:00
|
|
|
float start_end(float from, float to) {
|
2020-10-21 21:05:25 +00:00
|
|
|
return mix(from, to, lifetime / inst_lifespan);
|
2020-08-19 20:59:17 +00:00
|
|
|
}
|
|
|
|
|
2020-08-21 08:53:09 +00:00
|
|
|
mat4 spin_in_axis(vec3 axis, float angle)
|
2020-08-18 23:04:04 +00:00
|
|
|
{
|
2020-10-21 21:05:25 +00:00
|
|
|
axis = normalize(axis);
|
|
|
|
float s = sin(angle);
|
|
|
|
float c = cos(angle);
|
|
|
|
float oc = 1.0 - c;
|
|
|
|
|
|
|
|
return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0,
|
|
|
|
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0,
|
|
|
|
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0,
|
|
|
|
0, 0, 0, 1);
|
2020-08-18 23:04:04 +00:00
|
|
|
}
|
|
|
|
|
2020-09-01 12:13:33 +00:00
|
|
|
mat4 identity() {
|
2020-10-21 21:05:25 +00:00
|
|
|
return mat4(
|
|
|
|
1, 0, 0, 0,
|
|
|
|
0, 1, 0, 0,
|
|
|
|
0, 0, 1, 0,
|
|
|
|
0, 0, 0, 1
|
|
|
|
);
|
2020-09-01 12:13:33 +00:00
|
|
|
}
|
|
|
|
|
2020-08-29 20:44:46 +00:00
|
|
|
vec3 perp_axis1(vec3 axis) {
|
2020-10-21 21:05:25 +00:00
|
|
|
return normalize(vec3(axis.y + axis.z, -axis.x + axis.z, -axis.x - axis.y));
|
2020-08-29 20:44:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
vec3 perp_axis2(vec3 axis1, vec3 axis2) {
|
2020-10-21 21:05:25 +00:00
|
|
|
return normalize(vec3(axis1.y * axis2.z - axis1.z * axis2.y, axis1.z * axis2.x - axis1.x * axis2.z, axis1.x * axis2.y - axis1.y * axis2.x));
|
2020-08-29 20:44:46 +00:00
|
|
|
}
|
|
|
|
|
2021-06-01 00:40:25 +00:00
|
|
|
// Line is the axis of the spiral, it goes from the start position to the end position
|
|
|
|
// Radius is the distance from the axis the particle is
|
|
|
|
// Time function is some value that ideally goes from 0 to 1. When it is 0, it is as
|
|
|
|
// the point (0, 0, 0), when it is 1, it is at the point provided by the coordinates of line
|
|
|
|
// Frequency increases the frequency of rotation
|
|
|
|
// Offset is an offset to the angle of the rotation
|
2021-02-13 06:05:14 +00:00
|
|
|
vec3 spiral_motion(vec3 line, float radius, float time_function, float frequency, float offset) {
|
2020-10-21 21:05:25 +00:00
|
|
|
vec3 axis2 = perp_axis1(line);
|
|
|
|
vec3 axis3 = perp_axis2(line, axis2);
|
2020-08-29 20:44:46 +00:00
|
|
|
|
2021-02-13 06:05:14 +00:00
|
|
|
return line * time_function + vec3(
|
|
|
|
radius * cos(frequency * time_function - offset) * axis2.x + radius * sin(frequency * time_function - offset) * axis3.x,
|
|
|
|
radius * cos(frequency * time_function - offset) * axis2.y + radius * sin(frequency * time_function - offset) * axis3.y,
|
|
|
|
radius * cos(frequency * time_function - offset) * axis2.z + radius * sin(frequency * time_function - offset) * axis3.z);
|
2020-08-29 20:44:46 +00:00
|
|
|
}
|
|
|
|
|
2020-06-30 14:29:35 +00:00
|
|
|
void main() {
|
2020-10-21 21:05:25 +00:00
|
|
|
float rand0 = hash(vec4(inst_entropy + 0));
|
|
|
|
float rand1 = hash(vec4(inst_entropy + 1));
|
|
|
|
float rand2 = hash(vec4(inst_entropy + 2));
|
|
|
|
float rand3 = hash(vec4(inst_entropy + 3));
|
|
|
|
float rand4 = hash(vec4(inst_entropy + 4));
|
|
|
|
float rand5 = hash(vec4(inst_entropy + 5));
|
|
|
|
float rand6 = hash(vec4(inst_entropy + 6));
|
|
|
|
float rand7 = hash(vec4(inst_entropy + 7));
|
|
|
|
float rand8 = hash(vec4(inst_entropy + 8));
|
|
|
|
float rand9 = hash(vec4(inst_entropy + 9));
|
|
|
|
|
2021-01-31 15:15:17 +00:00
|
|
|
vec3 start_pos = inst_pos - focus_off.xyz;
|
|
|
|
|
2020-10-21 21:05:25 +00:00
|
|
|
Attr attr;
|
2020-11-18 13:22:05 +00:00
|
|
|
f_reflect = 1.0;
|
2020-10-21 21:05:25 +00:00
|
|
|
|
2021-05-11 00:58:32 +00:00
|
|
|
switch(inst_mode) {
|
|
|
|
case SMOKE:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
vec3(rand2 * 0.02, rand3 * 0.02, 1.0 + rand4 * 0.1)
|
|
|
|
),
|
|
|
|
vec3(linear_scale(0.5)),
|
2022-05-01 22:04:09 +00:00
|
|
|
vec4(vec3(0.8, 0.8, 1) * 0.125 * (3.8 + rand0), start_end(1.0, 0.0)),
|
2021-05-11 00:58:32 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 0.5)
|
|
|
|
);
|
|
|
|
break;
|
2022-04-30 22:17:01 +00:00
|
|
|
case BLACK_SMOKE:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
2022-05-01 22:04:09 +00:00
|
|
|
vec3(rand2 * 0.02, rand3 * 0.02, 1.0 + rand4 * 0.1)
|
2022-04-30 22:17:01 +00:00
|
|
|
),
|
|
|
|
vec3(linear_scale(0.5)),
|
2022-05-01 22:04:09 +00:00
|
|
|
vec4(vec3(0.8, 0.8, 1) * 0.125 * (1.8 + rand0), start_end(1.0, 0.0)),
|
2022-04-30 22:17:01 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 0.5)
|
|
|
|
);
|
|
|
|
break;
|
2021-05-24 00:45:22 +00:00
|
|
|
case FIRE:
|
2021-05-11 00:58:32 +00:00
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0.0),
|
|
|
|
vec3(rand2 * 0.1, rand3 * 0.1, 2.0 + rand4 * 1.0)
|
|
|
|
),
|
|
|
|
vec3(1.0),
|
2022-02-06 19:16:08 +00:00
|
|
|
vec4(6, 3 + rand5 * 0.3 - 0.8 * percent(), 0.4, 1),
|
2021-05-11 00:58:32 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIRE_BOWL:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(normalize(vec2(rand0, rand1)) * 0.1, 0.6),
|
|
|
|
vec3(rand2 * 0.2, rand3 * 0.5, 0.8 + rand4 * 0.5)
|
|
|
|
),
|
|
|
|
vec3(0.2), // Size
|
|
|
|
vec4(2, 1.5 + rand5 * 0.5, 0, start_end(1.0, 0.0)), // Colour
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case GUN_POWDER_SPARK:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
normalize(vec3(rand0, rand1, rand3)) * 0.3,
|
|
|
|
normalize(vec3(rand4, rand5, rand6)) * 4.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(1.0),
|
|
|
|
vec4(3.5, 3 + rand7, 0, 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case SHRAPNEL:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand4, rand5, rand6)) * 20.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(1),
|
|
|
|
vec4(vec3(0.25), 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case BIG_SHRAPNEL:
|
|
|
|
float brown_color = 0.05 + 0.1 * rand1;
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand4, rand5, rand6)) * 15.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(5 * (1 - percent())),
|
|
|
|
vec4(vec3(brown_color, brown_color / 2, 0), 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIREWORK_BLUE:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand1, rand2, rand3)) * 40.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(3.0 + rand0),
|
|
|
|
vec4(vec3(0, 0, 2), 1),
|
|
|
|
identity()
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIREWORK_GREEN:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand1, rand2, rand3)) * 40.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(3.0 + rand0),
|
|
|
|
vec4(vec3(0, 2, 0), 1),
|
|
|
|
identity()
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIREWORK_PURPLE:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand1, rand2, rand3)) * 40.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(3.0 + rand0),
|
|
|
|
vec4(vec3(2, 0, 2), 1),
|
|
|
|
identity()
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIREWORK_RED:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand1, rand2, rand3)) * 40.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(3.0 + rand0),
|
|
|
|
vec4(vec3(2, 0, 0), 1),
|
|
|
|
identity()
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIREWORK_WHITE:
|
2021-03-06 12:31:18 +00:00
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand1, rand2, rand3)) * 40.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(3.0 + rand0),
|
|
|
|
vec4(vec3(2, 2, 2), 1),
|
|
|
|
identity()
|
|
|
|
);
|
2021-05-11 00:58:32 +00:00
|
|
|
break;
|
|
|
|
case FIREWORK_YELLOW:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand1, rand2, rand3)) * 40.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(3.0 + rand0),
|
|
|
|
vec4(vec3(2, 2, 0), 1),
|
|
|
|
identity()
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case LEAF:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
vec3(0, 0, -2)
|
|
|
|
) + vec3(sin(lifetime), sin(lifetime + 0.7), sin(lifetime * 0.5)) * 2.0,
|
|
|
|
vec3(4),
|
|
|
|
vec4(vec3(0.2 + rand7 * 0.2, 0.2 + (0.25 + rand6 * 0.5) * 0.3, 0) * (0.75 + rand1 * 0.5), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case SNOW:
|
|
|
|
float height = mix(-4, 60, pow(start_end(1, 0), 3));
|
|
|
|
float wind_speed = (inst_pos.z - 2000) * 0.025;
|
|
|
|
vec3 offset = linear_motion(vec3(0), vec3(1, 1, 0) * wind_speed);
|
|
|
|
float end_alt = alt_at(start_pos.xy + offset.xy);
|
|
|
|
attr = Attr(
|
|
|
|
offset + vec3(0, 0, end_alt - start_pos.z + height) + vec3(sin(lifetime), sin(lifetime + 0.7), sin(lifetime * 0.5)) * 3,
|
|
|
|
vec3(mix(4, 0, pow(start_end(1, 0), 4))),
|
|
|
|
vec4(1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIREFLY:
|
|
|
|
float raise = pow(sin(3.1416 * lifetime / inst_lifespan), 0.2);
|
|
|
|
attr = Attr(
|
|
|
|
vec3(0, 0, raise * 5.0) + vec3(
|
|
|
|
sin(lifetime * 1.0 + rand0) + sin(lifetime * 7.0 + rand3) * 0.3,
|
|
|
|
sin(lifetime * 3.0 + rand1) + sin(lifetime * 8.0 + rand4) * 0.3,
|
|
|
|
sin(lifetime * 2.0 + rand2) + sin(lifetime * 9.0 + rand5) * 0.3
|
|
|
|
),
|
|
|
|
vec3(raise),
|
2021-07-24 05:40:17 +00:00
|
|
|
vec4(vec3(10.3, 9, 1.5), 1),
|
2021-05-11 00:58:32 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case BEE:
|
|
|
|
float lower = pow(sin(3.1416 * lifetime / inst_lifespan), 0.2);
|
|
|
|
attr = Attr(
|
|
|
|
vec3(0, 0, lower * -0.5) + vec3(
|
|
|
|
sin(lifetime * 2.0 + rand0) + sin(lifetime * 9.0 + rand3) * 0.3,
|
|
|
|
sin(lifetime * 3.0 + rand1) + sin(lifetime * 10.0 + rand4) * 0.3,
|
|
|
|
sin(lifetime * 4.0 + rand2) + sin(lifetime * 11.0 + rand5) * 0.3
|
|
|
|
) * 0.5,
|
|
|
|
vec3(lower),
|
|
|
|
vec4(vec3(1, 0.7, 0), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case GROUND_SHOCKWAVE:
|
|
|
|
attr = Attr(
|
|
|
|
vec3(0.0),
|
|
|
|
vec3(11.0, 11.0, (33.0 * rand0 * sin(2.0 * lifetime * 3.14 * 2.0))) / 3,
|
|
|
|
vec4(vec3(0.32 + (rand0 * 0.04), 0.22 + (rand1 * 0.03), 0.05 + (rand2 * 0.01)), 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
2021-07-14 01:54:43 +00:00
|
|
|
case ENERGY_HEALING:
|
2021-05-11 00:58:32 +00:00
|
|
|
f_reflect = 0.0;
|
2021-07-14 01:54:43 +00:00
|
|
|
float spiral_radius = start_end(1 - pow(abs(rand5), 5), 1) * length(inst_dir);
|
2021-05-11 00:58:32 +00:00
|
|
|
attr = Attr(
|
2021-07-14 01:54:43 +00:00
|
|
|
spiral_motion(vec3(0, 0, rand3 + 1), spiral_radius, lifetime, abs(rand0), rand1 * 2 * PI) + vec3(0, 0, rand2),
|
|
|
|
vec3(6 * abs(rand4) * (1 - slow_start(2)) * pow(spiral_radius / length(inst_dir), 0.5)),
|
2021-07-24 05:40:17 +00:00
|
|
|
vec4(vec3(0, 1.7, 0.7) * 3, 1),
|
2021-07-14 01:54:43 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
2021-05-11 00:58:32 +00:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
case LIFESTEAL_BEAM:
|
|
|
|
f_reflect = 0.0;
|
2023-09-27 23:03:42 +00:00
|
|
|
float green_col = 0.8 + 0.8 * sin(tick_loop(2 * PI, 5, lifetime * 5));
|
2023-10-11 18:46:44 +00:00
|
|
|
float purple_col = 0.6 + 0.5 * sin(loop_inst_time(2 * PI, 4)) - min(max(green_col - 1, 0), 0.3);
|
|
|
|
float red_col = 1.15 + 0.1 * sin(loop_inst_time(2 * PI, 3)) - min(max(green_col - 1, 0), 0.3) - max(purple_col - 0.5, 0);
|
2021-05-11 00:58:32 +00:00
|
|
|
attr = Attr(
|
2023-10-11 18:46:44 +00:00
|
|
|
spiral_motion(inst_dir, 0.3 * (floor(2 * rand0 + 0.5) - 0.5) * min(linear_scale(10), 1), lifetime / inst_lifespan, 10.0, loop_inst_time(2.0 * PI, 1.0)),
|
|
|
|
vec3((1.7 - 0.7 * abs(floor(2 * rand0 - 0.5) + 0.5)) * (1.5 + 0.5 * sin(tick_loop(2 * PI, 10, -lifetime * 4)))),
|
2022-02-14 22:16:33 +00:00
|
|
|
vec4(vec3(red_col + purple_col * 0.6, green_col + purple_col * 0.35, purple_col), 1),
|
2023-09-27 23:03:42 +00:00
|
|
|
spin_in_axis(inst_dir, tick_loop(2 * PI))
|
2021-05-11 00:58:32 +00:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
case ENERGY_NATURE:
|
|
|
|
f_reflect = 0.0;
|
2021-07-14 01:54:43 +00:00
|
|
|
spiral_radius = start_end(1 - pow(abs(rand5), 5), 1) * length(inst_dir);
|
2021-05-11 00:58:32 +00:00
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(vec3(0, 0, rand3 + 1), spiral_radius, lifetime, abs(rand0), rand1 * 2 * PI) + vec3(0, 0, rand2),
|
|
|
|
vec3(6 * abs(rand4) * (1 - slow_start(2)) * pow(spiral_radius / length(inst_dir), 0.5)),
|
|
|
|
vec4(vec3(0, 1.7, 1.3), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FLAMETHROWER:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3((2.5 * (1 - slow_start(0.2)))),
|
2022-02-06 19:16:08 +00:00
|
|
|
vec4(6, 3 + rand5 * 0.6 - 0.8 * percent(), 0.4, 1),
|
2021-05-11 00:58:32 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case EXPLOSION:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
2022-02-06 19:16:08 +00:00
|
|
|
inst_dir * ((rand0+1.0)/2 + 0.4) * slow_end(0.25) + 0.3 * grav_vel(earth_gravity),
|
2021-05-11 00:58:32 +00:00
|
|
|
vec3((3 * (1 - slow_start(0.1)))),
|
2022-02-06 19:16:08 +00:00
|
|
|
vec4(6, 3 + rand5 * 0.3 - 0.8 * percent(), 0.4, 1),
|
2021-05-11 00:58:32 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case ICE:
|
|
|
|
f_reflect = 0.0; // Ice doesn't reflect to look like magic
|
2021-06-01 00:40:25 +00:00
|
|
|
float ice_color = 1.9 + rand5 * 0.3;
|
2021-05-11 00:58:32 +00:00
|
|
|
attr = Attr(
|
|
|
|
inst_dir * ((rand0+1.0)/2 + 0.4) * slow_end(2.0) + 0.3 * grav_vel(earth_gravity),
|
2021-06-01 00:40:25 +00:00
|
|
|
vec3((5 * (1 - slow_start(.1)))),
|
|
|
|
vec4(0.8 * ice_color, 0.9 * ice_color, ice_color, 1),
|
2021-05-11 00:58:32 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIRE_SHOCKWAVE:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
attr = Attr(
|
|
|
|
vec3(rand0, rand1, lifetime * 10 + rand2),
|
|
|
|
vec3((5 * (1 - slow_start(0.5)))),
|
2022-02-06 19:16:08 +00:00
|
|
|
vec4(6, 3 + rand5 * 0.6 - 0.8 * percent(), 0.4, 1),
|
2021-05-11 00:58:32 +00:00
|
|
|
spin_in_axis(vec3(rand3, rand4, rand5), rand6)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case CULTIST_FLAME:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
float purp_color = 0.9 + 0.3 * rand3;
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3((3.5 * (1 - slow_start(0.2)))),
|
|
|
|
vec4(purp_color, 0.0, purp_color, 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case STATIC_SMOKE:
|
|
|
|
attr = Attr(
|
2021-03-29 00:06:30 +00:00
|
|
|
vec3(0),
|
2021-05-11 00:58:32 +00:00
|
|
|
vec3((0.5 * (1 - slow_start(0.8)))),
|
|
|
|
vec4(1.0),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case BLOOD:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand4, rand5, rand6)) * 5.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3((2.0 * (1 - slow_start(0.8)))),
|
|
|
|
vec4(1, 0, 0, 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case ENRAGED:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
float red_color = 1.2 + 0.3 * rand3;
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3((3.5 * (1 - slow_start(0.2)))),
|
|
|
|
vec4(red_color, 0.0, 0.0, 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case LASER:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
vec3 perp_axis = normalize(cross(inst_dir, vec3(0.0, 0.0, 1.0)));
|
|
|
|
offset = vec3(0.0);
|
|
|
|
if (rand0 > 0.0) {
|
|
|
|
offset = perp_axis * 0.5;
|
|
|
|
} else {
|
|
|
|
offset = perp_axis * -0.5;
|
|
|
|
}
|
|
|
|
attr = Attr(
|
|
|
|
inst_dir * percent() + offset,
|
|
|
|
vec3(1.0, 1.0, 50.0),
|
|
|
|
vec4(vec3(2.0, 0.0, 0.0), 1),
|
|
|
|
spin_in_axis(perp_axis, asin(inst_dir.z / length(inst_dir)) + PI / 2.0)
|
|
|
|
);
|
|
|
|
break;
|
2021-05-24 00:45:22 +00:00
|
|
|
case BUBBLES:
|
|
|
|
f_reflect = 0.0; // Magic water doesn't reflect light, it emits it
|
|
|
|
float blue_color = 1.5 + 0.2 * rand3 + 1.5 * max(floor(rand4 + 0.3), 0.0);
|
|
|
|
float size = 8.0 * (1 - slow_start(0.1)) * slow_end(0.15);
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3(size),
|
|
|
|
vec4(0.5 * blue_color, 0.75 * blue_color, blue_color, 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2021-05-29 22:27:55 +00:00
|
|
|
case WATER:
|
|
|
|
f_reflect = 0.0; // Magic water doesn't reflect light, it emits it
|
|
|
|
blue_color = 1.25 + 0.2 * rand3 + 1.75 * max(floor(rand4 + 0.15), 0.0);
|
|
|
|
size = 8.0 * (1 - slow_start(0.1)) * slow_end(0.15);
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(0.2)) + vec3(rand0, rand1, rand2) * 0.5,
|
|
|
|
vec3(size),
|
|
|
|
vec4(0.5 * blue_color, 0.9 * blue_color, blue_color, 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 5 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2021-06-04 23:11:56 +00:00
|
|
|
case ICE_SPIKES:
|
|
|
|
f_reflect = 0.0; // Ice doesn't reflect to look like magic
|
|
|
|
ice_color = 1.7 + rand5 * 0.2;
|
|
|
|
attr = Attr(
|
|
|
|
vec3(0.0),
|
|
|
|
vec3(11.0, 11.0, 11.0 * length(inst_dir) * 2.0 * (0.5 - abs(0.5 - slow_end(0.5)))) / 3,
|
|
|
|
vec4(0.8 * ice_color, 0.9 * ice_color, ice_color, 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
2021-06-05 22:24:31 +00:00
|
|
|
case DRIP:
|
2021-06-02 04:26:19 +00:00
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand4, rand5, rand6)) + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3((2.0 * (1 - slow_start(0.2)))),
|
|
|
|
vec4(1, 1, 0, 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
2021-05-26 00:37:31 +00:00
|
|
|
case TORNADO:
|
2021-06-11 01:15:58 +00:00
|
|
|
f_reflect = 0.0;
|
2021-05-26 00:37:31 +00:00
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(vec3(0, 0, 5), abs(rand0) + abs(rand1) * percent() * 3.0, percent(), 15.0 * abs(rand2), rand3),
|
|
|
|
vec3((2.5 * (1 - slow_start(0.05)))),
|
2021-06-11 01:15:58 +00:00
|
|
|
vec4(vec3(1.2 + 0.5 * percent()), 1),
|
2021-05-26 00:37:31 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2021-06-27 21:45:07 +00:00
|
|
|
case DEATH:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
vec3(rand2 * 0.02, rand3 * 0.02, 2.0 + rand4 * 0.6)
|
|
|
|
),
|
|
|
|
vec3((1.2 * (1 - slow_start(.1)))),
|
|
|
|
vec4(vec3(1.2 + 0.5 * percent()), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2022-02-09 18:16:00 +00:00
|
|
|
case ENERGY_BUFFING:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
spiral_radius = start_end(1 - pow(abs(rand5), 5), 1) * length(inst_dir);
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(vec3(0, 0, rand3 + 1), spiral_radius, lifetime, abs(rand0), rand1 * 2 * PI) + vec3(0, 0, rand2),
|
|
|
|
vec3(6 * abs(rand4) * (1 - slow_start(2)) * pow(spiral_radius / length(inst_dir), 0.5)),
|
|
|
|
vec4(vec3(1.4), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
|
|
|
);
|
|
|
|
break;
|
2022-04-23 14:54:01 +00:00
|
|
|
case WEB_STRAND:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
perp_axis = normalize(cross(inst_dir, vec3(0.0, 0.0, 1.0)));
|
|
|
|
attr = Attr(
|
|
|
|
inst_dir * percent(),
|
|
|
|
vec3(1.0, 1.0, 50.0),
|
|
|
|
vec4(vec3(2.0), 1),
|
|
|
|
spin_in_axis(perp_axis, asin(inst_dir.z / length(inst_dir)) + PI / 2.0)
|
|
|
|
);
|
|
|
|
break;
|
2022-07-09 00:59:18 +00:00
|
|
|
case LIGHTNING:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
perp_axis = normalize(cross(inst_dir, vec3(0.0, 0.0, 1.0)));
|
2022-07-09 01:16:13 +00:00
|
|
|
float z = inst_dir.z * (percent() - 1.0);
|
2022-07-09 01:25:24 +00:00
|
|
|
vec3 start_off = vec3(abs(fract(vec3(vec2(z) * vec2(0.015, 0.01), 0)) - 0.5) * z * 0.4);
|
2022-07-09 00:59:18 +00:00
|
|
|
attr = Attr(
|
|
|
|
inst_dir * percent() + start_off,
|
2022-07-09 01:08:55 +00:00
|
|
|
vec3(max(3.0, 0.05 * length(start_pos + inst_dir * percent()))),
|
2022-07-09 01:25:24 +00:00
|
|
|
vec4(10.0, 20.0, 50.0, 1.0),// * (1.0 - length(inst_dir) * 0.1),
|
2022-07-09 00:59:18 +00:00
|
|
|
identity()//spin_in_axis(perp_axis, asin(inst_dir.z / length(inst_dir)) + PI / 2.0)
|
|
|
|
);
|
|
|
|
break;
|
2022-09-22 01:04:01 +00:00
|
|
|
case STEAM:
|
|
|
|
f_reflect = 0.0; // Magic steam doesn't reflect light, it emits it
|
|
|
|
float steam_size = 8.0 * (1 - slow_start(0.1)) * slow_end(0.15);
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3(steam_size),
|
|
|
|
vec4(vec3(0.7, 2.7, 1.3), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case BARRELORGAN:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(rand0 * 0.25, rand1 * 0.25, 1.7 + rand5),
|
|
|
|
vec3(rand2 * 0.1, rand3 * 0.1, 1.0 + rand4 * 0.5)
|
|
|
|
),
|
|
|
|
vec3(exp_scale(-0.2)) * rand0,
|
|
|
|
vec4(vec3(0.7, 2.7, 1.3), 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
2023-01-19 00:11:55 +00:00
|
|
|
case POTION_SICKNESS:
|
|
|
|
attr = Attr(
|
|
|
|
quadratic_bezier_motion(
|
|
|
|
vec3(0.0),
|
|
|
|
vec3(inst_dir.xy, 0.0),
|
|
|
|
inst_dir
|
|
|
|
),
|
|
|
|
vec3((2.0 * (1 - slow_start(0.8)))),
|
|
|
|
vec4(0.075, 0.625, 0, 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
2023-02-15 00:10:37 +00:00
|
|
|
case GIGA_SNOW:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3((3.5 * (1 - slow_start(0.2)))),
|
|
|
|
vec4(vec3(2, 2, 2), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2023-04-12 22:53:38 +00:00
|
|
|
case CYCLOPS_CHARGE:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
float burn_size = 8.0 * (1 - slow_start(0.1)) * slow_end(0.15);
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3(burn_size),
|
|
|
|
vec4(vec3(6.9, 0.0, 0.0), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2023-05-19 12:24:45 +00:00
|
|
|
case PORTAL_FIZZ:
|
|
|
|
attr = Attr(
|
2023-05-19 14:05:18 +00:00
|
|
|
inst_dir * (0.7 + pow(percent(), 5)) + vec3(
|
2023-05-19 13:25:49 +00:00
|
|
|
sin(lifetime * 1.25 + rand0 * 10) + sin(lifetime * 1.3 + rand3 * 10),
|
|
|
|
sin(lifetime * 1.2 + rand1 * 10) + sin(lifetime * 1.4 + rand4 * 10),
|
|
|
|
sin(lifetime * 5 + rand2)
|
2023-05-19 13:46:22 +00:00
|
|
|
) * 0.03,
|
2023-05-19 13:25:49 +00:00
|
|
|
vec3(pow(1.0 - abs(percent() - 0.5) * 2.0, 0.2)),
|
2023-10-24 11:38:30 +00:00
|
|
|
mix(
|
|
|
|
vec4(mix(vec3(0.4, 0.8, 0.2), vec3(5, 10, 2), pow(percent(), 2)), 1),
|
|
|
|
vec4(mix(vec3(0.6, 0.2, 0.8), vec3(9, 2, 10), pow(percent(), 2)), 1),
|
|
|
|
clamp((dot(normalize(focus_pos.xyz - start_pos), inst_dir) - 0.25) * 3.0, 0.0, 1.0)
|
|
|
|
),
|
2023-05-19 13:58:59 +00:00
|
|
|
/* vec4(vec3(1.8 - percent() * 2, 0.4 + percent() * 2, 5.0 + rand6), 1), */
|
2023-05-19 13:25:49 +00:00
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
2023-05-19 12:24:45 +00:00
|
|
|
);
|
|
|
|
break;
|
2023-08-02 07:55:10 +00:00
|
|
|
case INK:
|
|
|
|
f_reflect = 0.0; // Magic water doesn't reflect light, it emits it
|
|
|
|
float black_color = 0.3 + 0.2 * rand3 + 0.3 * max(floor(rand4 + 0.3), 0.0);
|
|
|
|
float ink_size = 8.0 * (1 - slow_start(0.1)) * slow_end(0.15);
|
|
|
|
attr = Attr(
|
|
|
|
(inst_dir * slow_end(1.5)) + vec3(rand0, rand1, rand2) * (percent() + 2) * 0.1,
|
|
|
|
vec3(ink_size),
|
|
|
|
vec4(0.5 * black_color, 0.75 * black_color, black_color, 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
2023-08-03 18:36:19 +00:00
|
|
|
);
|
|
|
|
break;
|
2023-10-08 11:35:01 +00:00
|
|
|
case WHIRLWIND:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(vec3(0, 0, 3), abs(rand0) * 3 + percent() * 20.5, percent(), -8.0 + (rand0 * 3), rand1 * 360.),
|
|
|
|
vec3((-2.5 * (1 - slow_start(0.05)))),
|
|
|
|
vec4(vec3(1.3, 1.8, 2), 1),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2023-11-28 11:13:18 +00:00
|
|
|
case FIERY_BURST:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
float fiery_radius = start_end(1.0 - pow(abs(rand5), 5.0), 1.0) * length(inst_dir);
|
|
|
|
float fiery_color1 = (7.0 + 1.0 * percent()) * min(1.0, percent() * 4.0) * 1.5;
|
|
|
|
float fiery_color2 = (4.0 - 2.0 * percent() + 1.3 * rand5 * slow_end(0.0)) * min(1.0, percent() * 4.0) * 1.3;
|
|
|
|
float fiery_color3 = 1.0 + 0.3 * percent();
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(
|
|
|
|
vec3(
|
|
|
|
0.0,
|
|
|
|
0.0,
|
|
|
|
(rand3 + 1.0)
|
|
|
|
* max(
|
|
|
|
((percent() * 8.0) * (1.0 - step(0.2, percent()))),
|
|
|
|
((2.0 * (1.0 - percent())) * (step(0.2, percent())))
|
|
|
|
)
|
|
|
|
),
|
|
|
|
fiery_radius,
|
|
|
|
lifetime,
|
|
|
|
max(0.1, step(0.6, percent())) * 3.0 * abs(rand0),
|
|
|
|
rand1 * 2.0 * PI) + vec3(0.0, 0.0, rand2),
|
|
|
|
vec3(6.0 * abs(rand4) * (1.0 - slow_start(2.0)) * pow(fiery_radius / length(inst_dir), 0.5)),
|
|
|
|
vec4(fiery_color1, fiery_color2, fiery_color3, slow_end(0.4)),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3.0)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIERY_BURST_VORTEX:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
float fiery_vortex_color1 = (min(1, percent() * 2) * (5 + 1 * percent() + 1 * slow_end(0)) * 1.5);
|
|
|
|
float fiery_vortex_color2 = (min(1, percent() * 2) * (4 - 2.4 * percent() + 1.3 * rand5 * slow_end(0)) * 1.3);
|
|
|
|
float fiery_vortex_color3 = 0;
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(
|
|
|
|
vec3(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
(0 + 0.5 * rand4 ) + 4.0
|
|
|
|
* max(
|
|
|
|
((percent() * 8) * (1 - step(0.2, percent()))), // first 20% of lifetime particle moves up, then goes down
|
|
|
|
((2 * (1 - percent())) * (step(0.2, percent())))// to avoid tearing multi should have same proportion as edge(here: 8 before, 2 after)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
abs(rand0) + 0.5 * 10 * percent(),
|
|
|
|
percent(),
|
|
|
|
10.0 * abs(rand2),
|
|
|
|
rand3),
|
|
|
|
vec3((2.5 * (1 - slow_start(0.05)))),
|
|
|
|
vec4(fiery_vortex_color1, fiery_vortex_color2, fiery_vortex_color3, start_end(0.5, 1.5) * abs(rand2)),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIERY_BURST_SPARKS:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
// sparks should flicker, so it stops glowing for 18% of time 4 times per second, same thing used in 4th float of RGBA vector
|
|
|
|
float fiery_sparks_color1 = 2 + 1 * rand2 + 2 * step(0.18, fract(tick.x*4));
|
|
|
|
float fiery_sparks_color2 = 4 + 1 * rand2 + 4 * step(0.18, fract(tick.x*4));
|
|
|
|
float fiery_sparks_color3 = 4 + 6 * step(0.18, fract(tick.x*4));
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(vec3(0, 0, 5), abs(rand0) + abs(rand1) * percent() * 4.0, percent(), 8.0 * abs(rand2), rand3),
|
|
|
|
vec3((2.5 * (1 - slow_start(0.05)))),
|
|
|
|
vec4(fiery_sparks_color1, fiery_sparks_color2, fiery_sparks_color3, 0.5 + 0.5 * step(0.18, fract(tick.x*4))),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIERY_BURST_ASH:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
/// inst_dir holds info about:
|
|
|
|
/// .x: radius of random spawn
|
|
|
|
float fiery_ash_rand_rad = inst_dir.x;
|
|
|
|
/// .y:
|
|
|
|
/// in fract: relative time of "setting on fire"
|
|
|
|
/// in int: radius of curve
|
|
|
|
float fiery_ash_radius = floor(inst_dir.y);
|
|
|
|
float fiery_ash_edge = inst_dir.y - fiery_ash_radius;
|
|
|
|
/// .z: height of the flight
|
|
|
|
float fiery_ash_height = inst_dir.z;
|
|
|
|
// {FOR PHOENIX "from the ashes"}sets ash on fire at 0.4 of lifetime, then makes it lose glow, representing losing heat
|
|
|
|
float fiery_ash_color1 = (2 + 1 * percent() * slow_end(0))
|
|
|
|
* (max(
|
|
|
|
1,
|
|
|
|
8 * step(fiery_ash_edge, percent()) * (1.4 - percent()))
|
|
|
|
);
|
|
|
|
float fiery_ash_color2 = (2 - 1 * percent() + 0.3 * abs(rand5) * slow_end(0.5))
|
|
|
|
* (max(
|
|
|
|
1,
|
|
|
|
6.5 * step(fiery_ash_edge, percent()) * (1.4 - percent()))
|
|
|
|
);
|
|
|
|
float fiery_ash_color3 = 1.5;
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(
|
|
|
|
vec3(
|
|
|
|
0.0,
|
|
|
|
0.0,
|
|
|
|
fiery_ash_height// {FOR PHOENIX "from the ashes"} 8.58
|
|
|
|
),
|
|
|
|
abs(rand0 / 2.0 + 1.0)
|
|
|
|
* max(1.0, ((percent() * fiery_ash_radius * 0.8) * (1.0 - step(0.2, percent())))) // part of lifetime particle moves to periphery
|
|
|
|
* max(1.0, (fiery_ash_radius * 0.2 * (1.0 - percent()) * (step(0.2, percent())))),// then back to center
|
|
|
|
percent(),
|
|
|
|
6.0 * abs(rand2),
|
|
|
|
rand3 * 5.0
|
|
|
|
)
|
|
|
|
+ vec3((rand6 + rand5) * fiery_ash_rand_rad, (rand8 + rand3) * fiery_ash_rand_rad, abs(rand0)),//makes it apear randomly above base animation (Fiery Burst)
|
|
|
|
vec3((2.5 * (1 - slow_start(0.0)))),
|
|
|
|
vec4(fiery_ash_color1, fiery_ash_color2, fiery_ash_color3, abs(rand2) * slow_end(0.3)),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIERY_TORNADO:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
float fiery_tornado_color1 = (2.6 + 0.5 * percent())
|
|
|
|
* 4.0 * max(0.5, percent() * 1.2);
|
|
|
|
float fiery_tornado_color2 = (1.7 - 0.6 * pow(1.0 - percent(), 2.0) + 0.3 * abs(rand5))
|
|
|
|
* 2.0 * max(0.45, percent() * 1.2);
|
|
|
|
float fiery_tornado_color3 = 1.5 * max(0.6, percent());
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(vec3(0, 0, 6.0 + rand3 * 1.5), abs(rand0) + abs(rand1) * percent() * 3.0, percent(), 15.0 * abs(rand2), -inst_time),
|
|
|
|
vec3((2.5 * (1 - slow_start(0.05)))),
|
|
|
|
vec4(fiery_tornado_color1, fiery_tornado_color2, fiery_tornado_color3, 0.5),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case PHOENIX_CLOUD:
|
|
|
|
float PC_spin = floor(inst_dir.x);
|
|
|
|
float refl = floor(inst_dir.y);
|
|
|
|
float PC_size = floor(inst_dir.z);
|
|
|
|
//best is 0.4 - reflects some light but only part as
|
|
|
|
f_reflect = refl * 0.1;
|
|
|
|
// modifies by + 5% to -15%, if color is less than 0.5 it will get from +10% to +25% to it's value
|
|
|
|
float PC_rand_color_factor = rand0 * 0.05;
|
|
|
|
float PC_R = inst_dir.x - PC_spin;
|
|
|
|
PC_R += PC_R * PC_rand_color_factor * step(0.05, PC_R) * -abs(PC_rand_color_factor * 2.0)
|
|
|
|
+ PC_R * (1.0 - step(0.05, PC_R)) * max(abs(PC_rand_color_factor), 0.02) * 5.0;
|
|
|
|
float PC_G = inst_dir.y - refl;
|
|
|
|
PC_G += PC_G * PC_rand_color_factor * step(0.05, PC_G) * -abs(PC_rand_color_factor * 2.0)
|
|
|
|
+ PC_G * (1.0 - step(0.05, PC_G)) * max(abs(PC_rand_color_factor), 0.02) * 5.0;
|
|
|
|
float PC_B = inst_dir.z - PC_size;
|
|
|
|
PC_B += PC_B * PC_rand_color_factor * step(0.05, PC_B) * -abs(PC_rand_color_factor * 2.0)
|
|
|
|
+ PC_B * (1.0 - step(0.05, PC_B)) * max(abs(PC_rand_color_factor), 0.02) * 5.0;
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0.0, 0.0, 0.0),
|
|
|
|
vec3(rand4, rand5, rand6 * 2.5)
|
|
|
|
),
|
|
|
|
vec3(8.0 * min(percent() * 3.0, 1.0) * min((1.0 - percent()) * 2.0, 1.0)),
|
|
|
|
vec4(
|
|
|
|
PC_R,
|
|
|
|
PC_G,
|
|
|
|
PC_B,
|
|
|
|
PC_size * 1.2) * 10.0,
|
|
|
|
spin_in_axis(vec3(rand6 + rand5, rand7 + rand9, rand8 + rand2), percent() * PC_spin)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case FIERY_DROPLET_TRACE:
|
|
|
|
float m_r = 4.0;
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
float prcnt = percent(); //idk if compiler would optimize it or not but as we have a lot of those particles... i'll just try
|
|
|
|
float droplet_color1 = 1 * (5 + 1 * prcnt + 1 * slow_end(0)) * 1.5;
|
|
|
|
float droplet_color2 = 1 * (4 - 2.4 * prcnt + 1.3 * rand5 * slow_end(0)) * 1.3;
|
|
|
|
float droplet_color3 = 0;
|
|
|
|
attr = Attr(
|
|
|
|
quadratic_bezier_motion(
|
|
|
|
vec3(0.0),
|
|
|
|
vec3(m_r * rand0, m_r * rand1, 0.0),
|
|
|
|
vec3(m_r * rand0, m_r * rand1, 4.0)
|
|
|
|
),
|
|
|
|
vec3(1),
|
|
|
|
vec4(droplet_color1,
|
|
|
|
droplet_color2,
|
|
|
|
droplet_color3,
|
|
|
|
1 * prcnt * (1 - step(0.5, prcnt)) + (1 - prcnt) * (step(0.5, prcnt))),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case ENERGY_PHOENIX:
|
|
|
|
f_reflect = 0.0;
|
|
|
|
float fiery_r = (2 + 1 * percent() * slow_end(0))
|
|
|
|
* 6 * (1.4 - percent());
|
|
|
|
float fiery_g = (2 - 1 * percent() + 0.3 * abs(rand5) * slow_end(0.5))
|
|
|
|
* 4.5 * (1.4 - percent());
|
|
|
|
float fiery_b = 1.5;
|
|
|
|
spiral_radius = length(inst_dir);
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(vec3(0.0, 0.0, 0.01), spiral_radius + abs(rand1), lifetime / 0.5, abs(rand0), rand1 * 2.0 * PI) + vec3(0.0, 0.0, rand2),
|
|
|
|
vec3(6.0 * abs(rand4) * (1 - slow_start(2.0))),
|
|
|
|
vec4(vec3(fiery_r, fiery_g, fiery_b), 1.0),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3.0)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case PHOENIX_BEAM:
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
float beam_r = 6.0 - (4.0 * percent()) + 15.0 * fract(percent() * 4 + rand0 * rand0) * (1 - percent());
|
|
|
|
float beam_g = 2.0 + 6.6 * fract(percent() * 4 + rand0 * rand0) * (1 - percent());
|
|
|
|
float beam_b = 1.4;
|
|
|
|
|
|
|
|
vec3 factor_rand = vec3((rand0 * 0.2) * (rand5 * 0.1) + rand6 * 0.9, (rand1 * 0.2) * (rand4 * 0.1) + rand7 * 0.9, (rand2 * 0.2) * (rand3 * 0.1) + rand8 * 0.9);
|
|
|
|
start_pos += factor_rand + normalize(inst_dir) * 0.6;
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(inst_dir - factor_rand * 0.4, 0.3 * ((rand2 + 0.5) * 5.5) * (1.0 - min(linear_scale(1.5), 1.0)), lifetime / inst_lifespan, 24.0, -inst_time * 8.0),
|
|
|
|
vec3((2.5 * (1 - slow_start(0.2)))),
|
|
|
|
vec4(beam_r, beam_g, beam_b, 1.0),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10.0 + 3.0 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case PHOENIX_BUILD_UP_AIM:
|
|
|
|
|
|
|
|
f_reflect = 0.0; // Fire doesn't reflect light, it emits it
|
|
|
|
|
|
|
|
float perc_t = percent(); // in case compiler wont optimize, idk
|
|
|
|
|
|
|
|
float aim_r = rand0 * 0.25 + 3.0 + 4.5 * perc_t * (1 - step(0.79, perc_t)) + 8.0 * step(0.81, perc_t) * perc_t;
|
|
|
|
float aim_g = rand0 * 0.25 + 2.0 - 1.0 * perc_t * (1 - step(0.79, perc_t)) + 2.0 * step(0.81, perc_t) * perc_t;
|
|
|
|
float aim_b = 1.4 * ((1 - perc_t) + step(0.74, perc_t));
|
|
|
|
|
|
|
|
|
|
|
|
vec3 dir_aim = inst_dir * 1.0;
|
|
|
|
vec3 rand_pos_aim = (cross(
|
|
|
|
(1.0 - 2.0 * step(0.0, rand2)) * normalize(inst_dir),
|
|
|
|
vec3(0.0, 0.0, 1.0)));
|
|
|
|
|
|
|
|
vec3 rand_fact = vec3(rand1 * 1, rand0 * 1, rand2 * 1);
|
|
|
|
start_pos += vec3(0.0, 0.0, 5.0) + rand_fact;
|
|
|
|
attr = Attr(
|
|
|
|
spiral_motion(
|
|
|
|
inst_dir + vec3(0.0, 0.0, -(6.0 - 3.0 * pow(perc_t, 2.5))) - rand_fact,
|
|
|
|
1.2 * rand9 * max(1.0 - perc_t, 0.0),
|
|
|
|
perc_t,
|
|
|
|
6.0,
|
|
|
|
inst_time * 8.0),
|
|
|
|
vec3((1.9 * (1 - slow_start(0.2)))),
|
|
|
|
vec4(aim_r, aim_g, aim_b, 1.0),
|
|
|
|
spin_in_axis(vec3(rand6, rand7, rand8), perc_t * 10.0 + 3.0 * rand9)
|
|
|
|
);
|
|
|
|
break;
|
2024-01-20 17:45:23 +00:00
|
|
|
case CLAY_SHRAPNEL:
|
|
|
|
float clay_color = 0.025 + 0.02 * rand1;
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(0),
|
|
|
|
normalize(vec3(rand4, rand5, rand6)) * 15.0 + grav_vel(earth_gravity)
|
|
|
|
),
|
|
|
|
vec3(5 * (1 - percent())),
|
|
|
|
vec4(vec3(clay_color * 3, clay_color * 2, clay_color), 1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
2021-05-11 00:58:32 +00:00
|
|
|
default:
|
|
|
|
attr = Attr(
|
|
|
|
linear_motion(
|
|
|
|
vec3(rand0 * 0.25, rand1 * 0.25, 1.7 + rand5),
|
|
|
|
vec3(rand2 * 0.1, rand3 * 0.1, 1.0 + rand4 * 0.5)
|
|
|
|
),
|
2021-06-27 21:45:07 +00:00
|
|
|
vec3(exp_scale(-0.2)) * rand0,
|
2021-05-11 00:58:32 +00:00
|
|
|
vec4(1),
|
|
|
|
spin_in_axis(vec3(1,0,0),0)
|
|
|
|
);
|
|
|
|
break;
|
2020-10-21 21:05:25 +00:00
|
|
|
}
|
|
|
|
|
2020-11-18 14:15:01 +00:00
|
|
|
// Temporary: use shrinking particles as a substitute for fading ones
|
|
|
|
attr.scale *= pow(attr.col.a, 0.25);
|
|
|
|
|
2021-01-31 15:15:17 +00:00
|
|
|
f_pos = start_pos + (v_pos * attr.scale * SCALE * mat3(attr.rot) + attr.offs);
|
2020-10-21 21:05:25 +00:00
|
|
|
|
2022-01-18 01:47:06 +00:00
|
|
|
#ifdef EXPERIMENTAL_CURVEDWORLD
|
|
|
|
f_pos.z -= pow(distance(f_pos.xy + focus_off.xy, focus_pos.xy + focus_off.xy) * 0.05, 2);
|
|
|
|
#endif
|
|
|
|
|
2020-10-21 21:05:25 +00:00
|
|
|
// First 3 normals are negative, next 3 are positive
|
|
|
|
// TODO: Make particle normals match orientation
|
|
|
|
vec4 normals[6] = vec4[](vec4(-1,0,0,0), vec4(1,0,0,0), vec4(0,-1,0,0), vec4(0,1,0,0), vec4(0,0,-1,0), vec4(0,0,1,0));
|
|
|
|
f_norm =
|
|
|
|
// inst_pos *
|
2021-03-28 23:29:48 +00:00
|
|
|
normalize(((normals[(v_norm_ao >> 0) & 0x7u]) * attr.rot).xyz);
|
2020-10-21 21:05:25 +00:00
|
|
|
|
|
|
|
//vec3 col = vec3((uvec3(v_col) >> uvec3(0, 8, 16)) & uvec3(0xFFu)) / 255.0;
|
2020-11-18 13:22:05 +00:00
|
|
|
f_col = vec4(attr.col.rgb, attr.col.a);
|
2020-10-21 21:05:25 +00:00
|
|
|
|
|
|
|
gl_Position =
|
|
|
|
all_mat *
|
|
|
|
vec4(f_pos, 1);
|
2020-07-31 17:16:20 +00:00
|
|
|
}
|