Commit Graph

205 Commits

Author SHA1 Message Date
bjorn 10c2c75482 Frustum culling;
- Adds Pass:setViewCull to enable/disable frustum culling.
- Renames Pass:setCullMode to Pass:setFaceCull (with backcompat).

Some stuff currently missing:

- Text is not culled, but should be.
- VR view frusta are not merged yet.
2023-07-07 14:51:22 -07:00
bjorn 6e018b8c96 Replace HeadsetOrigin with 'seated' flag;
Origin type used to be a query-able property of the VR system that
indicated whether the tracking was roomscale or seated-scale.

The t.headset.offset config value could be used to design an
origin-agnostic experience, which by default shifted content up 1.7
meters when tracking was seated-scale.  That way, stuff rendered at
y=1.7m was always at "eye level".  It worked pretty well.

It's getting replaced with a t.headset.seated flag.

- If seated is false (the default), the origin of the coordinate space
  will be on the floor, enabling the y=1.7m eye level paradigm.  If
  tracking is not roomscale, a floor offset of 1.7m will be emulated.
- If seated is true, the origin of the coordinate space will be y=0
  at eye level (where the headset was when the app started).  This is
  the case on both roomscale and seated-scale tracking.

So basically 'seated' is an opt-in preference for where the app wants
its vertical origin to be.

One advantage of this is that it's possible to consistently get a y=0
eye level coordinate space, which was not possible before.  This makes
it easier to design simpler experiences that only need to render a
floating UI and don't want to render a full environment or deal with
offsetting everything relative to a 'floor'.  This also makes it easier
to implement hybrid VR+flatscreen experiences, because the camera is at
y=0 when the headset module is disabled.

The opt-in nature of the flag, coupled with the fact that it is
consistent across all types of tracking and hardware, is hopefully a
more useful design.
2023-06-28 16:38:36 -07:00
bjorn 3f0dbeb595 Add lovr.headset.stopVibration; 2023-06-27 20:45:44 -07:00
bjorn 98729912a8 Add GL_EXT_samplerless_texture_functions; 2023-06-24 14:00:22 -07:00
bjorn 116d14cdf8 Details; 2023-06-24 11:26:09 -07:00
bjorn 97cc7d9137 Fix issue with blend shape compute shader;
It was only copying the raw vertex data for the first blend shape,
not the first blend shape in each group.
2023-06-20 21:42:44 -07:00
bjorn 4ec065757d Optimize blendshapes;
To initialize the vertices to their default state, it's way faster to
use a branch in the compute shader rather than using a copy.
2023-06-17 17:14:00 -07:00
bjorn a723ec7c5c Update error screen;
The error screen uses an orthographic projection when rendered in a
window, so the text is always the same size instead of scaling with the
window size.

Also you can close it with escape.
2023-05-12 17:16:22 +01:00
bjorn 61fe0f3bc0 Default errhand uses transparent background in AR; 2023-05-12 14:31:31 +01:00
bjorn 776a709de1 nogame: quit on escape; 2023-05-12 14:30:47 +01:00
bjorn b8a8aa2755 nogame: only set background color in VR; 2023-05-12 14:28:53 +01:00
bjorn 264bfdeadf Use lovr.system.pollEvents in lovr.errhand; 2023-05-10 18:14:09 +01:00
bjorn 211c29e8c2 rm oculus openxr loader;
As of v51, Quest works with the official OpenXR loader.
2023-05-10 18:14:09 +01:00
bjorn da107f4387 Rename lovr.event.pump to lovr.system.pollEvents; 2023-05-10 18:14:09 +01:00
bjorn 027dd0563b Fix seam in equirect shader; 2023-05-10 18:14:09 +01:00
bjorn 20a331cb93 Fix equirect shader orientation; 2023-05-10 18:14:09 +01:00
bjorn 43e796acd1 Fix --graphics-debug; 2023-05-03 23:08:45 -07:00
bjorn c717670a80 Add --graphics-debug command line argument; 2023-05-03 20:54:19 -07:00
bjorn 452ee5c7c6 Pass rework;
Pass stores draw commands rather than sending them to Vulkan
immediately.

The main motivation is to allow more flexibility in the Lua API.  Passes
are now regular objects, aren't invalidated whenever submit is called,
and can cache their draws across multiple frames.  Draws can also be
internally culled, sorted, and batched.

