Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Wednesday, 20 March 2024

resource - projecting curve onto heightfield with control

 Projecting a Road Curve onto a Heightfield - procegen - Procedural Content Generation (konstantinmagnus.de)


some of the newer tools in Houdini might do this, but it's quite nice to see how to do it manually.

point wrangle the curve, with heightfield in input 1..

float lift = chf('lift'); f@height = volumesample(1, 'height', v@P) + lift;


then plug that into a volume wrangle (input 1), heightfield in input 0 

float width_min = chf('min_width'); float width_max = chf('max_width'); float ease = chf('roll_off'); int prim; vector uvw; float dist_crv = xyzdist(1, v@P, prim, uvw); float height_crv = primuv(1, 'height', prim, uvw); float mask = 1.0 - smooth(width_min, width_max, dist_crv, ease); f@height = lerp(f@height, height_crv, mask); f@mask = mask;


You can control the height with the "lift" slider made in the point wrangle, and the width/falloff in the sliders made in the volume wrangle.

Wednesday, 30 October 2019

camera projection with houdini

Houdini camera projection is as simple as creating a "UV TEXTURE" node and plugging it into the geo you're projecting onto.
In this node, select "Perspective from Camera", from the Texture Type dropdown menu.
You could name the UV Attribute something other than the default of "uv" if you are creating some alternate uv sets.
In the Camera dialog box, specify the camera node. Eg. /obj/cam1 & usually the attribute class for the uv's will be set to vertex.

Now, whatever material you apply to it will use these uv's. (or maybe a different set if you specify within the shader network!) eg. uv2.