-
Notifications
You must be signed in to change notification settings - Fork 137
VR Developer Notes
Alan Tse edited this page Apr 18, 2024
·
10 revisions
- Use
Advanced -> Dump Shadersto dump all shaders for Flat/VR on startup. It will end up indata\ShaderDump. - Use 3dmigitos decompiler on all the .bin shaders to get hlsl. We have a script
Skyrim_Disassemble_Shadersthat we haven't posted yet that will crawl all of the bin files. (ask on discord) - Check cbuffers vs flat. Same size should be fine. Search this regex (VSCode escaped) in VR will identify eyeIndex based buffers.
cb[0-9]+\[([^\]]+\+)+\w+\]. Compare against flat files for same cb (non regex). For example,
//FLAT
r1.xyzw = float4(0,0,0,1) * cb12[8].wwww;
//VR
r2.xyzw = cb12[r0.z+16].wwww * float4(0,0,0,1);These are essentially the same buffer access of cb12. The addition order doesn't matter, and the additional index of r0.z is basically eyeIndex. The offset of + 16 shows that the variable at packoffset(c8) in flat is actually packoffset(c16) in VR. This is due to the fact we're in a set of arrays that use eyeIndex. Specifically https://github.com/doodlum/skyrim-community-shaders/blob/dev/package/Shaders/Common/FrameBuffer.hlsl#L6.
- On identifying eyeIndex based cbuffers, edit the flat hlsl to now use the eyeIndex.
- Fix stereoUV coords. VR renders both left and right eye at the same time vs flat which is a single eye. So certain coords in flat UV space may need to be converted to stereoUV.
Depthtextureis a prime example.
VR disabled SSR. It can be forced enable at PostPostLoad with:
if (REL::Module::IsVR()) {
std::map<std::string, uintptr_t> hiddenVRCubeMapSettings{
{ "bScreenSpaceReflectionEnabled:Display", 0x1ED5BC0 },
};
for (const auto& settingPair : hiddenVRCubeMapSettings) {
const auto& settingName = settingPair.first;
const auto address = REL::Offset{ settingPair.second }.address();
bool* setting = reinterpret_cast<bool*>(address);
if (!*setting) {
logger::info("[PostPostLoad] Changing {} from {} to {} to support Dynamic Cubemaps", settingName, *setting, true);
*setting = true;
}
}
}However, as implemented in VR it is currently broken and will float up and down with HMD movement.