Jump to content

Recommended Posts

Hi all,

I'm approaching something in H/Redshift which I've not really attempted before - So was interested to see if there were any thoughts surrounding it.

Basically I'm trying to recreate the soft/feathered gradient seen in the attached ref image.

Untitled.thumb.png.46215d8de1be2e1a3882788c54baf55a.png

 

The inner hard edge I'm planning to achieve with some transformed geo floating above the grid below, however the super subtle feathering is challenging me a little.

 

At first I though of using a simple attribVOP on a grid > point Cd. However I'm nut sure how to achieve the outer feather using that technique... Similarly with an attrib transfer from geo > grid it seems not very feasible to get the extreme feather unless the mesh is crazy high res?

I'm continuing to experiment & look through forum threads, but if anyone has some suggestions/tut links/examples etc. would be very much appreciated! :D

 

(Worth noting system = H17.5.258 & RS 2.6.43)

 

Thanks in advance!

Link to comment
Share on other sites

Hi Konstantin,

Thanks so much for taking the time to make that file up for me (with the node descriptions in the vop!) - It is very much appreciated! :)

In all honesty this technique is a little beyond me as a casual user - However I've rebuilt your setup & am getting the same results, so in that case it was a success!

I do have a few questions though, if you'd be so kind to maybe give me some hints?

 

1. The 'pinch' of the gradient at the end of the arc - is this a result of specifically using the arctangent / cartesian function? If so, would there be a way around it to generate a fully soft gradient around the entire circumference?

houdini_2019-08-30_14-17-54.png.5a65737d15bc6af7f9ac6a537e98f243.png

 

2. What (if any) would be a suitable way to approach basing the gradient on any given piece of geometry? (i.e draw a curve projected onto a grid, perhaps?) I assume the length based calculations could still work - However I'm not sure where one would 'plug in' the geo to the vop setup.

2b. The arctangent function is turning the 2d coordinates into a radial value. So my thinking is perhaps for a curve this node would be replaced with another function/pattern node? 

 

Again, thanks so much for your time! I have already learned a lot today just experimenting with various parameters & exploring the help docs with a little more direction! :)

 

T.

 

Link to comment
Share on other sites

Hi,

the xyzdist() function can help you, if you want to have gradients along different shapes. It gives you two useful results. 

  • the u-value of the curve
  • the distance to the curve

Both can be used to get more control over the behaviour of the gradient.

Check my example, but this is a VEX wrangle solution and it is slower than Konstantins solution.

 

color_border_gradient.hipnc

Edited by Aizatulin
  • Like 1
Link to comment
Share on other sites

Hi Aizatulin,

Wow, ok there's a whole lot for me to unpack there, the ramp for the radius is particularly helpful. thanks a million!

(my vex is ashamedly almost non-existent... Have been looking for an exercise that forces me to practice it for quite some time - this seems like a good time to do that! ;) )

My loose plan is to build an asset where i am intersecting poly geo with a grid & then using those intersection edges to drive the gradients. 

Thanks again, the massive point in the right direction is greatly appreciated!

  • Like 1
Link to comment
Share on other sites

Remember Windows 59? ; )1. Regarding the pinch: You can get rid of it by either setting the 'destination min' of fit2 to something greater than 0. Or by simply unplugging it from the next node called smooth2.

2. Regarding a more casual solution on arbitrary curves: There is no shame in using standard SOP nodes.

  • The resample node can create a U attribute running along each curve from 0.0 to 1.0.
  • The color node maps float attributes such as U.
  • The attribute transfer node blends those colors to the grid by taking some nearby samples.
  • .. which can then be smoothed even further by an attribute blur node.
  • In a VOP measure the distance with xyzdist, tune the result with a curve ramp and mix your gradients against a solid background color.

colorcurve.hipnc

  • Like 5
Link to comment
Share on other sites

Konstantin - Thanks so much (again!) for taking the time to make these files up & sharing!

Before I open them & dissect fully, I'm going to spend some time trying to create your answer from the 'colorcurve' reply to try and learn as much as I can along the way!

I know there's no shame in using SOPs if it still gets the correct results, however I am always trying to advance in Houdini (whenever I get the time to really sit down with it) - So I also really appreciate everyone's responses here with varying methodology.

 

Odforce community is super helpful & supportive as always! :D

 

  • Like 1
Link to comment
Share on other sites

On 8/29/2019 at 11:13 PM, konstantin magnus said:

image.png.caed3d51f60497677dde42b627f3d5c9.pngHi Tim, you can create a wheel by color-mapping the arctangent of your point positions. The smooth function's rolloff parameter can then be used to control the bleeding amount around the circle.

colorwheel.hipnc

Hi all :)

ok, so I've manage to get almost all of these suggestions working to some degree - However I'm still lacking a little understanding of the original suggestion provided by @Konstantin

 

1. If I am using the arctangent - Is it possible to create multiple 'colorwheels' on the same grid geometry?

For example, I'm attempting to create a system where the source of each wheel would be a point projected onto the geo (using the add SOP, or from a particle sim etc.) - So was attempting to make a kind of hybrid of 'colorwheel.hipnc' & 'colorcurve.hipnc', however so far I've been totally unsuccessful.

The transform matrix allows me to rotate the colour ramp, but as I understand the arctangent uses the dimensions of the grid to generate the curve? (although if i alter the grid scales, the curve remains the same, which is what's throwing me off, I think).

 

2. I've also been trying to impliment the ramp paramater in the radius of the gradient from Aizatulin's file. But again to no avail - As I can't quite figure out where to wire that into the VOP setup.

 

Apologies for being a little slow with this & as always any tips welcomed with open arms! :D

 

Thanks!

  • Like 1
Link to comment
Share on other sites

You can create lots of color wheels around points on a grid:

image.png.07ffd070649e5ebbe58a225a971d9824.png

float radius = chf('radius');
float tol = chf('tolerance');

int pt_near = nearpoint(1, v@P);
vector pos_near = point(1, 'P', pt_near);
float dist_near = distance(v@P, pos_near);
vector dir = normalize(v@P - pos_near);
float angle = fit( atan(dir.z, dir.x), -M_PI, M_PI, 0.0, 1.0);

vector color = hsvtorgb(set(angle, 1.0, 1.0));
float width = abs(dist_near - radius) < tol;

v@Cd = color * width;

 

color_wheels.hipnc

  • Like 3
Link to comment
Share on other sites

When decorating three-dimensional meshes I usually rotate() the directions from N to up so they are horizontal for atan() to work properly.

image.png.b44152454e5db7aee57ecf085eb035da.png image.png.ba1cd8af4ad5b297a9bab03ea32300fb.png

float radius = chf('radius');
float tol = chf('tolerance');

int pt_near = nearpoint(1, v@P);
vector pos_near = point(1, 'P', pt_near);
vector nml_near = point(1, 'N', pt_near);
float dist_near = distance(v@P, pos_near);

vector dir = normalize(v@P - pos_near);
vector up = set(0,1,0);
matrix3 m = dihedral(nml_near, up);
dir *= m;

float angle = fit( atan(dir.z, dir.x), -M_PI, M_PI, 0.0, 1.0);

vector color = hsvtorgb(set(angle, 1.0, 1.0));
float width = abs(dist_near - radius) < tol;

v@Cd = color * width;

color_wheels_3D.hipnc

Edited by konstantin magnus
  • Like 3
Link to comment
Share on other sites

Thank you both again so much for the clear explanations! :)

I think (hope) I have a much clearer understanding of the VEX workings at this point - in terms of definitions & some of the mathematics - as these examples are broken down in such helpful detail.

However my SOP-based brain is still struggling a little to know exactly how to integrate the two solutions of VOP/VEX. 

I've put together a version of the node-tree I would like to achieve in this example file (painfully incorrect implementation - however it's more to illustrate the order of operations I'd like to achieve)

 

If someone would be able to take a look at this & outline a potential solution or direction that would, as always, be a massive help. :D

Feel like I am getting ever closer to the eureka moment, but I've found it so helpful in learning process to reverse engineer previous examples, I thought I'd try my luck and ask one more time.

 

Again, many thanks in advance if anyone does have the time to help me out. 

 

vex_vop_hybrid.hipnc

 

Link to comment
Share on other sites

Hi! :)

 

Sorry if the notes in the .hip file were unclear...

The visual effect I want to achieve is accomplished mainly by the first post from response from @konstantin magnus i.e A wheel of color that can be gradiated over its length.

However after seeing  @Aizatulin solutions - I would also like to implement some more control over the effect, namely:

 

- Define wheel sources with points.

- Define & control individual wheel radius (with just a float param or pscale attrib etc.)

- Ramp over the soft min/max VOP node for each wheel.

 

As I mention in my post above, I believe I understand the VEX mathematical principles to a far better degree than I did previously, however I am struggling to integrate these 3 elements of Aizatulin's wrangle approach with Konstantins VOP approach.

 

Hopefully my post here makes sense. :D

 

Thanks!

 

Link to comment
Share on other sites

Probably the Attribute VOP is more intuitive but at the end of the day it will do exactly the same as the Attribute Wrangle. 

In my opinion it is much easier/faster to write code in the Wrangle, but this is just my personal (biased) preference. 

Here is another example, where I've rebuild a reduced version of my prevoius post.

This is more to give you some inputs and a comparison between the Attribute VOP and the Attribute Wrangle, where I've used as input a curve, which has a color and radius attribute (for each point).

The idea was to capture each point of the grid by xyzdist() to get the closest point on the curve. For this point you can read out the attribute (like radius / color or whatever you define).

These attribute can be used gain more control over the color gradient, but you have to set the individually for the curve input.

You are totally free how you set these attribute.

 

color_attribute_example.hipnc

  • Like 2
Link to comment
Share on other sites

@Aizatulin

Thanks a bunch for this - As you mention it is a great comparison of the 2 techniques in terms of drawing the shapes & the attrib transfer aspect of it. :)

However I am still struggling implementing a point sourcing function to the original VOP setup that @konstantin magnusshared last week.

 

If I understand correctly, the following VEX code is the definition of the points as source, finding nearest point on grid & adding the normal direction?:

int pt_near = nearpoint(1, v@P);
vector pos_near = point(1, 'P', pt_near);
float dist_near = distance(v@P, pos_near);
vector dir = normalize(v@P - pos_near);

 

What I would really like to do is apply this point sourcing through VOPs , so that I can have multiple wheels being generated & then run each wheel through its own colour ramping before colourmix node at the end.

Apologies - I'm aware that I'm probably verging on being stupid here! as always any help much appreciated. :)

 

vop_point_sourcing.hip

Link to comment
Share on other sites

5 hours ago, meldrew said:

Thanks a bunch for this - As you mention it is a great comparison of the 2 techniques in terms of drawing the shapes & the attrib transfer aspect of it

Sure :)

5 hours ago, meldrew said:

If I understand correctly, the following VEX code is the definition of the points as source, finding nearest point on grid & adding the normal direction?:


int pt_near = nearpoint(1, v@P);
vector pos_near = point(1, 'P', pt_near);
float dist_near = distance(v@P, pos_near);
vector dir = normalize(v@P - pos_near);

 

yes it getting the closest point, but "dir" is just the inverted direction (normalized ~ with length 1) from the point to its nearest point.

 

Accorings to your problem: If you want create color wheels for each points, it can be an option using array attributes (for each point).

But trust me: it will be probably painful doing this in VOP, or I dont see any elegant solution to do this. So if interested here is a very basic wrangle example.

 

wrangle_wheels.hipnc

Edited by Aizatulin
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...