lovr

bjornbytesMIT活跃维护

用 Lua 写 VR 应用的轻量框架,封装 OpenXR/OpenVR 接口,让开发者不用碰底层 C 代码就能快速做出虚拟现实游戏和交互体验。

Lua Virtual Reality Framework

v0.19.0发布于 2026-06-07 21:12 UTC2,622star +2 / 7 天178fork同步于 2026-11-10 11:43 UTC

怎么上手

由 README 提炼,执行前请确认
mkdir build
cd build
cmake ..
cmake --build .
硬件要求按 README 说明

README 未说明具体显存或 GPU 型号要求;运行平台为 Windows、macOS、Linux 和 Android,VR 需兼容 OpenXR 的头显,无头显时可用键鼠模拟器。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Lua 快速搭建 3D 游戏和 VR 体验的轻量框架,跨平台跨头显

用 Lua 写 VR 应用的轻量框架,封装 OpenXR/OpenVR 接口,让开发者不用碰底层 C 代码就能快速做出虚拟现实游戏和交互体验。

核心能力

  • 用 LuaJIT 脚本编写,几行代码即可创建 3D 场景
  • 支持所有兼容 OpenXR 的头显,并内置键鼠 VR 模拟器
  • C11 实现,含优化的单通道立体渲染
  • 提供计算着色器、光线追踪、间接渲染等 GPU 能力
  • 内置 JoltPhysics 刚体物理与 SteamAudio 空间音频

容易踩的坑

