This allows for extra output passes that encode automatic object and material masks for the entire scene. It is an implementation of the Cryptomatte standard as introduced by Psyop. A good future extension would be to add a manifest to the export and to do plenty of testing to ensure that it is fully compatible with other renderers and compositing programs that use Cryptomatte. Internally, it adds the ability for Cycles to have several passes of the same type that are distinguished by their name. Differential Revision: https://developer.blender.org/D3538
133 lines
3.3 KiB
C++
133 lines
3.3 KiB
C++
/*
|
|
* Copyright 2011-2013 Blender Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef __OBJECT_H__
|
|
#define __OBJECT_H__
|
|
|
|
#include "graph/node.h"
|
|
#include "render/scene.h"
|
|
|
|
#include "util/util_boundbox.h"
|
|
#include "util/util_param.h"
|
|
#include "util/util_transform.h"
|
|
#include "util/util_thread.h"
|
|
#include "util/util_types.h"
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
class Device;
|
|
class DeviceScene;
|
|
class Mesh;
|
|
class ParticleSystem;
|
|
class Progress;
|
|
class Scene;
|
|
struct Transform;
|
|
struct UpdateObjectTransformState;
|
|
|
|
/* Object */
|
|
|
|
class Object : public Node {
|
|
public:
|
|
NODE_DECLARE
|
|
|
|
Mesh *mesh;
|
|
Transform tfm;
|
|
BoundBox bounds;
|
|
uint random_id;
|
|
int pass_id;
|
|
ustring asset_name;
|
|
vector<ParamValue> attributes;
|
|
uint visibility;
|
|
array<Transform> motion;
|
|
bool hide_on_missing_motion;
|
|
bool use_holdout;
|
|
bool is_shadow_catcher;
|
|
|
|
float3 dupli_generated;
|
|
float2 dupli_uv;
|
|
|
|
ParticleSystem *particle_system;
|
|
int particle_index;
|
|
|
|
Object();
|
|
~Object();
|
|
|
|
void tag_update(Scene *scene);
|
|
|
|
void compute_bounds(bool motion_blur);
|
|
void apply_transform(bool apply_to_motion);
|
|
|
|
/* Convert between normalized -1..1 motion time and index
|
|
* in the motion array. */
|
|
bool use_motion() const;
|
|
float motion_time(int step) const;
|
|
int motion_step(float time) const;
|
|
void update_motion();
|
|
|
|
/* Check whether object is traceable and it worth adding it to
|
|
* kernel scene.
|
|
*/
|
|
bool is_traceable() const;
|
|
|
|
/* Combine object's visibility with all possible internal run-time
|
|
* determined flags which denotes trace-time visibility.
|
|
*/
|
|
uint visibility_for_tracing() const;
|
|
};
|
|
|
|
/* Object Manager */
|
|
|
|
class ObjectManager {
|
|
public:
|
|
bool need_update;
|
|
bool need_flags_update;
|
|
|
|
ObjectManager();
|
|
~ObjectManager();
|
|
|
|
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
|
|
void device_update_transforms(DeviceScene *dscene,
|
|
Scene *scene,
|
|
Progress& progress);
|
|
|
|
void device_update_flags(Device *device,
|
|
DeviceScene *dscene,
|
|
Scene *scene,
|
|
Progress& progress,
|
|
bool bounds_valid = true);
|
|
void device_update_mesh_offsets(Device *device, DeviceScene *dscene, Scene *scene);
|
|
|
|
void device_free(Device *device, DeviceScene *dscene);
|
|
|
|
void tag_update(Scene *scene);
|
|
|
|
void apply_static_transforms(DeviceScene *dscene, Scene *scene, Progress& progress);
|
|
|
|
protected:
|
|
void device_update_object_transform(UpdateObjectTransformState *state,
|
|
Object *ob,
|
|
const int object_index);
|
|
void device_update_object_transform_task(UpdateObjectTransformState *state);
|
|
bool device_update_object_transform_pop_work(
|
|
UpdateObjectTransformState *state,
|
|
int *start_index,
|
|
int *num_objects);
|
|
};
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
#endif /* __OBJECT_H__ */
|