Olly Heid


About Me




Houdini Skills


Not Specified

Recent Forum Posts

vex problem with initializing a funtion March 26, 2023, 12:18 p.m.

yep Thomas, tried it with GPT. More work as I write it by myself. Thanks.

vex problem with initializing a funtion March 12, 2023, 10:19 a.m.

Hi the following code gives me an error and I dont know why. Please could you hava a look at it?

the marked problem
Invalid source /obj/sphere_object1/attribwrangle1/attribvop1
Error: Syntax error, unexpected identifier, expecting ')'. (1,46). 
Syntax error, unexpected identifier, expecting ')'. (1,46)

is on (sometimes after) the first quantity clamp.
sometimes I had the same problem elsewhere. No Idea whats going on with this code.
// Define the infection solver function
float infectionSolver(float infection, float timeStep, float diffusion, float decay, int maxIterations)
    float delta = 1.0 / float(maxIterations);
    float infected = 0;
    for(int i = 0; i < maxIterations; i++)
        float diffusionTerm = diffusion * (infected - infection);
        float decayTerm = decay * infected;
        infected += timeStep * (diffusionTerm - decayTerm);
        infected = clamp(infected, 0, 1);
        if(infected >= 1) break;
    return infected;

float rad;
float mid;
vector startcol;
vector endcol;
vector center;
float timestep;
float diffusion;
float decay;
int maxiter;

rad = chf("Radius");
mid = chf("Midpoint");
startcol = chv("StartColor");
endcol = chv("EndColor");
center = chv("Center");
timestep = chf("TimeStep");
diffusion = chf("Diffusion");
decay = chf("Decay");
maxiter = chi("MaxIterations");

// Create the user interface
createDialog("Radial Gradient Fading", "Apply", "Cancel", "Reset",
    "Radius", "float", itoa(rad), "float", 0, 100,
    "Midpoint", "float", itoa(mid), "float", 0, 1,
    "Start Color", "color", sprintf("{%g,%g,%g}", startcol.x, startcol.y, startcol.z), "",
    "End Color", "color", sprintf("{%g,%g,%g}", endcol.x, endcol.y, endcol.z), "",
    "Center", "xyz", sprintf("{%g,%g,%g}", center.x, center.y, center.z), "",
    "Time Step", "float", itoa(timestep), "float", 0, 1,
    "Diffusion", "float", itoa(diffusion), "float", 0, 1,
    "Decay", "float", itoa(decay), "float", 0, 1,
    "Max Iterations", "int", itoa(maxiter), "int", 1, 1000

// Define the start and end colors
vector startColor = startcol; // red
vector endColor = endcol; // cyan

// Define the gradient center and radius
vector gradientCenter = center;
float gradientRadius = rad;

// Iterate over each point in the geometry
foreach(int pt; 0:numpt(0)-1)
    // Calculate the position of the current point
    vector pos = point(0, "P", pt);

    // Calculate the distance of the current point from the gradient center
    float distance = length(pos - gradientCenter);

    // Calculate the ratio of the current distance to the radius
    float ratio = clamp((distance - mid * gradientRadius) / (1 - mid) / gradientRadius, 0, 1);

    // Use the infection solver to fade out the gradient based on the current ratio
    float infection = 1 - ratio;
    float infected = infectionSolver(infection, timestep, diffusion, decay, maxiter);

    // Interpolate the color between the start and end colors based on the infected value
    vector color = lerp(startColor, endColor, infected);

    // Set the color of the current point
    setpointattrib(0, "Cd", pt, color);
Image Not Found

HDA node coloring March 16, 2022, 10:58 a.m.

how to set the default resistant color (i.e. blue) of a HDA node? ANd no, I dont want ot colorize it via the colorchooser to change it after creation. Dont find anything in the type properties of the hda..

thanks in advance