Improve path tracer

This commit is contained in:
luboslenco
2020-03-31 11:53:44 +02:00
parent b841cc34ab
commit f815ad25fd
4 changed files with 70 additions and 48 deletions
+2 -2
View File
@@ -302,10 +302,10 @@ class MakePaint {
// TODO: Use emission/subsurface matid
// matid % 3 == 0 - normal, 1 - emission, 2 - subsurface
if (Context.material.paintSubs) {
frag.write('if (subs > 0.0) { matid = float(254) / float(255); }');
frag.write('if (subs > 0.0) { matid = 254.0 / 255.0; }');
}
if (Context.material.paintEmis) {
frag.write('if (emis > 0.0) { matid = float(255) / float(255); }');
frag.write('if (emis > 0.0) { matid = 1.0; }');
}
if (layered) {
+6 -2
View File
@@ -81,7 +81,11 @@ class RenderPathRaytrace {
f32[18] = helpMat._32;
f32[19] = helpMat._33;
f32[20] = Scene.active.world.probe.raw.strength;
f32[21] = Context.showEnvmap ? 1.0 : 0.0;
// f32[21] = Context.showEnvmap ? 1.0 : 0.0;
// var right = cam.rightWorld().normalize();
// f32[21] = right.x;
// f32[22] = right.y;
// f32[23] = right.z;
var framebuffer = path.renderTargets.get("buf").image;
Krom.raytraceDispatchRays(framebuffer.renderTarget_, f32.buffer);
@@ -244,7 +248,7 @@ class RenderPathRaytrace {
public static function draw() {
#if arm_painter
if (Context.ddirty > 1) frame = 0;
if (Context.ddirty > 1 || Context.pdirty > 0) frame = 0;
#else
frame = 0;
#end