Experimental rendering functionality

Discussion in 'Programming' started by dompurified, Feb 14, 2024.

  1. dompurified

    dompurified
    Expand Collapse

    Joined:
    Feb 14, 2024
    Messages:
    7
    hello people, i've recently gotten into beamng, but one of the features that interested me the most was the replay (and camera path, and script ai, etc.) system(s). yet one key feature i found missing that really sparked my attention was no rendering functionality.
    i've gotten a few (just 2 lmao) ideas:
    1) make an in-game mod to render using the game's already built rendering-pipeline
    2) make an external "mod" to "hook" directx's functionality, something similiar to reshade, except entirely different from reshade - e.g. frame pacing, where my idea was instead of skipping frames, they would be delayed and each "screenshotted" (just put into a color buffer array/vector) individually, and then put together by my program, to construct a video

    (in my opinion, option 2 would be more viable)

    what do y'all think about this?
    i've got (i'd say) a decent programming background, but i'm not really advanced in beamng modding, so i'm asking here whether this is something viable or i should just stick with obs + pray my game doesn't lag in the middle of recording

    OR if you have another idea, tell me, as all this is right now is just a theoretical thing i could do

    thanks to anyone interested
     
  2. daniel-w

    daniel-w
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 28, 2017
    Messages:
    282
    There's definitely a way to do it in-game, there has to be... There's a few functions for the render views, you've got FFI, there's functions like getBytesPerPixel (not used), etc..
    Still though, hooking will work just fine and will be faster than if you were to do it in Lua. I would maybe look at hooking Vulkan instead though since it's quite stable now and it will be the default option after it's all done and users are happy with it. I do have the hooking code if you would like it, but it's for Alien Isolation, not this. Still though, should be simple enough to port over since it's also using DX11
     
  3. dompurified

    dompurified
    Expand Collapse

    Joined:
    Feb 14, 2024
    Messages:
    7
    i think i'd just take the hooking approach rather than in-game, since as you said faster, and i have more experience with it
    i will look into vulkan, but i haven't really used it yet. i've done directx hooking and standalone directx development. vulkan does seem interesting so i will look into it later.
     
    #3 dompurified, Feb 17, 2024
    Last edited: Feb 23, 2024
  4. dompurified

    dompurified
    Expand Collapse

    Joined:
    Feb 14, 2024
    Messages:
    7
    ok so i found out that the base game does something similiar to this when saving car presets through save & load in vehicle customization. you can see the previews flashing when you save a vehicle.
    i'm thinking i could either recreate this or "call the base-game function" (of course it'll probably involve more steps but i don't know how to word this). this could also maybe ensure cross-renderer compatibility (e.g. both vulkan and directx), at least i think
     
  5. daniel-w

    daniel-w
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 28, 2017
    Messages:
    282
    I think the last I checked, the takeScreenshot or whatever it was called is a private function, not exposed to the public Lua API. And it's probably not very fast compared to simply hooking the renderer and capturing the data there. And either way, if your end goal is to simply just have a smooth video, just make a suggestion for the developers to implement this.

    Actually.. I'm sure there's a way to record stuff in-game since there's a replays button (or was). Look around for that, it might have what you need. If not, then I honestly recommend just asking the developers to implement it. Teardown does this, it captures all the frames and saves them to an output directory, and then you can use ffmpeg to convert that to a video. It also captures the audio
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice