2015-01-22 10:53:49 +00:00
|
|
|
#!/usr/bin/env python3
|
2022-02-10 22:07:11 +00:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2015-01-22 10:53:49 +00:00
|
|
|
|
|
|
|
import argparse
|
|
|
|
import os
|
2017-08-19 10:09:28 +00:00
|
|
|
import shlex
|
2016-06-13 22:39:49 +00:00
|
|
|
import shutil
|
2015-01-22 10:53:49 +00:00
|
|
|
import subprocess
|
|
|
|
import sys
|
2020-08-05 10:59:28 +00:00
|
|
|
from pathlib import Path
|
2015-01-22 10:53:49 +00:00
|
|
|
|
2021-01-14 11:04:09 +00:00
|
|
|
# List of .blend files that are known to be failing and are not ready to be
|
|
|
|
# tested, or that only make sense on some devices. Accepts regular expressions.
|
2022-01-26 17:37:20 +00:00
|
|
|
BLACKLIST_ALL = [
|
|
|
|
# Blacklisted due overlapping object differences between platforms.
|
|
|
|
"hair_geom_reflection.blend",
|
|
|
|
"hair_geom_transmission.blend",
|
|
|
|
"hair_instancer_uv.blend",
|
|
|
|
"principled_hair_directcoloring.blend",
|
|
|
|
"visibility_particles.blend",
|
|
|
|
]
|
|
|
|
|
2021-01-14 11:04:09 +00:00
|
|
|
BLACKLIST_OSL = [
|
|
|
|
# OSL only supported on CPU.
|
|
|
|
'.*_osl.blend',
|
|
|
|
'osl_.*.blend',
|
|
|
|
]
|
|
|
|
|
|
|
|
BLACKLIST_OPTIX = [
|
2021-10-19 13:02:44 +00:00
|
|
|
# Ray intersection precision issues
|
2021-01-14 11:04:09 +00:00
|
|
|
'T50164.blend',
|
|
|
|
'T43865.blend',
|
|
|
|
]
|
|
|
|
|
Cycles: approximate shadow caustics using manifold next event estimation
This adds support for selective rendering of caustics in shadows of refractive
objects. Example uses are rendering of underwater caustics and eye caustics.
This is based on "Manifold Next Event Estimation", a method developed for
production rendering. The idea is to selectively enable shadow caustics on a
few objects in the scene where they have a big visual impact, without impacting
render performance for the rest of the scene.
The Shadow Caustic option must be manually enabled on light, caustic receiver
and caster objects. For such light paths, the Filter Glossy option will be
ignored and replaced by sharp caustics.
Currently this method has a various limitations:
* Only caustics in shadows of refractive objects work, which means no caustics
from reflection or caustics that outside shadows. Only up to 4 refractive
caustic bounces are supported.
* Caustic caster objects should have smooth normals.
* Not currently support for Metal GPU rendering.
In the future this method may be extended for more general caustics.
TECHNICAL DETAILS
This code adds manifold next event estimation through refractive surface(s) as a
new sampling technique for direct lighting, i.e. finding the point on the
refractive surface(s) along the path to a light sample, which satisfies Fermat's
principle for a given microfacet normal and the path's end points. This
technique involves walking on the "specular manifold" using a pseudo newton
solver. Such a manifold is defined by the specular constraint matrix from the
manifold exploration framework [2]. For each refractive interface, this
constraint is defined by enforcing that the generalized half-vector projection
onto the interface local tangent plane is null. The newton solver guides the
walk by linearizing the manifold locally before reprojecting the linear solution
onto the refractive surface. See paper [1] for more details about the technique
itself and [3] for the half-vector light transport formulation, from which it is
derived.
[1] Manifold Next Event Estimation
Johannes Hanika, Marc Droske, and Luca Fascione. 2015.
Comput. Graph. Forum 34, 4 (July 2015), 87–97.
https://jo.dreggn.org/home/2015_mnee.pdf
[2] Manifold exploration: a Markov Chain Monte Carlo technique for rendering
scenes with difficult specular transport Wenzel Jakob and Steve Marschner.
2012. ACM Trans. Graph. 31, 4, Article 58 (July 2012), 13 pages.
https://www.cs.cornell.edu/projects/manifolds-sg12/
[3] The Natural-Constraint Representation of the Path Space for Efficient
Light Transport Simulation. Anton S. Kaplanyan, Johannes Hanika, and Carsten
Dachsbacher. 2014. ACM Trans. Graph. 33, 4, Article 102 (July 2014), 13 pages.
https://cg.ivd.kit.edu/english/HSLT.php
The code for this samping technique was inserted at the light sampling stage
(direct lighting). If the walk is successful, it turns off path regularization
using a specialized flag in the path state (PATH_MNEE_SUCCESS). This flag tells
the integrator not to blur the brdf roughness further down the path (in a child
ray created from BSDF sampling). In addition, using a cascading mechanism of
flag values, we cull connections to caustic lights for this and children rays,
which should be resolved through MNEE.
This mechanism also cancels the MIS bsdf counter part at the casutic receiver
depth, in essence leaving MNEE as the only sampling technique from receivers
through refractive casters to caustic lights. This choice might not be optimal
when the light gets large wrt to the receiver, though this is usually not when
you want to use MNEE.
This connection culling strategy removes a fair amount of fireflies, at the cost
of introducing a slight bias. Because of the selective nature of the culling
mechanism, reflective caustics still benefit from the native path
regularization, which further removes fireflies on other surfaces (bouncing
light off casters).
Differential Revision: https://developer.blender.org/D13533
2022-04-01 13:44:24 +00:00
|
|
|
BLACKLIST_METAL = [
|
2022-06-01 08:24:40 +00:00
|
|
|
# No MNEE for Metal currently
|
|
|
|
"underwater_caustics.blend",
|
Cycles: approximate shadow caustics using manifold next event estimation
This adds support for selective rendering of caustics in shadows of refractive
objects. Example uses are rendering of underwater caustics and eye caustics.
This is based on "Manifold Next Event Estimation", a method developed for
production rendering. The idea is to selectively enable shadow caustics on a
few objects in the scene where they have a big visual impact, without impacting
render performance for the rest of the scene.
The Shadow Caustic option must be manually enabled on light, caustic receiver
and caster objects. For such light paths, the Filter Glossy option will be
ignored and replaced by sharp caustics.
Currently this method has a various limitations:
* Only caustics in shadows of refractive objects work, which means no caustics
from reflection or caustics that outside shadows. Only up to 4 refractive
caustic bounces are supported.
* Caustic caster objects should have smooth normals.
* Not currently support for Metal GPU rendering.
In the future this method may be extended for more general caustics.
TECHNICAL DETAILS
This code adds manifold next event estimation through refractive surface(s) as a
new sampling technique for direct lighting, i.e. finding the point on the
refractive surface(s) along the path to a light sample, which satisfies Fermat's
principle for a given microfacet normal and the path's end points. This
technique involves walking on the "specular manifold" using a pseudo newton
solver. Such a manifold is defined by the specular constraint matrix from the
manifold exploration framework [2]. For each refractive interface, this
constraint is defined by enforcing that the generalized half-vector projection
onto the interface local tangent plane is null. The newton solver guides the
walk by linearizing the manifold locally before reprojecting the linear solution
onto the refractive surface. See paper [1] for more details about the technique
itself and [3] for the half-vector light transport formulation, from which it is
derived.
[1] Manifold Next Event Estimation
Johannes Hanika, Marc Droske, and Luca Fascione. 2015.
Comput. Graph. Forum 34, 4 (July 2015), 87–97.
https://jo.dreggn.org/home/2015_mnee.pdf
[2] Manifold exploration: a Markov Chain Monte Carlo technique for rendering
scenes with difficult specular transport Wenzel Jakob and Steve Marschner.
2012. ACM Trans. Graph. 31, 4, Article 58 (July 2012), 13 pages.
https://www.cs.cornell.edu/projects/manifolds-sg12/
[3] The Natural-Constraint Representation of the Path Space for Efficient
Light Transport Simulation. Anton S. Kaplanyan, Johannes Hanika, and Carsten
Dachsbacher. 2014. ACM Trans. Graph. 33, 4, Article 102 (July 2014), 13 pages.
https://cg.ivd.kit.edu/english/HSLT.php
The code for this samping technique was inserted at the light sampling stage
(direct lighting). If the walk is successful, it turns off path regularization
using a specialized flag in the path state (PATH_MNEE_SUCCESS). This flag tells
the integrator not to blur the brdf roughness further down the path (in a child
ray created from BSDF sampling). In addition, using a cascading mechanism of
flag values, we cull connections to caustic lights for this and children rays,
which should be resolved through MNEE.
This mechanism also cancels the MIS bsdf counter part at the casutic receiver
depth, in essence leaving MNEE as the only sampling technique from receivers
through refractive casters to caustic lights. This choice might not be optimal
when the light gets large wrt to the receiver, though this is usually not when
you want to use MNEE.
This connection culling strategy removes a fair amount of fireflies, at the cost
of introducing a slight bias. Because of the selective nature of the culling
mechanism, reflective caustics still benefit from the native path
regularization, which further removes fireflies on other surfaces (bouncing
light off casters).
Differential Revision: https://developer.blender.org/D13533
2022-04-01 13:44:24 +00:00
|
|
|
]
|
|
|
|
|
2021-01-14 11:04:09 +00:00
|
|
|
BLACKLIST_GPU = [
|
|
|
|
# Uninvestigated differences with GPU.
|
|
|
|
'image_log.blend',
|
|
|
|
'T40964.blend',
|
|
|
|
'T45609.blend',
|
|
|
|
'smoke_color.blend',
|
|
|
|
'bevel_mblur.blend',
|
|
|
|
# Inconsistency between Embree and Hair primitive on GPU.
|
2021-10-19 13:02:44 +00:00
|
|
|
'denoise_hair.blend',
|
2021-01-14 11:04:09 +00:00
|
|
|
'hair_basemesh_intercept.blend',
|
|
|
|
'hair_instancer_uv.blend',
|
2021-10-19 13:02:44 +00:00
|
|
|
'hair_length_info.blend',
|
2021-01-14 11:04:09 +00:00
|
|
|
'hair_particle_random.blend',
|
2022-01-13 16:20:50 +00:00
|
|
|
"hair_transmission.blend",
|
2021-01-14 11:04:09 +00:00
|
|
|
'principled_hair_.*.blend',
|
|
|
|
'transparent_shadow_hair.*.blend',
|
2022-01-13 16:20:50 +00:00
|
|
|
# Inconsistent handling of overlapping objects.
|
|
|
|
"T41143.blend",
|
|
|
|
"visibility_particles.blend",
|
2021-01-14 11:04:09 +00:00
|
|
|
]
|
2015-01-22 10:53:49 +00:00
|
|
|
|
2021-07-06 02:05:27 +00:00
|
|
|
|
2019-05-10 21:00:35 +00:00
|
|
|
def get_arguments(filepath, output_filepath):
|
2019-05-16 13:48:30 +00:00
|
|
|
dirname = os.path.dirname(filepath)
|
|
|
|
basedir = os.path.dirname(dirname)
|
|
|
|
subject = os.path.basename(dirname)
|
|
|
|
|
2019-05-10 21:00:35 +00:00
|
|
|
args = [
|
|
|
|
"--background",
|
2019-05-16 13:48:30 +00:00
|
|
|
"-noaudio",
|
|
|
|
"--factory-startup",
|
|
|
|
"--enable-autoexec",
|
2020-08-26 20:02:02 +00:00
|
|
|
"--debug-memory",
|
|
|
|
"--debug-exit-on-error",
|
2019-05-16 13:48:30 +00:00
|
|
|
filepath,
|
|
|
|
"-E", "CYCLES",
|
|
|
|
"-o", output_filepath,
|
|
|
|
"-F", "PNG"]
|
2017-08-19 10:09:28 +00:00
|
|
|
|
|
|
|
# OSL and GPU examples
|
|
|
|
# custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True"]
|
|
|
|
# custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.device = 'GPU'"]
|
2019-02-11 17:26:47 +00:00
|
|
|
custom_args = os.getenv('CYCLESTEST_ARGS')
|
2019-05-10 21:00:35 +00:00
|
|
|
if custom_args:
|
|
|
|
args.extend(shlex.split(custom_args))
|
2019-05-16 13:48:30 +00:00
|
|
|
|
2019-05-10 21:00:35 +00:00
|
|
|
if subject == 'bake':
|
|
|
|
args.extend(['--python', os.path.join(basedir, "util", "render_bake.py")])
|
2019-05-16 13:48:30 +00:00
|
|
|
elif subject == 'denoise_animation':
|
2019-05-10 21:00:35 +00:00
|
|
|
args.extend(['--python', os.path.join(basedir, "util", "render_denoise.py")])
|
2019-05-16 13:48:30 +00:00
|
|
|
else:
|
2019-05-10 21:00:35 +00:00
|
|
|
args.extend(["-f", "1"])
|
2015-01-22 10:53:49 +00:00
|
|
|
|
2019-05-10 21:00:35 +00:00
|
|
|
return args
|
2015-01-22 10:53:49 +00:00
|
|
|
|
2020-10-02 00:10:01 +00:00
|
|
|
|
2015-01-22 10:53:49 +00:00
|
|
|
def create_argparse():
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("-blender", nargs="+")
|
|
|
|
parser.add_argument("-testdir", nargs=1)
|
2017-08-03 14:41:50 +00:00
|
|
|
parser.add_argument("-outdir", nargs=1)
|
2015-01-22 10:53:49 +00:00
|
|
|
parser.add_argument("-idiff", nargs=1)
|
2020-10-28 15:19:03 +00:00
|
|
|
parser.add_argument("-device", nargs=1)
|
2021-01-14 11:24:24 +00:00
|
|
|
parser.add_argument("-blacklist", nargs="*")
|
2015-01-22 10:53:49 +00:00
|
|
|
return parser
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = create_argparse()
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
2019-05-10 21:00:35 +00:00
|
|
|
blender = args.blender[0]
|
2018-02-14 16:33:06 +00:00
|
|
|
test_dir = args.testdir[0]
|
|
|
|
idiff = args.idiff[0]
|
|
|
|
output_dir = args.outdir[0]
|
2020-10-28 15:19:03 +00:00
|
|
|
device = args.device[0]
|
2015-01-22 10:53:49 +00:00
|
|
|
|
2022-01-26 17:37:20 +00:00
|
|
|
blacklist = BLACKLIST_ALL
|
2021-01-14 11:04:09 +00:00
|
|
|
if device != 'CPU':
|
|
|
|
blacklist += BLACKLIST_GPU
|
2021-01-14 11:24:24 +00:00
|
|
|
if device != 'CPU' or 'OSL' in args.blacklist:
|
2021-01-14 11:04:09 +00:00
|
|
|
blacklist += BLACKLIST_OSL
|
|
|
|
if device == 'OPTIX':
|
|
|
|
blacklist += BLACKLIST_OPTIX
|
Cycles: approximate shadow caustics using manifold next event estimation
This adds support for selective rendering of caustics in shadows of refractive
objects. Example uses are rendering of underwater caustics and eye caustics.
This is based on "Manifold Next Event Estimation", a method developed for
production rendering. The idea is to selectively enable shadow caustics on a
few objects in the scene where they have a big visual impact, without impacting
render performance for the rest of the scene.
The Shadow Caustic option must be manually enabled on light, caustic receiver
and caster objects. For such light paths, the Filter Glossy option will be
ignored and replaced by sharp caustics.
Currently this method has a various limitations:
* Only caustics in shadows of refractive objects work, which means no caustics
from reflection or caustics that outside shadows. Only up to 4 refractive
caustic bounces are supported.
* Caustic caster objects should have smooth normals.
* Not currently support for Metal GPU rendering.
In the future this method may be extended for more general caustics.
TECHNICAL DETAILS
This code adds manifold next event estimation through refractive surface(s) as a
new sampling technique for direct lighting, i.e. finding the point on the
refractive surface(s) along the path to a light sample, which satisfies Fermat's
principle for a given microfacet normal and the path's end points. This
technique involves walking on the "specular manifold" using a pseudo newton
solver. Such a manifold is defined by the specular constraint matrix from the
manifold exploration framework [2]. For each refractive interface, this
constraint is defined by enforcing that the generalized half-vector projection
onto the interface local tangent plane is null. The newton solver guides the
walk by linearizing the manifold locally before reprojecting the linear solution
onto the refractive surface. See paper [1] for more details about the technique
itself and [3] for the half-vector light transport formulation, from which it is
derived.
[1] Manifold Next Event Estimation
Johannes Hanika, Marc Droske, and Luca Fascione. 2015.
Comput. Graph. Forum 34, 4 (July 2015), 87–97.
https://jo.dreggn.org/home/2015_mnee.pdf
[2] Manifold exploration: a Markov Chain Monte Carlo technique for rendering
scenes with difficult specular transport Wenzel Jakob and Steve Marschner.
2012. ACM Trans. Graph. 31, 4, Article 58 (July 2012), 13 pages.
https://www.cs.cornell.edu/projects/manifolds-sg12/
[3] The Natural-Constraint Representation of the Path Space for Efficient
Light Transport Simulation. Anton S. Kaplanyan, Johannes Hanika, and Carsten
Dachsbacher. 2014. ACM Trans. Graph. 33, 4, Article 102 (July 2014), 13 pages.
https://cg.ivd.kit.edu/english/HSLT.php
The code for this samping technique was inserted at the light sampling stage
(direct lighting). If the walk is successful, it turns off path regularization
using a specialized flag in the path state (PATH_MNEE_SUCCESS). This flag tells
the integrator not to blur the brdf roughness further down the path (in a child
ray created from BSDF sampling). In addition, using a cascading mechanism of
flag values, we cull connections to caustic lights for this and children rays,
which should be resolved through MNEE.
This mechanism also cancels the MIS bsdf counter part at the casutic receiver
depth, in essence leaving MNEE as the only sampling technique from receivers
through refractive casters to caustic lights. This choice might not be optimal
when the light gets large wrt to the receiver, though this is usually not when
you want to use MNEE.
This connection culling strategy removes a fair amount of fireflies, at the cost
of introducing a slight bias. Because of the selective nature of the culling
mechanism, reflective caustics still benefit from the native path
regularization, which further removes fireflies on other surfaces (bouncing
light off casters).
Differential Revision: https://developer.blender.org/D13533
2022-04-01 13:44:24 +00:00
|
|
|
if device == 'METAL':
|
|
|
|
blacklist += BLACKLIST_METAL
|
2021-01-14 11:04:09 +00:00
|
|
|
|
2018-02-14 16:33:06 +00:00
|
|
|
from modules import render_report
|
2021-01-14 11:04:09 +00:00
|
|
|
report = render_report.Report('Cycles', output_dir, idiff, device, blacklist)
|
2018-02-14 16:33:06 +00:00
|
|
|
report.set_pixelated(True)
|
2019-05-06 17:46:32 +00:00
|
|
|
report.set_reference_dir("cycles_renders")
|
2020-10-28 15:19:03 +00:00
|
|
|
if device == 'CPU':
|
|
|
|
report.set_compare_engine('eevee')
|
|
|
|
else:
|
|
|
|
report.set_compare_engine('cycles', 'CPU')
|
2020-08-05 09:20:25 +00:00
|
|
|
|
|
|
|
# Increase threshold for motion blur, see T78777.
|
2020-08-05 10:59:28 +00:00
|
|
|
test_dir_name = Path(test_dir).name
|
|
|
|
if test_dir_name == 'motion_blur':
|
2020-08-05 09:20:25 +00:00
|
|
|
report.set_fail_threshold(0.032)
|
|
|
|
|
2019-05-10 21:00:35 +00:00
|
|
|
ok = report.run(test_dir, blender, get_arguments, batch=True)
|
2015-01-22 10:53:49 +00:00
|
|
|
|
|
|
|
sys.exit(not ok)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|