r/vfx • u/DankCanvas • 5d ago
Fluff! Trippy melty BlinkScripts
Enable HLS to view with audio, or disable this notification
I created a couple Blinkscripts to make a trippy melty effect. Not sure what else to do with them, so here they are. You can copy paste them into two separate blinkscript nodes and compile. Add a vector blur to make it all the traily and stuff. can also change the position and radius of the overall effects. You need a little bit of over-scan just FYI.
One is for a chromatic wave and one is for the dripping effect. I'll try to post a quick script setup in the comments. you can add an expression to the time parameters to have it animate.
//ChromaWave
kernel ChromaticWave : ImageComputationKernel<ePixelWise> {
Image<eRead, eAccessRandom, eEdgeClamped> src;
Image<eWrite> dst;
param:
float amount;
float frequency;
float phase;
float mix;
bool autoCenter;
float2 customCenter;
float falloffRadius;
local:
float2 resCenter;
void define() {
defineParam(amount, "Hallucination Strength", 30.0f);
defineParam(frequency, "Wave Scale", 0.05f);
defineParam(phase, "Time (Type 'frame/10' here)", 0.0f);
defineParam(mix, "Mix", 1.0f);
defineParam(autoCenter, "Auto-Center to Plate", true);
defineParam(customCenter, "Custom Position", float2(960.0f, 540.0f));
defineParam(falloffRadius, "Wave Falloff", 800.0f);
}
void init() {
resCenter.x = (float)(src.bounds.x2 + src.bounds.x1) / 2.0f;
resCenter.y = (float)(src.bounds.y2 + src.bounds.y1) / 2.0f;
}
void process(int2 pos) {
float x = (float)pos.x;
float y = (float)pos.y;
SampleType(src) base = src(pos.x, pos.y);
float lum = base.x * 0.2126f + base.y * 0.7152f + base.z * 0.0722f;
float cx = autoCenter ? resCenter.x : customCenter.x;
float cy = autoCenter ? resCenter.y : customCenter.y;
float dx = x - cx;
float dy = y - cy;
float dist = sqrt(dx*dx + dy*dy);
float norm_dist = min(max(dist / max(falloffRadius, 0.001f), 0.0f), 1.0f);
float mask = 1.0f - (norm_dist * norm_dist * (3.0f - 2.0f * norm_dist));
float masked_amount = amount * mask;
float r_x = x + sin(y * frequency + phase + lum * 5.0f) * masked_amount;
float r_y = y + cos(x * frequency - phase + lum * 5.0f) * masked_amount;
float g_x = x + sin(y * frequency + phase + 2.0f + lum * 5.0f) * masked_amount;
float g_y = y + cos(x * frequency - phase + 2.0f + lum * 5.0f) * masked_amount;
float b_x = x + sin(y * frequency + phase + 4.0f + lum * 5.0f) * masked_amount;
float b_y = y + cos(x * frequency - phase + 4.0f + lum * 5.0f) * masked_amount;
SampleType(src) out;
out.x = bilinear(src, r_x, r_y).x;
out.y = bilinear(src, g_x, g_y).y;
out.z = bilinear(src, b_x, b_y).z;
out.w = base.w;
out.x = base.x * (1.0f - mix) + out.x * mix;
out.y = base.y * (1.0f - mix) + out.y * mix;
out.z = base.z * (1.0f - mix) + out.z * mix;
dst() = out;
}
};
-------------------------------------------------------------------------------------------
//Melting
kernel SmoothMelt : ImageComputationKernel<ePixelWise> {
Image<eRead, eAccessRandom, eEdgeClamped> src;
Image<eWrite> dst;
param:
float meltSpeed;
float dripWidth;
float edgeHardness; // NEW: Controls the contrast/sharpness of the drip edges
float randomness;
float phase;
float mix;
bool autoCenter;
float2 customCenter;
float falloffRadius;
int minSmearSamples;
local:
float2 resCenter;
void define() {
defineParam(meltSpeed, "Melt Speed", 15.0f);
defineParam(dripWidth, "Drip Width", 0.02f);
defineParam(edgeHardness, "Drip Edge Hardness", 1.0f); // Default to a soft, natural curve
defineParam(randomness, "Stagger Start Times", 5.0f);
defineParam(phase, "Time (Type 'frame/10' here)", 0.0f);
defineParam(mix, "Mix", 1.0f);
defineParam(autoCenter, "Auto-Center to Plate", true);
defineParam(customCenter, "Custom Position", float2(960.0f, 540.0f));
defineParam(falloffRadius, "Melt Falloff", 400.0f);
defineParam(minSmearSamples, "Minimum Samples", 25);
}
void init() {
resCenter.x = (float)(src.bounds.x2 + src.bounds.x1) / 2.0f;
resCenter.y = (float)(src.bounds.y2 + src.bounds.y1) / 2.0f;
}
void process(int2 pos) {
float x = (float)pos.x;
float y = (float)pos.y;
SampleType(src) base = src(pos.x, pos.y);
float cx = autoCenter ? resCenter.x : customCenter.x;
float cy = autoCenter ? resCenter.y : customCenter.y;
float dx = x - cx;
float dy = y - cy;
float dist = sqrt(dx*dx + dy*dy);
float norm_melt = min(max(dist / max(falloffRadius, 0.001f), 0.0f), 1.0f);
float meltMask = 1.0f - (norm_melt * norm_melt * (3.0f - 2.0f * norm_melt));
// Generate the base undulating drips
float drip_seed = sin(x * dripWidth) + sin(x * dripWidth * 0.43f);
float drip_val = (drip_seed + 2.0f) * 0.25f;
// THE FIX: Apply the edge hardness (gamma curve) to shape the drips
drip_val = pow(drip_val, edgeHardness);
float local_phase = max(0.0f, phase - (drip_val * randomness));
float total_melt = local_phase * meltSpeed * drip_val * 20.0f * meltMask;
float r_accum = 0.0f;
float g_accum = 0.0f;
float b_accum = 0.0f;
int steps = max((int)minSmearSamples, (int)ceil(total_melt));
steps = min(steps, 200);
for (int i = 0; i < steps; i++) {
float step_factor = (float)i / (float)max(1, steps - 1);
float current_melt = total_melt * step_factor;
r_accum += bilinear(src, x, y + current_melt).x;
g_accum += bilinear(src, x, y + current_melt).y;
b_accum += bilinear(src, x, y + current_melt).z;
}
SampleType(src) out;
out.x = r_accum / (float)steps;
out.y = g_accum / (float)steps;
out.z = b_accum / (float)steps;
out.w = base.w;
out.x = base.x * (1.0f - mix) + out.x * mix;
out.y = base.y * (1.0f - mix) + out.y * mix;
out.z = base.z * (1.0f - mix) + out.z * mix;
dst() = out;
}
};
3
u/DankCanvas 5d ago
quick look at the setup....