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

improve optix pipeline cache logic #2011

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 5 additions & 3 deletions zenovis/xinxinoptix/DisneyBRDF.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

namespace BRDFBasics{
static __inline__ __device__
float PowerHeuristic(float a, float b)
float PowerHeuristic(float a, float b, float beta = 2.0f)
{
//float t = a * a;
return b>10.0f*a?(a/(a + b + 1e-6)) : (a*a/(a*a + b*b + 1e-6));
float t = pow(a,beta);
float t2 = pow(b, beta);
return t / (t2 + t + 1e-6);

}
static __inline__ __device__ float fresnel(float cosT){
float v = clamp(1-cosT,0.0f,1.0f);
Expand Down
2 changes: 1 addition & 1 deletion zenovis/xinxinoptix/OptiXStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ inline uint CachedPrimitiveTypeFlags = UINT_MAX;

inline bool configPipeline(OptixPrimitiveTypeFlags usesPrimitiveTypeFlags) {

if (usesPrimitiveTypeFlags == CachedPrimitiveTypeFlags) { return false; }
if (CachedPrimitiveTypeFlags != UINT_MAX && (usesPrimitiveTypeFlags&CachedPrimitiveTypeFlags == usesPrimitiveTypeFlags)) { return false; }
CachedPrimitiveTypeFlags = usesPrimitiveTypeFlags;

pipeline_compile_options = {};
Expand Down
4 changes: 1 addition & 3 deletions zenovis/xinxinoptix/PTKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ extern "C" __global__ void __raygen__rg()
break;
}

//if(prd.depth>prd.max_depth) {

if(prd.depth > prd.max_depth){
float RRprob = max(max(prd.attenuation.x, prd.attenuation.y), prd.attenuation.z);
RRprob = min(RRprob, 0.99f);
Expand Down Expand Up @@ -478,7 +476,7 @@ extern "C" __global__ void __miss__radiance()

);

float misWeight = BRDFBasics::PowerHeuristic(prd->samplePdf,envPdf);
float misWeight = BRDFBasics::PowerHeuristic(prd->samplePdf,envPdf, 1.0f);

misWeight = misWeight>0.0f?misWeight:0.0f;
misWeight = envPdf>0.0f?misWeight:1.0f;
Expand Down
Loading