Skip to content

Commit

Permalink
Merge branch 'nsubtil/v0.5.3-cherry-picks' into 'release/v0.5'
Browse files Browse the repository at this point in the history
v0.5.3 cherry picks

See merge request lightspeedrtx/dxvk-remix-nv!899
  • Loading branch information
nsubtil committed Jul 16, 2024
2 parents 68ccff0 + 407f424 commit 2c5bd26
Show file tree
Hide file tree
Showing 12 changed files with 608 additions and 180 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

project(
'dxvk', ['c', 'cpp'],
version : 'remix-0.5.2',
version : 'remix-0.5.3',
meson_version : '>= 0.58',
default_options : ['werror=true', 'b_vscrt=from_buildtype']
)
Expand Down
8 changes: 5 additions & 3 deletions public/include/remix/remix.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ namespace remix {
inline remixapi_LightInfoLightShaping defaultLightShaping() {
remixapi_LightInfoLightShaping shaping {};
{
shaping.primaryAxis = { 0.0f, 0.0f, 1.0f };
shaping.direction = { 0.0f, 0.0f, 1.0f };
shaping.coneAngleDegrees = 180.0f;
shaping.coneSoftness = 0.0f;
shaping.focusExponent = 0.0f;
Expand Down Expand Up @@ -585,9 +585,10 @@ namespace remix {
xSize = 1.0f;
yAxis = { 0.0f, 1.0f, 0.0f };
ySize = 1.0f;
direction = { 0.0f, 0.0f, 1.0f };
shaping_hasvalue = false;
shaping_value = detail::defaultLightShaping();
static_assert(sizeof remixapi_LightInfoRectEXT == 88);
static_assert(sizeof remixapi_LightInfoRectEXT == 104);
}

void set_shaping(const std::optional< remixapi_LightInfoLightShaping >& v) {
Expand All @@ -604,9 +605,10 @@ namespace remix {
xRadius = 1.0f;
yAxis = { 0.0f, 1.0f, 0.0f };
yRadius = 1.0f;
direction = { 0.0f, 0.0f, 1.0f };
shaping_hasvalue = false;
shaping_value = detail::defaultLightShaping();
static_assert(sizeof remixapi_LightInfoDiskEXT == 88);
static_assert(sizeof remixapi_LightInfoDiskEXT == 104);
}

void set_shaping(const std::optional< remixapi_LightInfoLightShaping >& v) {
Expand Down
15 changes: 14 additions & 1 deletion public/include/remix/remix_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ extern "C" {


typedef struct remixapi_LightInfoLightShaping {
remixapi_Float3D primaryAxis;
// The direction the Light Shaping is pointing in. Must be normalized.
remixapi_Float3D direction;
float coneAngleDegrees;
float coneSoftness;
float focusExponent;
Expand All @@ -423,10 +424,15 @@ extern "C" {
remixapi_StructType sType;
void* pNext;
remixapi_Float3D position;
// The X axis of the Rect Light. Must be normalized and orthogonal to the Y and direction axes.
remixapi_Float3D xAxis;
float xSize;
// The Y axis of the Rect Light. Must be normalized and orthogonal to the X and direction axes.
remixapi_Float3D yAxis;
float ySize;
// The direction the Rect Light is pointing in, should match the Shaping direction if present.
// Must be normalized and orthogonal to the X and Y axes.
remixapi_Float3D direction;
remixapi_Bool shaping_hasvalue;
remixapi_LightInfoLightShaping shaping_value;
} remixapi_LightInfoRectEXT;
Expand All @@ -435,10 +441,15 @@ extern "C" {
remixapi_StructType sType;
void* pNext;
remixapi_Float3D position;
// The X axis of the Disk Light. Must be normalized and orthogonal to the Y and direction axes.
remixapi_Float3D xAxis;
float xRadius;
// The Y axis of the Disk Light. Must be normalized and orthogonal to the X and direction axes.
remixapi_Float3D yAxis;
float yRadius;
// The direction the Disk Light is pointing in, should match the Shaping direction if present
// Must be normalized and orthogonal to the X and Y axes.
remixapi_Float3D direction;
remixapi_Bool shaping_hasvalue;
remixapi_LightInfoLightShaping shaping_value;
} remixapi_LightInfoDiskEXT;
Expand All @@ -448,13 +459,15 @@ extern "C" {
void* pNext;
remixapi_Float3D position;
float radius;
// The "center" axis of the Cylinder Light. Must be normalized.
remixapi_Float3D axis;
float axisLength;
} remixapi_LightInfoCylinderEXT;

typedef struct remixapi_LightInfoDistantEXT {
remixapi_StructType sType;
void* pNext;
// The direction the Distant Light is pointing in. Must be normalized.
remixapi_Float3D direction;
float angularDiameterDegrees;
} remixapi_LightInfoDistantEXT;
Expand Down
4 changes: 2 additions & 2 deletions src/dxvk/rtx_render/rtx_game_capturer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ namespace dxvk {
sphereLight.coneAngleDegrees = std::acos(shaping.getCosConeAngle()) * kRadiansToDegrees;
sphereLight.coneSoftness = shaping.getConeSoftness();
sphereLight.focusExponent = shaping.getFocusExponent();
rotation = pxr::GfRotation(-pxr::GfVec3d::ZAxis(), pxr::GfVec3f(&shaping.getPrimaryAxis()[0]));
rotation = pxr::GfRotation(-pxr::GfVec3d::ZAxis(), pxr::GfVec3f(&shaping.getDirection()[0]));
}
Logger::debug("[GameCapturer][" + m_pCap->idStr + "][SphereLight:" + name + "] New");
}
Expand All @@ -385,7 +385,7 @@ namespace dxvk {
distantLight.color[2] = colorAndIntensity.b;
distantLight.intensity = colorAndIntensity.w;
distantLight.angleDegrees = rtLight.getHalfAngle() * 2.0 * kRadiansToDegrees;
distantLight.direction = -pxr::GfVec3f(rtLight.getDirection().data);
distantLight.direction = pxr::GfVec3f(rtLight.getDirection().data);
distantLight.firstTime = m_pCap->currentFrameNum;
Logger::debug("[GameCapturer][" + m_pCap->idStr + "][DistantLight:" + name + "] New");
}
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/rtx_render/rtx_light_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ namespace dxvk {
}

if (aShaping.getEnabled() && bShaping.getEnabled()) {
const float cosAxis = dot(aShaping.getPrimaryAxis(), bShaping.getPrimaryAxis());
const float cosAxis = dot(aShaping.getDirection(), bShaping.getDirection());
if (cosAxis < kCosAngleSimilarityThreshold) {
return kNotSimilar;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/rtx_render/rtx_light_manager_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ namespace dxvk {
if (pShaping) {
if (pShaping->getEnabled()) {
ImGui::Text("Light Shaping: Enabled");
ImGui::Text("\tPrimary Axis: %.2f %.2f %.2f", pShaping->getPrimaryAxis().x, pShaping->getPrimaryAxis().y, pShaping->getPrimaryAxis().z);
ImGui::Text("\tDirection: %.2f %.2f %.2f", pShaping->getDirection().x, pShaping->getDirection().y, pShaping->getDirection().z);
ImGui::Text("\tCone Angle: %.2f deg", std::acos(pShaping->getCosConeAngle()) * kRadiansToDegrees);
ImGui::Text("\tCone Softness: %.2f", pShaping->getConeSoftness());
ImGui::Text("\tFocus Exponent: %.2f", pShaping->getFocusExponent());
Expand Down
Loading

0 comments on commit 2c5bd26

Please sign in to comment.