RayTracer : Differentiable Ray Tracing in Julia
RayTracer.jl is a library for differentiable ray tracing. It provides utilities for
- Render complex 3D scenes.
- Differentiate the Ray Tracer wrt arbitrary scene parameters for Gradient Based Inverse Rendering.
Installation
Download Julia 1.0 or later.
For the time being, the library is under active development and hence is not registered. But the master branch is pretty stable for experimentation. To install it simply open a julia REPL and do ] add RayTracer.
The master branch will do all computation on CPU. To try out the experimental GPU support do ] add RayTracer#ap/gpu. To observe the potential performance gains of using GPU you will have to render scenes having more number of objects and the 2D image must be of reasonably high resolution.
Only rendering is currently supported on GPUs. Gradient Computation is broken but will be supported in the future.
Supporting and Citing
This software was developed as part of academic research. If you would like to help support it, please star the repository. If you use this software as part of your research, teaching, or other activities, we would be grateful if you could cite:
@misc{pal2019raytracerjl,
title={{RayTracer.jl: A Differentiable Renderer that supports Parameter Optimization for Scene Reconstruction}},
author={Avik Pal},
year={2019},
eprint={1907.07198},
archivePrefix={arXiv},
primaryClass={cs.GR}
}Contribution Guidelines
This package is written and maintained by Avik Pal. Please fork and send a pull request or create a GitHub issue for bug reports. If you are submitting a pull request make sure to follow the official Julia Style Guide and please use 4 spaces and NOT tabs.
Adding a new feature
For adding a new feature open a Github Issue first to discuss about it.
Please note that we try and avoid having many primitive objects. This might speed up rendering in some rare cases (as most objects will end up being represented as
Triangles) but is really painful to maintain in the future.If you wish to add rendering algorithms it needs to be added to the
src/renderersdirectory. Ideally we wish that this is differentiable but we do accept algorithms which are not differentiable (simply add a note in the documentation).Any new type that is defined should have a corresponding entry in
src/gradients/zygote.jl. Look at existing types to understand how it is done. Note that it is a pretty ugly thing to do and becomes uglier as the number of fields in your struct increases, so do not define something that has a lot of fields unless you need it (seeMaterial).If you don't want a field in your custom type to be not updated while inverse rendering create a subtype of
RayTracer.FixedParamsand wrap those field in it and store it in your custom type.
Adding a tutorial/example
We use Literate.jl to convert
examplestomarkdownfiles. Look into its documentationNext use the following commands to convert he script to markdown
julia> using Literate
julia> Literate.markdown("examples/your_example.jl", "docs/src/getting_started/",
documenter = false)Add an entry to
docs/make.jlso that it is available in the side navigation bar.Add an entry to the
docs/src/index.mdContents section.
Contents
Home
Getting Started Tutorials
- Introduction to rendering using RayTracer.jl
- General Attributes of the Scene
- Understanding the Light and Camera API
- Rendering Different Views of the Teapot
- Next Steps
- Inverse Lighting Tutorial
- Optimizing Scene Parameters using Optim.jl
API Documentation
Index
RayTracer.AccelerationStructureRayTracer.BVHNodeRayTracer.BoundingVolumeHierarchyRayTracer.CameraRayTracer.DistantLightRayTracer.FixedCameraParamsRayTracer.FixedParamsRayTracer.LightRayTracer.MaterialRayTracer.ObjectRayTracer.PointLightRayTracer.SphereRayTracer.TriangleRayTracer.Vec3RayTracer.rgbBase.intersectRayTracer.bigmulRayTracer.camera2worldRayTracer.compute_screen_coordinatesRayTracer.convert2rasterRayTracer.edge_functionRayTracer.edge_function_vectorRayTracer.extractRayTracer.fseelightRayTracer.get_colorRayTracer.get_colorRayTracer.get_directionRayTracer.get_imageRayTracer.get_intensityRayTracer.get_normalRayTracer.get_paramsRayTracer.get_primary_raysRayTracer.get_shading_infoRayTracer.get_transformation_matrixRayTracer.lightRayTracer.load_objRayTracer.ngradientRayTracer.numderivRayTracer.parse_mtllib!RayTracer.placeRayTracer.place_idx!RayTracer.rasterizeRayTracer.raytraceRayTracer.reducehcatRayTracer.reflectionRayTracer.reflectionRayTracer.set_params!RayTracer.specular_exponentRayTracer.specular_exponentRayTracer.triangulate_facesRayTracer.update!RayTracer.world2cameraRayTracer.zeroonenormRayTracer.@diffops