Some API methods (tallies) are missing, and there are still some bugs to
fix, notably with background color.
2023-05-02 00:06:01 -07:00
bjorn f98306e786 rm transfer passes; rm Tally for now;
- Add Buffer:newReadback
- Add Buffer:getData
- Buffer:getPointer works with permanent buffers
- Buffer:setData works with permanent buffers
- Buffer:clear works with permanent buffers
- Add Texture:newReadback
- Add Texture:getPixels
- Add Texture:setPixels
- Add Texture:clear
- Add Texture:generateMipmaps
- Buffer readbacks can now return tables in addition to Blobs using Readback:getData

Tally is coming back soon with an improved API, it's temporarily removed
since it made the transfer rework a bit easier.

Note that synchronous readbacks (Buffer:getData, Texture:getPixels)
internally call lovr.graphics.submit, so they invalidate existing Pass
objects.  This will be improved soon.
2023-04-29 18:31:03 -07:00
bjorn 6862b8c970 Change cofactor/normal matrix to mat3;
This means per-draw uniform data is 128 bytes now!
2023-04-27 20:22:31 -07:00
bjorn 8f654ed408 Simplify fill shaders;
Now there's 2 instead of 3!  Behavior is the same, fill goes
layer-by-layer onto each view until either the texture or canvas run out
of layers.
2023-04-26 22:18:06 -07:00
bjorn 6c252a47b8 Don't declare builtin flags in compute shaders;
They aren't used, and increase file size and clutter up disassembly.
2023-04-05 21:53:39 -07:00
bjorn 747c7fdddf Optimize blend shape shader;
This is ~20% faster, I think it's because all the SSBO stores are
"batched" at the end.
2023-04-05 21:53:39 -07:00
bjorn a2b12c9e7c Vertex tangents don't require normalMap flag anymore; 2023-03-31 19:23:20 -07:00
bjorn ff10461e69 Reduce blend shape chunk size from 128 to 64; 2023-03-31 18:45:16 -07:00
bjorn f56b48b3a7 Blend shapes and skinning work at the same time; 2023-03-31 18:45:16 -07:00
bjorn 4a6de6caf5 Write blend shape compute shader; Bugfixes; 2023-03-31 18:45:16 -07:00
bjorn 530db8c7f8 WIP blend shape compute dispatch; 2023-03-31 18:45:16 -07:00
bjorn 6de1c624b4 Scope shader macros by the stage they're valid in;
Leads to better error messages if you try to use e.g. DefaultPosition in
a fragment shader.
2023-03-02 19:03:15 -08:00
bjorn abbc6a6dc6 Merge branch 'master' into dev 2023-02-21 21:12:33 -08:00
Bjorn d1eaa43997
Merge pull request #641 from brainrom/pkgrename
Android package rename via CMake
2023-02-05 21:57:25 -08:00
bjorn 89edccbf4c Add lovr.headset.isPassthroughEnabled and lovr.headset.setPassthroughEnabled; 2023-02-05 19:51:12 -08:00
bjorn 7027defe3c rm attachmentCount shader flag;
It doesn't work as intended (due to glslang issues?).  The current way
to write a shader that uses multiple attachments is to declare multiple
output variables, which is a little better because you can name them
however you want and customize the type.

