Skip to content

Commit

Permalink
trans param update
Browse files Browse the repository at this point in the history
  • Loading branch information
teachmain committed Oct 19, 2023
1 parent 8e13c0b commit 0c982b9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions zeno/src/nodes/mtl/ShaderFinalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"},

Expand Down Expand Up @@ -110,7 +110,7 @@ struct ShaderFinalize : INode {
get_input<IObject>("transColor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("transTint", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("transTintDepth", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("clarity", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("transDistance", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("transScatterColor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("ior", std::make_shared<NumericObject>(float(1.5f))),

Expand Down Expand Up @@ -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"},

Expand Down
6 changes: 3 additions & 3 deletions zenovis/xinxinoptix/DeflMatShader.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion zenovis/xinxinoptix/IOMat.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct MatOutput {
vec3 transColor;
vec3 transTint;
float transTintDepth;
float clarity;
float transDistance;
vec3 transScatterColor;


Expand Down
2 changes: 1 addition & 1 deletion zenovis/xinxinoptix/PTKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0c982b9

Please sign in to comment.