Jump to content

# Volume density based on point position and/or depth

## Recommended Posts

Hi,

I'm trying to figure out how to decrease a volume's density based on some value (say a point's position in space).

Say you have a sphere converted into a volume and a point at the center of that volume.

How do you go about calculating the volume's distance from that point and modifying the density based on that?

I would like the density to decrease the closer it is to the point.

I've tried volumesample(), volume gradient VOP node, and a few others...but I'm missing something.

Either VEX or VOP solution is fine.

Density decreases closer to the center...

Thanks!

Edited by TheDude123

link

linkk

maybe it helps

##### Share on other sites

Thanks for the links. After some testing, they work, but the falloff created is not linear (for the shape I'm using).

I would like the density to be highest on the outside of the box shape and fade towards the "center". What I'm currently getting is: dense, less dense, than dense again (see image). RED text from 0-1 is what I would like.

See .hip file and image below.

Thanks.

Edited by TheDude123
##### Share on other sites

Maybe check out the volumefeather node..?

##### Share on other sites

Very close to getting it working, but in my test I'm getting a weird wedge of high density. Maybe somebody smarter can tell me what I missed?

volume_fall_off_test_v1.hip

##### Share on other sites

You could remap a signed-distance field.

f@density = fit(f@density, 0.0, -0.2, 0.0, 1.0);
f@density = chramp('density', f@density);

volume_fall_off_test_km.hipnc

##### Share on other sites

@doc hm
exact what i need ...but how to solve that wedge hm ..endless sacred patterns Thanx

Edited by Librarian
##### Share on other sites

I noticed that increasing the resolution of the sphere seems to make the problem go away, but I'm not sure why that would make a difference

Edited by doc
##### Share on other sites

Hi doc,

in your wrangle write test >= 0, because 0 is also a valid primitive number.

## 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.

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.

×
×

• Leaderboard
• #### Support

×
• Create New...