Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isShadowRay #1989

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading