View Full Version : Horizontal gradient based on height above surface ?

06-08-2010, 12:49 AM
Hi there LW gang.

Here's a question for some of you node gurus. Would something like this be possible with the current Ray Cast (or maybe DPont's Ray Intersect) node ?

I've been toying with this for hours but can't seem to get what I want.

Have a look at the before & after pics, node is a simple ray cast (y vector= -1.0) distance driving a gradient.

Blocks are simple boxes resting on some terrain.
Their colour is driven by the undulating terrain underneath which results in the before pic.

What would be handy for me however is if the gradient could somehow remain horizontal, yet still be driven (to an extent) by the terrain underneath.

Best practical example of this I can think of is if you have a number of tall buildings, scattered along some terrain, & you want all their their first floors (gray in these pics) to be at a certain height above ground.

Hope all that makes sense & cheers :thumbsup:

06-08-2010, 02:28 AM
if you made each "building" with a different texture you could use a gradient based on the Y distance to itself.

06-08-2010, 05:46 AM
It would work if I had a few in mind ... but I have around 600 that I may want to texture in this fashion (if possible that is). So in this case it needs to be a bit more automated I'm afraid.

06-08-2010, 09:23 PM
Just a wild guess here.

What if your object to be cloned was scaled really thin in modeler, then you resize it back in layout. That way the texture is applied to a thin object. So when it is widened again the texture stretches and looks pretty much horizontal.

06-09-2010, 12:52 AM
Not sure if that would work but I'll give it a go :)

Here's an idea that does seem to work well & might be helpful to some.
Tho it might be a bit tricky for the model that I have as it's constructed a bit strangely (all the buildings extend below ground and their floors all rest at the same y value).

Assuming your buildings are constructed in the correct fashion, Basically you texture all your buildings with them all sitting on the same y plane, (using the one gradient with Y co-ordinate as the input). Then you simply use DPont's ray intersect & part move, thanks again Denis :) , to displace them all en-mass to sit back on the ground.

Just like in this gif :thumbsup:

Which brings up question about Part Move. The pivot point options give quite a lot of control in how you displace the object but none of those provide the option where the parts all just rest on or below the surface. They all seem to intersect one way or another.