forked from blender/blender
MaterialX: Implement Gradient Texture node. #28
No reviewers
Labels
No Label
No Milestone
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: DagerD/blender#28
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Vasyl-Pidhirskyi/blender:BLEN-550"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose
Add support for Gradient Texture node.
Technical steps
Implemented Gradient Texture node according to existing Blender's implementation,
Fixed dotproduct, added
to_type
argument to be able to specify output type of node while usingarithmetic
method.@ -150,0 +170,4 @@
case SHD_BLEND_EASING:
res = vector.extract(0).clamp(val(0.0f), val(1.0f));
res_1 = res * res;
res = (val(3.0f) * res_1 - val(2.0f) * res_1 * res);
seems can be simplified to
res = res * res * (val(3.0f) - val(2.0f) * res)
@ -150,0 +180,4 @@
break;
case SHD_BLEND_QUADRATIC_SPHERE:
res = create_node("dotproduct", NodeItem::Type::Float, {{"in1", vector}, {"in2", vector}}).sqrt();
res = (val(0.999999f) - res).max(val(0.0f));
Why not 1.0f? Need comment why 0.999999f is used instead of 1.0f
It's made according to Blender's implementation.
Added comment
@ -150,0 +187,4 @@
res = create_node("dotproduct", NodeItem::Type::Float, {{"in1", vector}, {"in2", vector}}).sqrt();
res = (val(0.999999f) - res).max(val(0.0f));
break;
}
add
default: BLI_assert_unreachable()
@ -150,0 +179,4 @@
res = vector.extract(1).atan2(vector.extract(0)) / (val(float(M_PI * 2.0f))) + val(0.5f);
break;
case SHD_BLEND_QUADRATIC_SPHERE:
res = create_node("dotproduct", NodeItem::Type::Float, {{"in1", vector}, {"in2", vector}}).sqrt();
use
res = res.dotproduct(res).sqrt()
dotproduct
method. a9e919f44cLooks good