从源码构建需自行安装 CMake 工具链;官方推荐直接下载可执行文件,把 main.lua 拖到可执行文件上运行;加载 glTF 模型等资源需自行准备资源文件。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.19.0
  1. v0.19.0Forbidden Jorts最新正式版2026-06-07 · 2026-06-07 21:12 UTC

    Add

    General

    • Add lovr.task module and lovr.taskready callback.
    • Add support for compiling with Luau as the Lua implementation, instead of Lua/LuaJIT.
    • Add support for passing Luau vector and quaternion types to functions.
    • Add vector and quaternion modules.

    Audio

    • Add AudioMesh and lovr.audio.newAudioMesh.
    • Add support for ambisonic source playback.
    • Add lovr.audio.setHRTF to set a custom HRTF.
    • Add Source:get/setAbsorption.
    • Add Source:get/setCone.
    • Add Source:get/setFalloff.
    • Add Source:get/setOcclusion.
    • Add Source:get/setReverb.
    • Add Source:get/setSpatialization.
    • Add lovr.audio.update to atomically commit changes to audio sources.
    • Add lovr.audio.getStream.
    • Add t.audio.debug and t.audio.reverb settings to lovr.conf.

    Data

    • Add AudioStream and lovr.data.newAudioStream.
    • Add Blob:setI8/setU8/setI16/setU16/setI32/setU32/setF32/setF64.
    • Add lovr.data.newBlobView.
    • Add Model(Data):getNodeChild/getNodeSibling.
    • Add Model(Data):getNodeMesh (replaces :getNodeMeshes).
    • Add ModelData:getMeshBlendShapeCount/getMeshBlendShapeName/getBlendVertex.
    • Add ModelData:getMeshPartCount.
    • Add ModelData:getMeshDrawRange.
    • Add support for importing two sets of UVs in ModelData.
    • Add Sound:get/setFrame.

    Graphics

    • Add Raytracer, lovr.graphics.newRaytracer, and raytracing GraphicsFeature.
    • Add raytracer option to lovr.graphics.newMesh and lovr.graphics.newModel.
    • Add Mesh:buildRaytracer and Model:buildRaytracer.
    • Add VertexUV2 builtin vertex attribute and UV2 shader variable, for lightmapping.
    • Add t.graphics.hdr and lovr.graphics.isHDR.
    • Add pqToLinear, linearToPQ, sRGBToRec2020, and rec2020ToSRGB shader helpers.
    • Add Pass:getViewRay.
    • Add Pass:setBlendState.
    • Add Pass:drawPart to draw a single part of a Model.
    • Add Model:meshes to iterate over model nodes with meshes.
    • Add Model:is/setNodeVisible.
    • Add lovr.graphics.getStats for GPU memory allocation statistics.
    • Add support for creating 3D texture views.
    • Add Mesh:get/setBaseVertex.
    • Add support for custom array strides in buffer formats.
    • Add bgra8 TextureFormat.
    • Add Buffer:newBlob.

    Headset

    • Add lovr.modelschanged event.
    • Add lovr.headset.getModelKeys.
    • Add support for "foveated quad" and "mono" display configurations.
    • Add Layer:get/setOrigin to lock Layer poses to a Device.
    • Add dpup, dpdown, dpleft, dpright DeviceButton.
    • Add bumper DeviceButton.
    • Add body Device for full-body tracking in lovr.headset.getSkeleton.
    • Add lovr.simulate callback to customize the headset simulator.
    • Add support for Touch Pro controllers.
    • Add thumbrest HeadsetAxis, for pressure-sensitive thumbrests.
    • Add t.headset.extensions to enable extra OpenXR extensions.
    • Add lovr.headset.connect and t.headset.connect.
    • Add lovr.headset.setPosition/Orientation/Pose and lovr.headset.setButton.

    Math

    • Add Curve:getLength and Curve:step.
    • Add Mat4:setPosition/Orientation/Scale/Pose.

    Physics

    • Add support for non-uniform scale in ConvexShape and MeshShape.

    System

    • Add t.window.centered.
    • Add lovr.system.is/setWindowFullscreen.
    • Add lovr.system.get/setMouseMode.

    Thread

    • Add lovr.thread.call.
    • Add lovr.thread.getWorkerCount.

    Change

    • Change model loading to use multiple threads to load images.
    • Change Pass:setProjection to accept a ProjectionType.
    • Change lovr.graphics.newModel to no longer retain its ModelData, allowing its memory to be freed.
    • Change functions to accept tables for vector/quaternion arguments instead of userdata vector types.
    • Change require to have better errors when files/plugins aren't found.
    • Change default require path to also search for .luau files, when using Luau.
    • Change `lovr.headset.newMo
  2. v0.18.0Dream Eater2025-02-15 · 2025-02-15 02:51 UTC
    查看更新说明

    Add

    General

    • Add support for declaring objects as to-be-closed variables in Lua 5.4.

    Filesystem

    • Add --watch CLI flag, lovr.filechanged event, and lovr.filesystem.watch/unwatch.
    • Add File object and lovr.filesystem.newFile.
    • Add lovr.filesystem.getBundlePath (for internal boot code).
    • Add lovr.filesystem.setSource (for internal boot code).

    Graphics

    • Add Pass:polygon.
    • Add Shader:hasVariable.
    • Add support for BMFont in Font and Rasterizer.
    • Add support for uniform variables in shader code.
    • Add support for cubemap array textures.
    • Add support for transfer operations on texture views.
    • Add support for nesting texture views (creating a view of a view).
    • Add sn10x3 DataType.
    • Add border WrapMode.
    • Add support for loading glTF models with 8 bit indices.
    • Add support for d24 texture format.
    • Add support for SampleID, SampleMaskIn, SampleMask, and SamplePosition in pixel shaders.
    • Add support for layout(scalar) buffers and packedBuffers graphics feature.
    • Add raw flag to lovr.graphics.newShader.
    • Add Texture:getLabel, Shader:getLabel, and Pass:getLabel.
    • Add Model:resetBlendShapes.

    Headset

    • Add Layer object, lovr.headset.newLayer, and lovr.headset.get/setLayers.
    • Add stylus Device, nib DeviceButton, and nib DeviceAxis.
    • Add support for Logitech MX Ink input.
    • Add lovr.headset.get/setFoveation.
    • Add t.headset.controllerskeleton to control how controllers return hand tracking data.
    • Add controller field to the table returned by lovr.headset.getSkeleton.
    • Add t.headset.mask.
    • Add back lovr.headset.isMounted and the lovr.mount callback.
    • Add lovr.headset.stop, lovr.headset.isActive, and t.headset.start.
    • Add lovr.headset.getFeatures.
    • Add t.headset.debug to enable additional messages from the VR runtime.
    • Add --simulator CLI flag to force use of simulator headset driver.
    • Add lovr.headset.getHandles.

    Math

    • Add Quat:get/setEuler.

    Physics

    • Add variant of lovr.physics.newWorld that takes a table of settings.
    • Add World:interpolate.
    • Add World:get/setCallbacks and Contact object.
    • Add World:getColliderCount.
    • Add World:getJointCount and World:getJoints.
    • Add World:shapecast.
    • Add World:overlapShape.
    • Add Collider:get/setGravityScale.
    • Add Collider:is/setContinuous.
    • Add Collider:get/setDegreesOfFreedom.
    • Add Collider:applyLinearImpulse and Collider:applyAngularImpulse.
    • Add Collider:moveKinematic.
    • Add Collider:getShape.
    • Add Collider:is/setSensor (replaces Shape:is/setSensor).
    • Add Collider:get/setInertia.
    • Add Collider:get/setCenterOfMass.
    • Add Collider:get/setAutomaticMass.
    • Add Collider:resetMassData.
    • Add Collider:is/setEnabled.
    • Add ConvexShape.
    • Add WeldJoint.
    • Add ConeJoint.
    • Add Joint:getForce and Joint:getTorque.
    • Add Joint:get/setPriority.
    • Add Joint:isDestroyed.
    • Add DistanceJoint:get/setLimits.
    • Add :get/setSpring to DistanceJoint, HingeJoint, and SliderJoint.
    • Add HingeJoint:get/setFriction and SliderJoint:get/setFriction.
    • Add SliderJoint:getAnchors.
    • Add Shape:raycast and Shape:containsPoint.
    • Add Shape:get/setDensity.
    • Add Shape:getMass/Volume/Inertia/CenterOfMass.
    • Add Shape:get/setOffset.
    • Add motor support to HingeJoint and SliderJoint.
    • Add support for creating a MeshShape from a ModelData.

    System

    • Add lovr.system.isWindowVisible and lovr.system.isWindowFocused.
    • Add lovr.system.wasMousePressed and lovr.system.wasMouseReleased.
    • Add lovr.system.get/setClipboardText.
    • Add lovr.system.openConsole (for internal Lua code).
    • Add KeyCodes for numpad keys.

    Thread

    • Add table support to Channel:push.
    • Add lovr.thread.newChannel.
    • Add t.thread.workers to configure number of worker threads.
  3. v0.17.12024-03-12 · 2024-03-12 19:20 UTC
    查看更新说明

    Change

    • Change permissions for files and directories created by lovr.filesystem on POSIX (fixes ADB on Android 12+).
    • Change Pass:sphere to error when segment count is too small.
    • Change Buffer:setData to error when copying within a single Buffer with overlapping byte ranges.

    Fix

    • Fix LÖVR failing to start on Oculus Quest v62+.
    • Fix Pass:skybox to render cubemaps with the correct X/Z orientation.
    • Fix depth write when depth testing is disabled.
    • Fix lovr.graphics.newModel to support empty GLB models.
    • Fix lovr.graphics.newModel to support models without any vertices.
    • Fix bitangent sign in TangentMatrix builtin.
    • Fix shader #includes to error when including a file that doesn't exist.
    • Fix lovr.quit to not get called twice when canceling quit.
    • Fix GPU error when texture had only transfer usage.
    • Fix rare crash when calling vector methods.
    • Fix Model:getMesh.
  4. v0.17.0Tritium Gourmet2023-10-15 · 2023-10-15 03:07 UTC
    查看更新说明

    Add

    General

    • Add enet plugin.
    • Add http plugin.
    • Add utf8 module.
    • Add :type method to all objects and vectors.
    • Add --graphics-debug command line option, which sets t.graphics.debug to true.

    Audio

    • Add lovr.audio.getDevice.

    Data

    • Add Image:mapPixel.
    • Add a variant of Blob:getString that takes a byte range.
    • Add Blob:getI8/getU8/getI16/getU16/getI32/getU32/getF32/getF64.

    Filesystem

    • Add argument to lovr.filesystem.load to restrict chunks to text/binary.

    Graphics

    • Add Pass:roundrect.
    • Add variant of Pass:cone that takes two vec3 endpoints.
    • Add variant of Pass:draw that takes a Texture.
    • Add Pass:setViewCull to enable frustum culling.
    • Add Model:getBlendShapeWeight, and Model:setBlendShapeWeight.
    • Add Model(Data):getBlendShapeCount, Model(Data):getBlendShapeName.
    • Add support for animated blend shape weights in Model animations.
    • Add support for arrays, nested structs, and field names to Buffer formats.
    • Add Shader:getBufferFormat.
    • Add back Mesh object (sorry!).
    • Add Model:clone.
    • Add materials flag to lovr.graphics.newModel.
    • Add lovr.graphics.isInitialized (mostly internal).
    • Add support for using depth textures in multisampled render passes.
    • Add depthResolve feature to lovr.graphics.getFeatures.
    • Add a variant of Texture:newView that creates a 2D slice of a layer/mipmap of a texture.
    • Add a variant of Pass:send that takes tables for uniform buffers.
    • Add Buffer:getData and Buffer:newReadback.
    • Add Texture:getPixels/setPixels/clear/newReadback/generateMipmaps.
    • Add support for stepping through shaders in e.g. RenderDoc when t.graphics.debug is set.
    • Add lovr.graphics.is/setTimingEnabled to record GPU durations for each Pass object.
    • Add lovr.graphics.newPass.
    • Add Pass:setCanvas and Pass:setClear.
    • Add Pass:getStats.
    • Add Pass:reset.
    • Add Pass:getScissor and Pass:getViewport.
    • Add Pass:barrier.
    • Add Pass:beginTally/finishTally and Pass:get/setTallyBuffer.
    • Add support for #include in shader code.

    Headset

    • Add lovr.headset.getPassthrough/setPassthrough/getPassthroughModes.
    • Add support for more headsets in Android APKs (Quest, Pico, Vive Focus all work).
    • Add support for controller input on Pico Neo 3 and Pico Neo 4 devices.
    • Add support for controller input on Magic Leap 2.
    • Add hand/*/pinch, hand/*/poke, and hand/*/grip Devices.
    • Add support for using lovr.headset when lovr.graphics is disabled, on supported runtimes.
    • Add support for elbow/left and elbow/right poses on Ultraleap hand tracking.
    • Add lovr.headset.getDirection.
    • Add lovr.headset.isVisible and lovr.visible callback.
    • Add lovr.recenter callback.
    • Add floor Device.
    • Add t.headset.seated and lovr.headset.isSeated.
    • Add lovr.headset.stopVibration.
    • Add radius fields to joint tables returned by lovr.headset.getSkeleton.
    • Add support for "sprinting" in the headset simulator using the shift key.

    Math

    • Add capitalized globals for creating permanent vectors (Vec2, Vec3, Vec4, Quat, Mat4).
    • Add Vec3:transform, Vec4:transform, and Vec3:rotate.
    • Add vector constants (vec3.up, vec2.one, quat.identity, etc.).
    • Add Mat4:getTranslation/getRotation/getScale/getPose.
    • Add variant of Vec3:set that takes a Quat.
    • Add Mat4:reflect.

    Physics

    • Add TerrainShape.
    • Add World:queryBox and World:querySphere.
    • Add World:getTags.
    • Add Shape:get/setPose.
    • Add missing lovr.physics.newMeshShape function.
    • Add Collider:isDestroyed.

    System

    • Add lovr.system.wasKeyPressed/wasKeyReleased.
    • Add lovr.system.getMouseX, lovr.system.getMouseY, and lovr.system.getMousePosition.
    • Add lovr.system.isMouseDown.
    • Add lovr.mousepressed, lovr.mousereleased, lovr.mousemoved, and lovr.wheelmoved callb
  5. v0.16.0Toad Rage2022-10-16 · 2022-10-16 04:55 UTC
    查看更新说明

    Add:

    • Add ability to run individual Lua files in addition to folders.
    • Add Vulkan renderer.
    • Add capsule, cone, and torus shapes.
    • Add segments option to planes.
    • Add option to draw a single node of a model.
    • Add indirect draws and indirect compute.
    • Add depth clamp and depth offset render states.
    • Add support for configuring "stencil fail" and "depth fail" stencil actions.
    • Add viewport and scissor render states.
    • Add Pass objects for recording rendering work.
    • Add Buffer objects.
    • Add Buffer:getPointer for accessing FFI pointers to GPU memory.
    • Add support for half floats for vertex attributes and buffer data.
    • Add texture views.
    • Add single-pass rendering to multi-layer textures (array, cubemap, 3D).
    • Add r8, rg8, r16, rg16, rgba16, and rgb565 image and texture formats.
    • Add d32fs8 texture format.
    • Add support for BC4, BC5, BC6, and BC7 texture formats.
    • Add support for loading uncompressed formats from DDS and KTX files.
    • Add support for loading KTX2 textures.
    • Add support for loading non-2D textures from image files.
    • Add support for loading DDS and KTX textures in glTF models.
    • Add support for the KHR_texture_transform glTF extension.
    • Add support for loading base64 images from glTF models.
    • Add Sampler objects.
    • Add Tally objects for GPU queries.
    • Add Readback objects for asynchronous GPU readbacks.
    • Add t.graphics.shadercache option to cache compiled shaders to disk.
    • Add lovr.graphics.compileShader and the ability to load shaders from SPIR-V.
    • Add normal default shader.
    • Add Font:getKerning.
    • Add Font:getLines.
    • Add Font:getVertices.
    • Add support for rendering multicolor text.
    • Add Pass:blit, Pass:clear, Pass:copy, Pass:mipmap, and Pass:read for raw GPU transfers.
    • Add lovr.graphics.isFormatSupported and lovr.graphics.getDevice.
    • Add eye/gaze Device.
    • Add t.headset.submitdepth flag to submit depth buffers to the OpenXR runtime.
    • Add t.headset.overlay conf.lua flag to run as an OpenXR overlay.
    • Add support for keyboard device pose on Oculus Quest.
    • Add support for reading hand tracking pinch strength (it's mapped to trigger).
    • Add thumbrest DeviceButton.
    • Add OpenXR support for a, b, x, and y DeviceButtons.
    • Add OpenXR support for hand/left/point and hand/right/point Devices.
    • Add OpenXR support for Windows Mixed Reality controllers.
    • Add OpenXR support for Oculus Quest hand tracking models via lovr.headset.newModel.
    • Add OpenXR support for Vive tracker devices.
    • Add OpenXR support for lovr.headset.getDisplayFrequency.
    • Add lovr.headset.setDisplayFrequency and lovr.headset.getDisplayFrequencies.
    • Add lovr.headset.isFocused.
    • Add lovr.headset.getDeltaTime.
    • Add support for passing vec2s as scale arguments.
    • Add support for passing numbers when calling functions on vectors.
    • Add functions to ModelData (it didn't have any before, now it has lots).
    • Add bounding sphere to Model and ModelData.
    • Add ability to procedurally animate model node scales.
    • Add Model:getMetadata to return raw JSON from glTF models.
    • Add Rasterizer:getWidth, Rasterizer:getDimensions, and Rasterizer:getBoundingBox.
    • Add Rasterizer:getKerning and Rasterizer:getBearing.
    • Add Rasterizer:getCurves.
    • Add Rasterizer:newImage.
    • Add Vec2:angle, Vec3:angle, and Vec4:angle.
    • Add Vec2:equals, Vec3:equals, Vec4:equals, Quat:equals, and Mat4:equals.
    • Add Sound:getCapacity and Sound:getByteStride.
    • Add Source:get/setPitch.
    • Add Source:isSpatial and spatial flag to lovr.audio.newSource.
    • Add macOS support for requesting the audiocapture Permission with lovr.system.requestPermission.
    • Add World:getContacts.
    • Add World:get/setStepCount.
    • Add lovr.system.isKeyDown.

    Change:

    • Change default headset driver to OpenXR.
    • Change lovr.headset.getSkeleton to also return joint r

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    LÖVR

    A simple Lua framework for rapidly building 3D games and VR experiences.

    Build Version Matrix Discord

    Homepage | Documentation | FAQ

    Features

    • Cross-Platform - Runs on Windows, macOS, Linux, and Android.
    • Cross-Device - Supports any headset that works with OpenXR, and has a keyboard/mouse VR simulator.
    • Beginner-friendly - Simple scenes can be created in just a few lines of Lua.
    • Fast - Written in C11 and scripted with LuaJIT, includes optimized single-pass stereo rendering.
    • Tiny - The whole framework is just a couple of megabytes, and it's easy to disable/remove modules.
    • Powerful GPU APIs - Compute shaders, ray tracing, indirect rendering, atomics, and more.
    • Asset Import - Supports glTF models, skeletal animation, compressed textures, cubemaps, fonts, etc.
    • 3D Rigid Body Physics - Includes JoltPhysics, with 7 collider shapes and 6 types of joints.
    • Spatialized Audio - Uses SteamAudio for audio spatialization, with HRTFs, audio meshes, and reverb.
    • Vector Library - Built-in 3D vectors, quaternions, and matrices.

    Getting Started

    It's really easy to get started making things with LÖVR. Grab a copy of the executable from https://lovr.org/downloads, then write a main.lua script and drag it onto the executable. Here are some example projects to try:

    Hello World
    function lovr.draw(pass)
      pass:text('Hello World!', 0, 1.7, -3, .5)
    end
    
    Spinning Cube
    function lovr.draw(pass)
      pass:cube(0, 1.7, -1, .5, lovr.timer.getTime())
    end
    
    Hand Tracking
    function lovr.draw(pass)
      for _, hand in ipairs(lovr.headset.getHands()) do
        pass:sphere(vec3(lovr.headset.getPosition(hand)), .1)
      end
    end
    
    3D Models
    function lovr.load()
      model = lovr.graphics.newModel('model.gltf')
    end
    
    function lovr.draw(pass)
      pass:draw(model, x, y, z)
    end
    

    More examples are on the docs page.

    Building

    You can build LÖVR from source using CMake. Here are the steps using the command line:

    mkdir build
    cd build
    cmake ..
    cmake --build .
    

    See the Compiling Guide for more info.

    Testing

    Tests can be found in the test/lovr directory.

    You can run all of LÖVR tests from the command line with the following:

    ./build/bin/lovr test
    

    To run tests for a single module, pass the name of the module as an argument (e.g. this runs the tests for the data module):

    ./build/bin/lovr test data
    

    Resources

    • Documentation: Guides, tutorials, examples, and API documentation.
    • FAQ: Frequently Asked Questions.
    • Matrix: The LÖVR community for discussion and support.
    • Nightly Builds: Nightly builds for Windows.
    • Compiling Guide: Information on compiling LÖVR from source.
    • Contributing: Guide for helping out with development 💜
    • LÖVE: LÖVR is heavily inspired by LÖVE, a 2D game framework.

    License

    MIT, see LICENSE for details.