-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gradient Nodes #310
Gradient Nodes #310
Conversation
|
Unroll loops Remove control flow Remove dynamic indexing
@keijiro Changes made, thanks :) |
@Kink3d It looks good to me. Although I have some ideas to try for further micro-optimization (e.g. |
"Gradient Asset" should just be "Gradient" as it doesn't actually represent an asset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting these warnings:
Assets/ScriptableRenderPipeline/ShaderGraph/com.unity.shadergraph/Editor/Drawing/Controls/GradientControl.cs(48,28): warning CS0414: The private field `UnityEditor.ShaderGraph.Drawing.Controls.GradientControlView.m_SerializedProperty' is assigned but its value is never used
Assets/ScriptableRenderPipeline/ShaderGraph/com.unity.shadergraph/Editor/Drawing/Views/Slots/GradientSlotControlView.cs(24,28): warning CS0414: The private field `UnityEditor.ShaderGraph.Drawing.Slots.GradientSlotControlView.m_SerializedProperty' is assigned but its value is never used
@pbbastian fixed |
Gradient Nodes
Description
This PR adds gradient functionality via two new nodes.
Sample Gradient
node samples a gradient given aTime
parameter. This gradient can be defined on theGradient
slot control view. TheGradient Asset
node defines a gradient that can be sampled by multipleSample Gradient
nodes using differentTime
parameters.These nodes support all functionality of the C# gradient type, including 2-8 color keys, 2-8 alpha keys and a mode value (Blend or Fixed). Internally to the shader each gradient is defined as a struct, wherein its variables are hardcoded in the case of the final shader, or assigned to multiple shader properties in the preview shader, to facilitate editing gradients without recompilation.
Details
New Nodes
New Features
Functions.hlsl
Risk
GetPreviewProperty
toGetPreviewProperties
. Now takes a list ofPreviewProperty
with ref keyword to collect properties. This adds support for multiple preview properties from a single slot. This is needed for Gradient type.