Coder Social home page Coder Social logo

ref_vk's Introduction

Vulkan Renderer Library for Yamagi Quake II

This is the vkQuake2 vulkan renderer library ported to Yamagi Quake II.

Compilation

You'll need:

  • clang or gcc,
  • GNU Make,
  • SDL2 with sdl2-config,
  • vulkan-headers,
  • vulkan-validationlayers if you like to debug issues.

For vulkan-headers on macOS with Homebrew: brew install molten-vk.

Type make to compile the library. If the compilation is successfull, the library can be found under release/ref_vk.dll (Windows) or release/ref_vk.so (unixoid systems).

Usage

Copy the library next to your Yamagi Quake II executable. You can select Vulkan through the video menu or by cvar with vid_renderer vk followed by a vid_restart.

If you have run into issues, please attach output logs with OS/driver version and device name to the bug report. List of currently tested devices for the reference.

Note: Game saves outputs to Documents\YamagiQ2\stdout.txt under Windows.

On macOS it is necessary to set DYLD_LIBRARY_PATH to load the Vulkan Portability library:

export DYLD_LIBRARY_PATH=/opt/homebrew/opt/molten-vk/lib

Console Variables

  • r_validation: Toggle validation layers:

    • 0 - disabled (default in Release)
    • 1 - only errors and warnings, show image load issues
    • 2 - best-practices validation
  • vk_strings: Print some basic Vulkan/GPU information.

  • vk_mem: Print dynamic vertex/index/uniform/triangle fan buffer memory usage statistics.

  • vk_device: Specify index of the preferred Vulkan device on systems with multiple GPUs:

    • -1 - prefer first DISCRETE_GPU (default)
    • 0..n - use device #n (full list of devices is returned by vk_strings command)
  • vk_sampleshading: Toggle sample shading for MSAA. (default: 1)

  • vk_flashblend: Toggle the blending of lights onto the environment. (default: 0)

  • r_polyblend: Blend fullscreen effects: blood, powerups etc. (default: 1)

  • vk_skymip: Toggle the usage of mipmap information for the sky graphics. (default: 0)

  • vk_finish: Inserts a vkDeviceWaitIdle() call on frame render start (default: 0). Don't use this, it's there just for the sake of having a gl_finish equivalent!

  • vk_custom_particles: Toggle particles type:

    • 0 - textured triangles for particle rendering
    • 1 - between using POINT_LIST (default)
    • 2 - textured square for particle rendering
  • vk_particle_size: Rendered particle size. (default: 40)

  • vk_particle_att_a: Intensity of the particle A attribute. (default: 0.01)

  • vk_particle_att_b: Intensity of the particle B attribute. (default: 0)

  • vk_particle_att_c: Intensity of the particle C attribute. (default: 0.01)

  • vk_particle_min_size: The minimum size of a rendered particle. (default: 2)

  • vk_particle_max_size: The maximum size of a rendered particle. (default: 40)

  • vk_picmip: Shrink factor for the textures. (default: 0)

  • vk_pixel_size: Pixel size when rendering the world, used to simulate lower screen resolutions. The value represents the length, in pixels, of the side of each pixel block. For example, with size 2 pixels are 2x2 squares, and at 1600x1200 the image is effectively an upscaled 800x600 image. (default: 1)

  • vk_dynamic: Use dynamic lighting. (default: 1)

  • vk_showtris: Display mesh triangles. (default: 0)

  • r_lightmap: Display lightmaps. (default: 0)

  • vk_postprocess: Toggle additional color/gamma correction. (default: 1)

  • vk_mip_nearfilter: Use nearest-neighbor filtering for mipmaps. (default: 0)

  • vk_texturemode: Change current texture filtering mode:

    • VK_NEAREST - nearest-neighbor interpolation, no mipmaps
    • VK_LINEAR - linear interpolation, no mipmaps
    • VK_MIPMAP_NEAREST - nearest-neighbor interpolation with mipmaps
    • VK_MIPMAP_LINEAR - linear interpolation with mipmaps (default)
  • vk_lmaptexturemode: Same as vk_texturemode but applied to lightmap textures.

  • vk_underwater: Warp the scene if underwater. Set to 0 to disable the effect. Defaults to 1.

Console Variables (macOS)

  • vk_molten_metalbuffers: enable/disable Metal buffers to bind textures more efficiently (>= Big Sur). (default: 0)

  • vk_molten_fastmath: enable/disable float point op optimisations. (default: 0)

Custom model format support

Render unofficially supports mdl/Quake 1, dkm/Daikatana and fm/Heretic2, are provided without any warranty of support. The simplest way to check is renaming the mdl/dkm/fm format file to md2 and place instead the original tris.md2 file. FM is rendered with all meshes without support of filtering/selecting the exact part of the model.

ReRelease Support

Use Yamagi Quake II ReRelease version with 2023 Quake ReRelease version.

ref_vk's People

