Skip to content

Commit d589f02

Browse files
committed
Merge with mitsuba branch (fully working material compiler)
2 parents 56af57f + 959e147 commit d589f02

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

examples_tests/18.MitsubaLoader/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ int main()
412412
}
413413
}
414414

415-
constexpr uint32_t ENVMAP_SAMPLE_COUNT = 16u;
415+
constexpr uint32_t ENVMAP_SAMPLE_COUNT = 64u;
416416
constexpr float LIGHT_INTENSITY_SCALE = 0.01f;
417417

418418
core::unordered_set<const asset::ICPURenderpassIndependentPipeline*> modifiedPipelines;

include/nbl/builtin/material_compiler/glsl/common.glsl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,15 +592,13 @@ void instr_eval_and_pdf_execute(in instr_t instr, in MC_precomputed_t precomp, i
592592

593593
bool is_valid = true;
594594
bool refraction = false;
595-
#ifdef OP_DIELECTRIC
596-
if (op == OP_DIELECTRIC && nbl_glsl_isTransmissionPath(currInteraction.inner.isotropic.NdotV, s.NdotL))
595+
if (nbl_glsl_isTransmissionPath(currInteraction.inner.isotropic.NdotV, s.NdotL))
597596
{
598597
nbl_glsl_calcAnisotropicMicrofacetCache(microfacet.inner, true, currInteraction.inner.isotropic.V.dir, s.L, currInteraction.inner.T, currInteraction.inner.B, currInteraction.inner.isotropic.N, s.NdotL, s.VdotL, eta, rcp_eta);
599598
finalizeMicrofacet(microfacet);
600599
refraction = true;
601600
}
602601
else
603-
#endif
604602
microfacet = _microfacet;
605603

606604
#if defined(OP_DIELECTRIC) || defined(OP_CONDUCTOR)

include/nbl/builtin/material_compiler/glsl/rasterization/impl.glsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ bxdf_eval_t runEvalStream(in MC_precomputed_t precomp, in instr_stream_t stream,
203203
nbl_glsl_LightSample s = nbl_glsl_createLightSample(L, currInteraction.inner);
204204
MC_microfacet_t microfacet;
205205
microfacet.inner = nbl_glsl_calcAnisotropicMicrofacetCache(currInteraction.inner, s);
206+
finalizeMicrofacet(microfacet);
206207
for (uint i = 0u; i < stream.count; ++i)
207208
{
208209
instr_t instr = nbl_glsl_MC_fetchInstr(stream.offset+i);

src/nbl/ext/MitsubaLoader/CMitsubaMaterialCompilerFrontend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ namespace MitsubaLoader
107107
if (tex.image)
108108
dst = std::move(tex);
109109
else
110-
dst = IR::INode::color_t(1.f, 0.f, 0.f); // red in case of no texture
110+
dst = IR::INode::color_t(0.5f, 0.5f, 0.5f); // red in case of no texture
111111
}
112112
else dst = src.value.vvalue;
113113
};
@@ -478,6 +478,7 @@ auto CMitsubaMaterialCompilerFrontend::compileToIRTree(asset::material_compiler:
478478
else
479479
ir_node = createIRNode(ir, node.bsdf);
480480
}
481+
node.ir_node = ir_node;
481482

482483
IRNode** dst = nullptr;
483484
if (node.parent_ix >= bfs.size())

0 commit comments

Comments
 (0)