It would be nice to be able to support a "void" entrypoint for multiple
attachments so you don't need to awkwardly return the first target's
color, but I can't find a way around this right now.
2023-02-05 16:04:17 -08:00
bjorn bf31072d0d Cleanup; 2023-01-30 19:44:23 -08:00
Ilya Chelyadin d84d358de7 Minor fixes 2023-01-31 06:03:53 +03:00
kokokoshka 85b6e36020 Android package rename via CMake 2023-01-30 20:35:49 +03:00
Ilya Chelyadin ac012d39c2 Universal APK for Oculus, Pico and Generic loaders 2023-01-05 01:50:38 +03:00
Ilya f3837d99fd
Merge branch 'bjornbytes:master' into picofix 2023-01-04 23:03:54 +03:00
bjorn b6d8546a6f Merge branch 'master' into dev 2023-01-02 16:46:55 -08:00
bjorn fe353ea243 Fix default lovr.log printing gsub result; 2022-12-30 21:40:27 -08:00
bjorn d438578c42 CMake: Windows includes lovrc.bat in builds;
Also made a nifty helper function to move resources to the build folder,
in an effort to avoid writing duplicate versions of these functions for
each platform.
2022-12-30 21:20:27 -08:00
bjorn c81a356799 Compress monkey more;
Its face is smooth now, which looks better, is somewhat better for
testing, and saves 8kb.
2022-12-29 20:33:49 -08:00
bjorn dc93920816 Fix monkeycrush index;
There was a bugfix that makes model vertex indices 1-based.
2022-12-29 20:33:49 -08:00
Ilya Chelyadin f62c99e469 Fix typos, indentation, minor issues 2022-12-08 07:05:30 +03:00
Ilya bd767092f3
Merge branch 'bjornbytes:master' into picofix 2022-12-07 19:50:13 +03:00
Bjorn 78a70670bb
Merge branch 'dev' into MSFT_controller_model 2022-12-03 19:34:49 -08:00
bjorn a615351f66 Actions; Sponsors; README; 2022-12-02 18:14:31 -08:00
Ilya 92c136bc73
Merge branch 'bjornbytes:master' into picofix 2022-12-01 21:20:33 +03:00
bjorn f9d7742dfd Add support for headless headset rendering;
Although the name is unfortunate, this allows access to lovr.headset
when no window is opened or when the graphics module is disabled.  This
requires the XR_MND_headless extension to be supported by the runtime.
2022-11-26 14:40:39 -08:00
Ilya Chelyadin 3f20364c3f Pico is back!
Tested on Pico Neo 3 with PUI v4.9.3
Also included generic (Monado-Android) Android flavor.
2022-11-22 22:01:13 +03:00
s-ol 043f9c7920 store headset model metadata for animations 2022-11-22 12:24:57 +01:00
bjorn 9783140725 Fix window resize; 2022-11-09 19:05:01 -08:00
bjorn b81f86b5ad rm Android flavors for now;
There used to be oculus and pico but pico doesn't work anymore.

Eventually things will converge on the standard loader and we won't
need different loaders, but manifests may require flavors.
2022-11-09 00:21:49 -08:00
bjorn 36e1471cf0 lovr.graphics.isInitialized;
Returns whether the graphics module is initialized.  Used by the default
error handler to know if it's safe to try to render the error screen.
2022-11-07 19:12:11 -08:00
bjorn 5e2b44ad08 Fix stereo mirror window;
For some reason this was rendering both layers of a multi-layer
texture all squished.  I think it was supposed to just render the
first layer.
2022-11-07 17:14:27 -08:00
bjorn 904fb282c2 v0.16.0; 2022-10-15 21:49:25 -07:00
bjorn ee3cc30851 Animator renormalizes quantized weights;
It would be nice to do this in the importer, but it was 50+ lines and
was really tricky to write without reading from uncached GPU-mapped
memory.  Instead, it's 1 line here.

I hope zero-weight vertices aren't a thing?
2022-10-03 01:29:01 -07:00
bjorn cd04060467 Use correct roughness for indirect specular lighting; 2022-09-23 23:58:47 -07:00
bjorn d905b649a4 Lighting helper fixes; 2022-09-23 23:44:31 -07:00
bjorn ef407fd564 Add var shader helper;
Now you can write var(0) instead of layout(set = 2, binding = 0).
The advantage is less typing and resilience in the event that the
default set changes.
The disadvantage is that now you can't use var.
2022-09-22 20:44:06 -07:00
bjorn 952bff414a Add more oculus manifest permissions;
- Keyboard tracking
- Render model
- Passthrough
2022-09-21 14:58:30 -07:00
bjorn 72334cc1f2 Fix cubemaps being horizontally flipped; 2022-09-20 22:17:58 -07:00
bjorn 28869431fb Fix stereo mirror window; 2022-09-15 20:45:26 -07:00
bjorn 1dd737d8a4 Make the logo a default shader;
Improves build system, improves filesize, seemingly improves startup time
2022-09-13 17:36:10 -07:00
bjorn d8c6c47e00 Add normal DefaultShader;
It's a pretty normal shader.
2022-09-10 11:07:55 -07:00
bjorn 5c4fc79242 mv lovr.graphics.init lovr.graphics.initialize;
init is undocumentable due to Lua conventions.
2022-09-10 10:22:52 -07:00
bjorn 688c698808 Enable hand tracking 2.0 in AndroidManifest.xml; 2022-09-02 18:53:31 -07:00
bjorn 8697466009 Shader flag adjustments;
- glowTexture is on by default, but still requires the glow flag.
- occlusionTexture is named ambientOcclusion, and is on by default,
  but is still not used by any builtin shaders/helpers.
