33 return angle - offset;
40 roundness_ = data_->rounding;
41 catadioptric_ = data_->catadioptric;
42 lens_shift_ = data_->lensshift;
45float2 BokehImageOperation::get_regular_polygon_vertex_position(
int vertex_index)
47 float angle = exterior_angle_ * vertex_index - rotation_;
53 float2 line_vector = line_end - line_start;
55 float line_length_squared =
math::dot(line_vector, line_vector);
56 float parameter =
math::dot(point_vector, line_vector) / line_length_squared;
57 return line_start + line_vector * parameter;
60float BokehImageOperation::bokeh(
float2 point,
float circumradius)
67 int vertex_index =
int(
angle / exterior_angle_);
71 float2 first_vertex = this->get_regular_polygon_vertex_position(vertex_index) * circumradius;
72 float2 second_vertex = this->get_regular_polygon_vertex_position(vertex_index + 1) *
74 float2 closest_point = this->closest_point_on_line(
point, first_vertex, second_vertex);
79 float distance_to_edge_round =
math::interpolate(distance_to_edge, circumradius, roundness_);
83 if (
distance > distance_to_edge_round) {
88 float catadioptric_distance = distance_to_edge_round * catadioptric_;
89 if (
distance < catadioptric_distance) {
95 if (distance_to_edge_round -
distance < 1.0f) {
96 return distance_to_edge_round -
distance;
101 if (catadioptric_ != 0.0f &&
distance - catadioptric_distance < 1.0f) {
102 return distance - catadioptric_distance;
115 float circumradius =
float(resolution_) / 2.0f;
127 float min_shift =
math::abs(lens_shift_ * circumradius);
128 float min = min_shift == circumradius ? 0.0f : this->bokeh(
point, circumradius - min_shift);
130 float median_shift = min_shift / 2.0f;
131 float median = this->bokeh(
point, circumradius - median_shift);
133 float max = this->bokeh(
point, circumradius);
139 if (lens_shift_ < 0.0f) {
140 std::swap(bokeh.x, bokeh.z);
MINLINE float floored_fmod(float f, float n)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
void deinit_execution() override
void init_execution() override
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
a MemoryBuffer contains access to the data
void add_output_socket(DataType datatype)
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
static float compute_exterior_angle(int sides)
static float compute_rotation(float angle, int sides)
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
T cos(const AngleRadianBase< T > &a)
T length(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T interpolate(const T &a, const T &b, const FactorT &t)
T atan2(const T &y, const T &x)
T sin(const AngleRadianBase< T > &a)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
float distance(float a, float b)