diff --git a/zeno/src/nodes/mtl/ShaderAttrs.cpp b/zeno/src/nodes/mtl/ShaderAttrs.cpp index 8b9caefdf3..e7698f805f 100644 --- a/zeno/src/nodes/mtl/ShaderAttrs.cpp +++ b/zeno/src/nodes/mtl/ShaderAttrs.cpp @@ -33,8 +33,8 @@ struct ShaderInputAttr : ShaderNodeClone { ZENDEFNODE(ShaderInputAttr, { { - {"enum pos clr nrm uv tang bitang NoL LoV N T L V H reflectance fresnel instPos instNrm instUv instClr instTang prd.rndf() attrs.localPosLazy() attrs.uniformPosLazy() rayLength worldNrm worldTan worldBTn camFront camUp camRight", "attr", "pos"}, - {"enum float vec2 vec3 vec4", "type", "vec3"}, + {"enum pos clr nrm uv tang bitang NoL LoV N T L V H reflectance fresnel instPos instNrm instUv instClr instTang prd.rndf() attrs.localPosLazy() attrs.uniformPosLazy() rayLength isShadowRay worldNrm worldTan worldBTn camFront camUp camRight", "attr", "pos"}, + {"enum float vec2 vec3 vec4 bool", "type", "vec3"}, }, { {"shader", "out"}, diff --git a/zenovis/xinxinoptix/CallableDefault.cu b/zenovis/xinxinoptix/CallableDefault.cu index 088c05873b..7b6fc8c4f4 100644 --- a/zenovis/xinxinoptix/CallableDefault.cu +++ b/zenovis/xinxinoptix/CallableDefault.cu @@ -24,7 +24,7 @@ extern "C" __device__ MatOutput __direct_callable__evalmat(cudaTextureObject_t z auto att_instTang = attrs.instTang; auto att_rayLength = attrs.rayLength; - + auto att_isShadowRay = attrs.isShadowRay ? 1.0f:0.0f; vec3 b = normalize(cross(attrs.T, attrs.N)); vec3 t = normalize(cross(attrs.N, b)); diff --git a/zenovis/xinxinoptix/DeflMatShader.cu b/zenovis/xinxinoptix/DeflMatShader.cu index 4750b192ca..14da41c4c9 100644 --- a/zenovis/xinxinoptix/DeflMatShader.cu +++ b/zenovis/xinxinoptix/DeflMatShader.cu @@ -157,6 +157,7 @@ extern "C" __global__ void __anyhit__shadow_cutout() #endif attrs.pos = attrs.pos + vec3(params.cam.eye); + attrs.isShadowRay = true; //MatOutput mats = evalMaterial(rt_data->textures, rt_data->uniforms, attrs); MatOutput mats = optixDirectCall( rt_data->dc_index, rt_data->textures, rt_data->uniforms, attrs ); @@ -438,6 +439,7 @@ extern "C" __global__ void __closesthit__radiance() attrs.T = attrs.tang; } attrs.V = -(ray_dir); + attrs.isShadowRay = false; //MatOutput mats = evalMaterial(rt_data->textures, rt_data->uniforms, attrs); MatOutput mats = optixDirectCall( rt_data->dc_index, rt_data->textures, rt_data->uniforms, attrs ); prd->mask_value = mats.mask_value; diff --git a/zenovis/xinxinoptix/IOMat.h b/zenovis/xinxinoptix/IOMat.h index 89b427c415..116a5d9396 100644 --- a/zenovis/xinxinoptix/IOMat.h +++ b/zenovis/xinxinoptix/IOMat.h @@ -66,7 +66,10 @@ struct MatInput { vec3 instTang; float NoL; float LoV; + float rayLength; + bool isShadowRay; + vec3 reflectance; vec3 N; vec3 T;