keijiro / SdfVfxSamples

Unity VFX Graph samples with SDF (signed distance field)
855 stars 82 forks source link

Understanding the vector gradient #1

Closed andybak closed 5 years ago

andybak commented 5 years ago

Hi,

I'm trying to recreate this without the use of Houdini.

Can you explain a bit more about the Distance Field Gradient file?

If I understand it correctly there are many possible gradient vectors for every point in a distance field. What is the gradient in relation to? A tangent on the surface? Or something else?

keijiro commented 5 years ago

It's gradient of distance.

https://shaderfun.com/2018/07/23/signed-distance-fields-part-8-gradients-bevels-and-noise/

keijiro commented 5 years ago

I'm closing this issue now. Please feel free to reopen for further questions.

superguigui commented 5 years ago

Hi @keijiro thanks for the awesome examples ! They are very inspiring. I'm hijacking this issue in order to know if you have any tips in how to generate the gradient distance fields from Houdini ? I'm using Unity VFX Toolbox but I can't find anything in the examples regarding the gradient. I gave it a try using the "Volume Analysis > gradient" node but it generates three volumes (one for each axis) and the volume exporter only accepts one named volume (I tried to combine them but no luck). If you have some pointers that would be awesome ! Thanks again

keijiro commented 5 years ago

@superguigui

superguigui commented 5 years ago

Thanks for your quick answer ! It worked as you said. However the resulting Volume Gradient looks way different than yours (using the Utah Teapot model). Would you mind sharing your Houdini export setup ?

image image

keijiro commented 5 years ago

@superguigui

I used a network like this:

Screenshot from 2019-07-31 09-38-03

I prefer using VDB nodes instead of standard volume nodes (actually I've never used the standard volumes). You can convert them to standard ones using a Convert VDB node.

superguigui commented 5 years ago

Thanks a lot @keijiro it's very helpful !

ShaneMckenna23 commented 5 years ago

Hey @keijiro, I have been spending the last few days diving into Unity's VFX Graph. I have been looking at all of the different projects that you have up here and I have been learning alot!

I'm currently trying to create my own vector field files using the exporter. I'm pretty new to the world of Houdini so it took me some time before I created anything but I figured out how to create a simple one from a SDF Volume. https://www.sidefx.com/forum/attachment/b9ccb3234a33dc6d97e308abfa6312cb6d2aecb9/

I'm now trying to follow the method you have described in this thread on how to create both the SignedDistance and DistanceGradient using VDB nodes but as a complete beginner to this it is proving difficult.

Would it be possible for you to share a .hipnc file from your example above so I can see how each of the nodes are setup and learn from it? Cheers!

andybak commented 5 years ago

@ShaneMckenna23 I've been fiddling with Vector Gradients too after seeing the cool stuff in this repo.

Rather than mess with Houdini I've been attempting to modify https://github.com/xraxra/SDFr to also create gradients. It's mostly working. If you're like to help out then get in touch. (probably best via email: andy@ixxy.co.uk )

tyen901 commented 5 years ago

@keijiro Would you be able to share your houdini file which shows the nodes their settings you used to create the SDF and DistanceGradient files?

keijiro commented 5 years ago

@tyen901 The problem is that I'm not sure if it's okay to share a Houdini project file made with Houdini FX. If I remember correctly, there is no format compatibility between Houdini FX, Core, Indie and Apprentice -- I was afraid that most people can't open it. There is also a license mix restriction in the EULA. I didn't have much time for researching this kind of problems, so I didn't share the Houdini project file.

Do you know if there is a guideline for sharing example/tutorial contents in Houdini?

Paliy90 commented 5 years ago

There is such a resource for exchanging circuits in Houdini . https://hdbp.io

keijiro commented 5 years ago

@Paliy90 Thanks for the info. I didn't know this site. It looks useful for sharing Houdini examples. Still there is a licensing problem though.

JorgeVelez commented 4 years ago

Did somebody manage to generate Distance gradients? There is an example file in the toolbox, but its currently for noises only. Cant get it to work for geometries.

andybak commented 4 years ago

@JorgeVelez I made some progress modifying https://github.com/xraxra/SDFr but the results didn't look terribly promising and I stopped digging. It might have been because SDFr was creating it's SDF via voxelization and gradients suffered because of the low grid resolution.

Or it might have been because I was doing something wrong in creating the gradient from the SDF. If I get a chance I'll dig out the project and take another look.

JorgeVelez commented 4 years ago

Hi Andy. Let me know how that goes. I don't fully understand the calculation, so I can't help you with it for the moment. I read the article Keijiro suggested and it uses pixels in s 2D image, so voxelization must definitely have a lot to do with the outcome.

Have you managed to generate it in houdini? I cant seem to do it. This is what I have so far:

image

JorgeVelez commented 4 years ago

Does anyone have a working Houdini project for Distance gradients? Or can someone confirm these settings are fine?

keijiro commented 4 years ago

I resolved the license problem (actually, there is no such a problem -- you can open FX/CORE .hip files even if you're using Indie/Apprentice), so I uploaded the example Houdini project to the Houdini directory in this repository.

https://github.com/keijiro/VectorFieldExamples/tree/master/Houdini

Sorry for being late to do this. I hope this helps to understand how the exporter works.