Contributors

0lvin avatar benbeshara avatar braxi avatar danielgibson avatar devnexen avatar dsvensson avatar hbokh avatar maraakate avatar rodrigomedeirosrs avatar spirrwell avatar yamagi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ref_vk's Issues

ref_vk.so has incompatible api_version 0

Hi,

I just compiled it on my Fedora 37 and when i try to use it i get this error:

]vid_renderer vk

]/vid_restart
----- refresher initialization -----
Loading library: ref_vk.so
Byte ordering: little endian

Cmd_RemoveCommand: vk_strings not added
Cmd_RemoveCommand: vk_mem not added
Cmd_RemoveCommand: imagelist not added
Cmd_RemoveCommand: screenshot not added
Cmd_RemoveCommand: modellist not added
ref_vk.so has incompatible api_version 0!
Retrying with gl3...

Any idea what might be the problem?

Port the GL3 lighting calculations to Vulkan

The GL3 renderer calculates the dynamic lightning through shaders on a per pixel base. GL1 and Vulkan calculate it on the CPU by manipulation the low resolution lightmaps an reuploading them afterwards. It would be nice if someone with Vulkan knowledge could port the shader base approach from GL3 to Vulkan since it gives a much better visual experience.

Some informations about dynamic light calculations in GL1 can be found in Fabien Sanglards Quake II source code review: https://fabiensanglard.net/quake2/index.php

Vulkan: game freezes if new game is selected right after launch

If I launch 'The Reckoning' with Vulkan renderer (latest ref_vk) and try to start new game, application becomes unresponsive. Workaround: select OpenGL, start the game, then switch to Vulkan. Even if I select new game again after this, it starts fine. So the freeze only happens if application is started with Vulkan and then I try to start new game right after that. This only happens in this mod, original game and rogue work fine.

Windows binary releases

I definitely want to do binary releases for Windows and source releases for Linux. The big question is how we want to implement them. I see at least two ways:

  • Do it the same way as the addons: A source a release for Linux and ship a binary with the Windows binary bundle. This would be the easiest way for Windows users, because it's still one integrated bundle for them. Linux maintainers can build upon the addons, it would be more or less the same with another source archive.
  • Use Github releases: Tag releases in this repository, attach the Windows ref_vk.dll to it. The big advantage is, that we can do Vulkan releases detached from the YQ2 release cycle and ship Windows binaries without complete test builds. The disadvantage is, that the user must download the Windows binary bundle and additionally the ref_vk.dll if they want to use Vulkan.

Any comments?

VK_ERROR_OUT_OF_DEVICE_MEMORY error upon launch on linux

OS: Arch Linux x86_64
Kernel: 6.0.5-x64v2-xanmod1-1
CPU: Intel i7-10750H (12) @ 5.000GHz
GPU: NVIDIA GeForce RTX 2060 Mobile

Building and using the latest commit of this repo results in a segfault before even properly launching the game on my machine. However, whenever I build and use release 1.02 from June 13th it works just fine.
Screenshot_20221207_191655

GUI/Model texture is upscaled in vulkan

build:
8.00pre

steps:
vid_renderer vk
vid_restart
vk_texturemode vk_nearest

actual:
looks like texture size is larger, it's resampled
(i'm using the arrow as a crosshair)
image

"high quality resize" engaged when it shouldn't
image

expected:
looks same as when using gl1, gl3 or soft
image

cinematic looks properly (pixelated)
image

device:
windows 1909
rog strix x470-f gaming
gtx1060-6gb

Exclusive fullscreen and adaptive V-Sync only with in-game V-Sync on

I tested running the game with the G-Sync indicator enabled just to check and noticed that it wasn't being activated, so then I tried manipulating the system sound volume and sure enough the game wasn't running in exclusive fullscreen.

From experience I know some APIs have the workaround to enable V-Sync in the software, and confirmed, then it showed G-Sync being enabled and no volume indicator showed up anymore, confirming exclusive fullscreen.

This however means that you can't combine the API with V-Sync from the driver (Nvidia Control Panel), which supposedly is more optimized for use in combination with G-Sync.

With all of that out of the way, I really appreciate this project, so thank you.

High CPU and GPU usage

The Vulkan renderer seems to peg one of the CPU cores and the fans and temperature on my GPU ramp up too compared to the OpenGL one. Quake II shouldn't be this demanding.

Player doesn't walk towards the crosshair

For some reason, in my game the player doesn't walk towards the crosshair (center of screen) but dog tracks off to the side.
This might not be limited to this port, and this could be a Windows 11 bug.

https://i.imgur.com/HtWhW8Z.png

But when I walk I go to the left like there's an invisible wall.
Sometimes, if I move the mouse a bit it fixes it, but this really screws up the game.

Running the game at 500 fps, but also does it at lower FPS values.
Windows 11 Dev 22509.1011
AMD 5700XT - 22.1.2 driver (Latest)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.