2022-09-02 15:33:18 -07:00
bjorn 0b0faf6dc6 DefaultColor respects flag_colorTexture; 2022-09-02 15:07:45 -07:00
bjorn d513b98ce2 Fix cubemap shader; 2022-08-26 22:22:37 -07:00
bjorn 085550da33 Tonemapping, I guess; 2022-08-26 10:34:32 -07:00
bjorn ad7c854571 Add evaluateSphericalHarmonics helper; 2022-08-26 10:28:43 -07:00
bjorn 70aff00a11 Rename shader flags; Add color flags; 2022-08-26 10:28:23 -07:00
bjorn 5a2fe54c04 Improve Pass:fill;
It can now fill an array texture to a multiview pass, copying to
the corresponding layers.
2022-08-26 09:57:51 -07:00
bjorn f4f95a64d7 Pass blends by default; 2022-08-25 22:01:12 -07:00
bjorn ede1036694 Temporary Passes;
Sigh, back to getPass.  I don't even know at this point.  Basically now
that we came up with a half-solution for temp buffers, it makes sense to
apply this to passes as well, since we aren't going with the workstream
idea and temp passes are more convenient than retained passes.
2022-08-25 21:57:15 -07:00
Josip Miskovic 11f2d052ef Skybox view matrix includes local transform 2022-08-18 09:04:42 -07:00
bjorn 51312f4704 Add attachmentCount/defaultPointSize specialization constants; 2022-08-14 09:43:00 -07:00
bjorn 5799b0effb Rename setBackground back to setBackgroundColor;
The "fancy background" idea won't go here.
2022-08-13 21:10:58 -07:00
bjorn f894c87723 Clamp roughness to .05; 2022-08-13 00:26:18 -07:00
bjorn 13f40a05c3 Update getPixel syntax for array textures;
vec3 is just kinda weird.
2022-08-13 00:00:00 -07:00
bjorn 507c02bfb1 Invert surface normal when backfacing; 2022-08-12 23:30:39 -07:00
bjorn efdbc7f7ba Fix equirect shader; 2022-08-12 22:46:59 -07:00
bjorn f6a1fbdfb9 Add new 'Constants' helper; 2022-08-12 22:44:18 -07:00
bjorn 3cbf85c98a Adjust error screen font size and default perspective; 2022-08-12 21:08:25 -07:00
bjorn 23932c6e7c Default errhand stops audio playback; 2022-08-12 20:46:59 -07:00
bjorn 016d3753d5 Further boot.lua cleanup; 2022-08-12 20:32:45 -07:00
bjorn ad6360d2fd Clean up boot.lua;
A lot of clean up can happen now that C doesn't push delayed errors to
Lua.  This was happening for Pico and WebVR, neither of which are used
anymore.

Also default vsync to true but force it off if VR is active.
2022-08-12 20:18:55 -07:00
bjorn 5324ae9a84 Fix error screen; 2022-08-12 19:28:25 -07:00
bjorn b51d4e7de7 Normal mapping; 2022-08-12 17:59:06 -07:00
bjorn 7e5221492d rm pointSize from Material;
It's weird, and about as inconvenient as just putting it in the shader.
2022-08-09 19:54:54 -07:00
bjorn 0a599ccdd6 Rename PixelColors to PixelColor; 2022-08-09 19:51:53 -07:00
bjorn 63a327c0b2 Add getLighting builtin function to shaders; 2022-08-09 19:49:47 -07:00
bjorn 6d6e79e704 Recompile nogame shader;
Need to automate better, but later
2022-08-08 20:46:27 -07:00
bjorn 2047127a97 Enable depth submission by default; 2022-08-06 23:45:37 -07:00
bjorn 9b7b4e323c appveyor rebuilds when CMakeLists changes; 2022-08-06 18:56:52 -07:00
bjorn 7efd19c45c Add uniform buffer for global constants;
So far it has resolution and timestamp.

Broke the nogame shader, need to recompile.
2022-08-06 13:37:27 -07:00
bjorn 642388709b Shader helper improvements; 2022-08-06 13:06:42 -07:00
bjorn c41188c4b4 Merge branch 'master' into dev 2022-08-06 11:08:02 -07:00