From 0c982b9496e27e77b64be4ad5edc68767d55db4c Mon Sep 17 00:00:00 2001 From: teachmain Date: Thu, 19 Oct 2023 15:03:33 +0800 Subject: [PATCH] trans param update --- zeno/src/nodes/mtl/ShaderFinalize.cpp | 6 +++--- zenovis/xinxinoptix/DeflMatShader.cu | 6 +++--- zenovis/xinxinoptix/IOMat.h | 2 +- zenovis/xinxinoptix/PTKernel.cu | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zeno/src/nodes/mtl/ShaderFinalize.cpp b/zeno/src/nodes/mtl/ShaderFinalize.cpp index bc76860a2e..e25749a4fc 100644 --- a/zeno/src/nodes/mtl/ShaderFinalize.cpp +++ b/zeno/src/nodes/mtl/ShaderFinalize.cpp @@ -57,7 +57,7 @@ struct ShaderFinalize : INode { {3, "mat_transColor"}, {3, "mat_transTint"}, {1, "mat_transTintDepth"}, - {1, "mat_clarity"}, + {1, "mat_transDistance"}, {3, "mat_transScatterColor"}, {1, "mat_ior"}, @@ -110,7 +110,7 @@ struct ShaderFinalize : INode { get_input("transColor", std::make_shared(vec3f(1.0f))), get_input("transTint", std::make_shared(vec3f(1.0f))), get_input("transTintDepth", std::make_shared(float(1.0f))), - get_input("clarity", std::make_shared(float(1.0f))), + get_input("transDistance", std::make_shared(float(1.0f))), get_input("transScatterColor", std::make_shared(vec3f(1.0f))), get_input("ior", std::make_shared(float(1.5f))), @@ -280,7 +280,7 @@ ZENDEFNODE(ShaderFinalize, { {"vec3f", "transColor", "1.0,1.0,1.0"}, {"vec3f", "transTint", "1.0,1.0,1.0"}, {"float", "transTintDepth", "0.0"}, - {"float", "clarity", "1.0"}, + {"float", "transDistance", "10.0"}, {"vec3f", "transScatterColor", "1.0,1.0,1.0"}, {"float", "ior", "1.5"}, diff --git a/zenovis/xinxinoptix/DeflMatShader.cu b/zenovis/xinxinoptix/DeflMatShader.cu index 28da0a50ae..8a9f79413d 100644 --- a/zenovis/xinxinoptix/DeflMatShader.cu +++ b/zenovis/xinxinoptix/DeflMatShader.cu @@ -74,7 +74,7 @@ static __inline__ __device__ MatOutput evalMat(cudaTextureObject_t zenotex[], fl vec3 mat_transColor = vec3(1.0f,1.0f,1.0f); vec3 mat_transTint = vec3(1.0f,1.0f,1.0f); float mat_transTintDepth = 0.0f; - float mat_clarity = 0.0f; + float mat_transDistance = 0.0f; vec3 mat_transScatterColor = vec3(1.0f,1.0f,1.0f); float mat_ior = 1.0f; @@ -126,7 +126,7 @@ static __inline__ __device__ MatOutput evalMat(cudaTextureObject_t zenotex[], fl mats.transColor = mat_transColor; mats.transTint = mat_transTint; mats.transTintDepth = max(0.0f,mat_transTintDepth); - mats.clarity = clamp(mat_clarity,0.0f,1.0f); + mats.transDistance = max(mat_transDistance,0.1f); mats.transScatterColor = mat_transScatterColor; mats.ior = max(0.0f,mat_ior); @@ -914,7 +914,7 @@ extern "C" __global__ void __closesthit__radiance() vec3 channelPDF = vec3(1.0f/3.0f); prd->pushMat(extinction); prd->isSS = false; - prd->scatterDistance = 100.0f * mats.clarity * mats.clarity * mats.clarity; + prd->scatterDistance = mats.transDistance; prd->maxDistance = mats.scatterStep>0.5f? DisneyBSDF::SampleDistance(prd->seed, prd->scatterDistance) : 1e16f; } else { diff --git a/zenovis/xinxinoptix/IOMat.h b/zenovis/xinxinoptix/IOMat.h index 65e5198529..c3e4213981 100644 --- a/zenovis/xinxinoptix/IOMat.h +++ b/zenovis/xinxinoptix/IOMat.h @@ -31,7 +31,7 @@ struct MatOutput { vec3 transColor; vec3 transTint; float transTintDepth; - float clarity; + float transDistance; vec3 transScatterColor; diff --git a/zenovis/xinxinoptix/PTKernel.cu b/zenovis/xinxinoptix/PTKernel.cu index 8a21e9f327..fa0e086eba 100644 --- a/zenovis/xinxinoptix/PTKernel.cu +++ b/zenovis/xinxinoptix/PTKernel.cu @@ -110,7 +110,7 @@ extern "C" __global__ void __raygen__rg() float r0 = r01.x * 2.0f * M_PIf; float r1 = r01.y * aperture * aperture; - r1 = sqrt(r1); + r1 = sqrtf(r1); float3 eye_shake = r1 * ( cosf(r0)* normalize(cam.right) + sinf(r0)* normalize(cam.up)); // Camera local space float3 ray_origin = cam.eye + eye_shake;