Skip to content

Commit

Permalink
Review Improvements
Browse files Browse the repository at this point in the history
- Moved debug data to Sky Settings
- Improved consistency of Delta
- Made skyscale actually default to the set scale before any formulas are applied on camera cuts
- Added myself to the credits!
  • Loading branch information
KingDavidW committed May 14, 2024
1 parent 4810679 commit a0f2abd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/dxvk/imgui/dxvk_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1445,10 +1445,6 @@ namespace dxvk {
if (c) {
ImGui::Text("Position: %.2f %.2f %.2f", c->getPosition().x, c->getPosition().y, c->getPosition().z);
ImGui::Text("Direction: %.2f %.2f %.2f", c->getDirection().x, c->getDirection().y, c->getDirection().z);
if (c->m_type == CameraType::Sky) {
ImGui::Text("Sky Offset: %.2f %.2f %.2f", c->m_skyOffset.x, c->m_skyOffset.y, c->m_skyOffset.z);
ImGui::Text("Sky Scale: %i", c->m_skyScale);
}
ImGui::Text("Vertical FOV: %.1f", c->getFov() * kRadiansToDegrees);
ImGui::Text("Near / Far plane: %.1f / %.1f", c->getNearPlane(), c->getFarPlane());
ImGui::Text(c->isLHS() ? "Left-handed" : "Right-handed");
Expand Down Expand Up @@ -2231,14 +2227,21 @@ namespace dxvk {

if (ImGui::CollapsingHeader("3D Skybox Settings [Experimental]", collapsingHeaderClosedFlags)) {
ImGui::Checkbox("Enable Shared Depth", &RtxOptions::skySharedDepthObject());
ImGui::Separator();
ImGui::Checkbox("Enable 3D Skybox Pathtracing ", &RtxOptions::skyBoxPathTracingObject());

if (RtxOptions::skyBoxPathTracing()) {
ImGui::InputInt("Default Scale", &RtxOptions::Get()->skyDefaultScaleObject(), 1, 1, 1);

SkyScaleCalibrationModeCombo.getKey(&RtxOptions::Get()->skyScaleCalibrationModeObject());
SkyScaleOffsetFormulaCombo.getKey(&RtxOptions::Get()->skyScaleOffsetFormulaObject());

ImGui::Separator();
auto& cameraManager = ctx->getCommonObjects()->getSceneManager().getCameraManager();
auto cam = cameraManager.isCameraValid(CameraType::Sky) ? &cameraManager.getCamera(CameraType::Sky) : nullptr;
if (cam){
ImGui::Text("Sky Offset: %.2f %.2f %.2f", cam->m_skyOffset.x, cam->m_skyOffset.y, cam->m_skyOffset.z);
ImGui::Text("Sky Scale: %i", cam->m_skyScale);
}
ImGui::Separator();
}

};
Expand Down
1 change: 1 addition & 0 deletions src/dxvk/imgui/dxvk_imgui_about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace dxvk {
"Friedrich 'pixelcluster' Vock",
"Dayton 'watbulb'",
"Ethan 'Xenthio' Cardwell",
"David 'King David' Wiltos",
}},
{ "Engineering",
{ "Riley Alston",
Expand Down
9 changes: 7 additions & 2 deletions src/dxvk/rtx_render/rtx_camera_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ namespace dxvk {

if (shouldCalculateSkyScale) {

// Fallback to the default scale if the camera is odd, but let the formula work after
if (isCameraCut)
skyCamera.setSkyScale(RtxOptions::Get()->skyDefaultScale());

auto curCamPos = (Vector3) mainCamera.getPosition(false);
auto curSkyPos = (Vector3) skyCamera.getPosition(false);
auto lastCamPos = (Vector3) inverse(mainCamera.getPreviousWorldToView(false))[3].xyz();;
Expand All @@ -278,11 +282,12 @@ namespace dxvk {
skyCamera.setSkyScale(RtxOptions::Get()->skyDefaultScale());
break;
case SkyScaleCalibrationMode::DeltaAutomatic:
if (!areClose(curSkyPos, lastSkyPos)) {
if (!areClose(curSkyPos, lastSkyPos) && !areClose(curCamPos, lastCamPos)) {

float mdiff = lengthSqr(curCamPos - lastCamPos);
float sdiff = lengthSqr(curSkyPos - lastSkyPos);

if (sdiff != 0) {
if (sdiff != 0 && mdiff != 0) {
float ratio_scale = mdiff / sdiff;
int new_scale = ratio_scale >= 1 ? static_cast<int>(std::sqrt(ratio_scale)) : skyCamera.m_lastSkyScale;
skyCamera.setSkyScale(new_scale);
Expand Down

0 comments on commit a0f2abd

Please sign in to comment.