Skip to content

Commit

Permalink
isShadowRay
Browse files Browse the repository at this point in the history
  • Loading branch information
iaomw committed Aug 22, 2024
1 parent 13dcf1b commit 29c67fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions zeno/src/nodes/mtl/ShaderAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ struct ShaderInputAttr : ShaderNodeClone<ShaderInputAttr> {

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"},
Expand Down
2 changes: 1 addition & 1 deletion zenovis/xinxinoptix/CallableDefault.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions zenovis/xinxinoptix/DeflMatShader.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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<MatOutput, cudaTextureObject_t[], float4*, const MatInput&>( rt_data->dc_index, rt_data->textures, rt_data->uniforms, attrs );

Expand Down Expand Up @@ -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<MatOutput, cudaTextureObject_t[], float4*, const MatInput&>( rt_data->dc_index, rt_data->textures, rt_data->uniforms, attrs );
prd->mask_value = mats.mask_value;
Expand Down
3 changes: 3 additions & 0 deletions zenovis/xinxinoptix/IOMat.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ struct MatInput {
vec3 instTang;
float NoL;
float LoV;

float rayLength;
bool isShadowRay;

vec3 reflectance;
vec3 N;
vec3 T;
Expand Down

0 comments on commit 29c67fa

Please sign in to comment.