Hi everyone,
I would like to modify the source code of standalone Cycles to output a final image that contains the result of a specific pass e.g. depth, normal, etc.
I started exploring the Cycles source code to understand how to do this and would really appreciate some guidance.
My current progress:
- The final
--output
image is written in theSession
destructor [1]. I’m assuming theDevice
contains all the necessary information and theDisplayBuffer
only converts it to the desired output format [2]. Maybe theDevice
also contains the output of different passes and there’s a way to read it? - Available passes are defined in
kernel_types.h
[3] - The
Film
class [4] seems to contain information about which passes will be used, storing the data in an array of passes [5]. - The only place I found where passes are being added is in the
BufferParams
[6] constructor. Passes are also configured in the Blender section of the code base but I assume everything there is directly related to Blender integration and not used by Cycles standalone. -
scene.cpp
[7] seems to define the main pipeline - The output shouldn’t be gamma corrected – maybe setting
display_buffer_linear
[8] totrue
is enough? What abouttonemap
[9]?
NOTE: I tried adding direct source code links but wasn’t allowed because I’m a new user.
Links:
[1] https://developer.blender.org/diffusion/C/browse/master/src/render/session.cpp;fb39e26c242e4584117aa7584a2d0fbd5cf5ad57$113
[2] https://developer.blender.org/diffusion/C/browse/master/src/render/buffers.cpp;b352637d179acd4e0d525a201ec1975092527926$463
[3] https://developer.blender.org/diffusion/C/browse/master/src/kernel/kernel_types.h;b352637d179acd4e0d525a201ec1975092527926$402
[4] https://developer.blender.org/diffusion/C/browse/master/src/render/film.cpp;b352637d179acd4e0d525a201ec1975092527926$317
[5] https://developer.blender.org/diffusion/C/browse/master/src/render/film.h;b352637d179acd4e0d525a201ec1975092527926$59
[6] https://developer.blender.org/diffusion/C/browse/master/src/render/buffers.cpp;b352637d179acd4e0d525a201ec1975092527926$47
[7] https://developer.blender.org/diffusion/C/browse/master/src/render/scene.cpp;b352637d179acd4e0d525a201ec1975092527926$263
[8] https://developer.blender.org/diffusion/C/browse/master/src/render/session.h;b352637d179acd4e0d525a201ec1975092527926$94
[9] https://developer.blender.org/diffusion/C/browse/master/src/render/session.cpp;b352637d179acd4e0d525a201ec1975092527926$110