Refactor depsgraph/render logic to serve evaluated depsgraph to engines
User notes ---------- Compositing, rendering of multi-layers in Eevee should be fully working now. Development notes ----------------- Up until now we were still using the same depsgraph for rendering and viewport evaluation. And we had to go out of our ways to be sure the depsgraphs were updated. Now we iterate over the (to be rendered) view layers and create a depsgraph to each one, fully evaluated and call the render engines (Cycles, Eevee, ...) with this viewlayer/depsgraph/evaluation context. At this time we are not handling data persistency, Depsgraph is created from scratch prior to rendering each frame. So I got rid of most of the partial update calls we had during the render pipeline. Cycles: Brecht Van Lommel did a patch to tackle some of the required Cycles changes but this commit mark these changes as TODOs. Basically Cycles needs to render one layer at a time. Reviewers: sergey, brecht Differential Revision: https://developer.blender.org/D3073
This commit is contained in:
@@ -92,7 +92,7 @@ typedef struct RenderEngineType {
|
||||
char name[64];
|
||||
int flag;
|
||||
|
||||
void (*update)(struct RenderEngine *engine, struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene);
|
||||
void (*update)(struct RenderEngine *engine, struct Main *bmain, struct Scene *scene);
|
||||
void (*render_to_image)(struct RenderEngine *engine, struct Depsgraph *depsgraph);
|
||||
void (*bake)(struct RenderEngine *engine, struct Scene *scene, struct Object *object, const int pass_type,
|
||||
const int pass_filter, const int object_id, const struct BakePixel *pixel_array, const int num_pixels,
|
||||
@@ -190,9 +190,7 @@ RenderEngineType *RE_engines_find(const char *idname);
|
||||
rcti* RE_engine_get_current_tiles(struct Render *re, int *r_total_tiles, bool *r_needs_free);
|
||||
struct RenderData *RE_engine_get_render_data(struct Render *re);
|
||||
void RE_bake_engine_set_engine_parameters(
|
||||
struct Render *re, struct Main *bmain, struct Depsgraph *graph, struct Scene *scene);
|
||||
|
||||
struct ViewLayer *RE_engine_get_view_layer(struct Render *re);
|
||||
struct Render *re, struct Main *bmain, struct Scene *scene);
|
||||
|
||||
#endif /* __RE_ENGINE_H__ */
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_vec_types.h"
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
struct bMovieHandle;
|
||||
struct bNodeTree;
|
||||
@@ -121,7 +122,9 @@ typedef struct RenderLayer {
|
||||
|
||||
/* optional saved endresult on disk */
|
||||
void *exrhandle;
|
||||
|
||||
|
||||
struct EvaluationContext eval_ctx;
|
||||
|
||||
ListBase passes;
|
||||
|
||||
} RenderLayer;
|
||||
@@ -250,7 +253,6 @@ void RE_ChangeModeFlag(struct Render *re, int flag, bool clear);
|
||||
struct Object *RE_GetCamera(struct Render *re); /* return camera override if set */
|
||||
void RE_SetOverrideCamera(struct Render *re, struct Object *camera);
|
||||
void RE_SetCamera(struct Render *re, struct Object *camera);
|
||||
void RE_SetDepsgraph(struct Render *re, struct Depsgraph *graph);
|
||||
void RE_SetEnvmapCamera(struct Render *re, struct Object *cam_ob, float viewscale, float clipsta, float clipend);
|
||||
void RE_SetWindow(struct Render *re, const rctf *viewplane, float clipsta, float clipend);
|
||||
void RE_SetOrtho(struct Render *re, const rctf *viewplane, float clipsta, float clipend);
|
||||
@@ -267,7 +269,7 @@ void RE_GetViewPlane(struct Render *re, rctf *r_viewplane, rcti *r_disprect);
|
||||
void RE_Database_FromScene(
|
||||
struct Render *re, struct Main *bmain, struct Scene *scene,
|
||||
unsigned int lay, int use_camera_view);
|
||||
void RE_Database_Preprocess(struct Render *re);
|
||||
void RE_Database_Preprocess(struct EvaluationContext *eavl_ctx, struct Render *re);
|
||||
void RE_Database_Free(struct Render *re);
|
||||
|
||||
/* project dbase again, when viewplane/perspective changed */
|
||||
@@ -368,14 +370,13 @@ struct RenderPass *RE_pass_find_by_type(volatile struct RenderLayer *rl, int pas
|
||||
#define RE_BAKE_VERTEX_COLORS 14
|
||||
|
||||
void RE_Database_Baking(
|
||||
struct Render *re, struct Main *bmain, struct Scene *scene,
|
||||
struct Render *re, struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer,
|
||||
unsigned int lay, const int type, struct Object *actob);
|
||||
|
||||
void RE_DataBase_GetView(struct Render *re, float mat[4][4]);
|
||||
void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, float mat[4][4]);
|
||||
void RE_GetCameraModelMatrix(struct Render *re, struct Object *camera, float r_mat[4][4]);
|
||||
struct Scene *RE_GetScene(struct Render *re);
|
||||
struct EvaluationContext *RE_GetEvalCtx(struct Render *re);
|
||||
|
||||
bool RE_force_single_renderlayer(struct Scene *scene);
|
||||
bool RE_is_rendering_allowed(struct Scene *scene, struct Object *camera_override, struct ReportList *reports);
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
/* called by meshtools */
|
||||
struct DerivedMesh;
|
||||
struct EvaluationContext;
|
||||
struct ImagePool;
|
||||
struct MTex;
|
||||
struct Scene;
|
||||
@@ -55,7 +56,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
|
||||
void RE_texture_rng_init(void);
|
||||
void RE_texture_rng_exit(void);
|
||||
|
||||
struct Material *RE_sample_material_init(struct Material *orig_mat, struct Scene *scene);
|
||||
struct Material *RE_sample_material_init(const struct EvaluationContext *eval_ctx, struct Material *orig_mat, struct Scene *scene);
|
||||
void RE_sample_material_free(struct Material *mat);
|
||||
void RE_sample_material_color(
|
||||
struct Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3],
|
||||
|
||||
Reference in New Issue
Block a user