Amarcolina / NativeSDF

Evaluate signed-distance-fields with speed using Unity Jobs and Burst
MIT License
100 stars 10 forks source link

Contributing #1

Open andybak opened 5 years ago

andybak commented 5 years ago

Hi,

I'm going to take a look to see if I can figure out how to generate a 3D texture of the SDF that can be fed into the new Unity Visual Effect Graph.

This will be both a nice way to generate and manipulate SDFs for VFX usage - and a nice way to visualize SDFs that might be a bit prettier than the supplied mesher.

Should I work on this with a view to sending pull requests upstream or should I keep my stuff entirely separate?

I also will probably add a bunch of nodes based on the list at http://mercury.sexy/hg_sdf/ - especially domain repetition ops.

Amarcolina commented 5 years ago

That would be wonderful! Now that unity supports writing to textures using jobs, you should be able to get some good speed building volume textures.

Contributions merged upstream to this repo would definitely be my preference. I don't really have a specific contribution guide right now, I'd just prefer if the existing code styles were more or less matched in any new files code.

New nodes would also be great. Was something I've been meaning to do, just haven't had the time yet.

Looking forward to your contributions!

Amarcolina commented 5 years ago

@andybak I just opened the issue #2 to keep track of the work on Domain Operations. There currently isn't a good workflow for creating them, so I outlined a basic plan for creating a generic helper along the lines of SDFNoeUnary.

andybak commented 5 years ago

Apologies for going quiet on this. I got sidetracked with other stuff. It's still on my list as soon as I get some spare time.

Amarcolina commented 5 years ago

No worries! I'll probably have some changes live later this evening with some work I did getting basic support for domain operations. There was some architecture changes I also wanted to make outlined in #3 so I went ahead and did them at the same time. This should make it easier to add new types of domain operations, as I've only really tested the basic mod3 operation.

andybak commented 5 years ago

Sorry about lack of input. I get distracted easily. :) My need for this rather diminished as I wasn't getting especially amazing results from SDFs in the VFX Graph compared to other techniques.

I wonder if you were aware of https://github.com/zalo/libfive-unity

It also uses SDF functions defined here: https://github.com/zalo/libfive-unity/blob/master/Assets/libfive/Scripts/LFTree.cs#L214

It's worth noting that the meshing algorithm seems very interesting - it's capable of creating very crisp edges.

Amarcolina commented 5 years ago

No problem at all :) I am indeed aware of that repo, zalo is a good friend of mine! Yeah I very much enjoy the dual contouring algorithm implemented, it seems like it can be really powerful compared to the traditional marching cubes.

I think what I was focusing on most for this project here was getting extremely performant SDF sampling inside of the unity job system, more than the meshing part. I'd like to work on generating 3D textures as well, and creating some demos using shadergraph and the vfx graph.

One other thing I've been interested in using this for, is taking advantage of the sdf hierarchy that is built, and using it to generate raw cg/hlsl, and using that to create high-performance and high-accuracy sdf nodes inside of shadergraph / vfx graph. At the very least it could be an interesting tool.

andybak commented 5 years ago

Yeah I very much enjoy the dual contouring algorithm implemented

The author posted a fascinating summary of meshing algorithms to the curv mailing list ahttps://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/curv/rCCaSLflgrU/fFHFpCY4EAAJ

and in it he mentioned that he was implementing a new algorithm. Not sure if it has made it into the released version yet.

I'd like to work on generating 3D textures as well, and creating some demos using shadergraph and the vfx graph.

You mean the bit I had offered to help with? ;-)

One other thing I've been interested in using this for, is taking advantage of the sdf hierarchy that is built, and using it to generate raw cg/hlsl, and using that to create high-performance and high-accuracy sdf nodes inside of shadergraph / vfx graph

That sounds very interesting and something I'd definitely enjoy using. The best thing I've found in this area is https://kev.town/raymarching-toolkit/ but it's sadly not open source. It is however free for non-commercial use but that doesn't really make it appealing to contribute to or use as a base to build other things on. Their demos are worth a look - the character editor shows how powerful the SDF+shader combination can be for realtime applications: https://kev.town/raymarching-toolkit/examples/character-creator/

Amarcolina commented 5 years ago

You mean the bit I had offered to help with? ;-) Yeah that bit XD If you are still interested I'd be happy to accept your contribution, but I had inferred from your previous message that it was not something you were planning to work on anymore.

Raymarching toolkit is definitely very interesting, I think I am more interested in using sdf techniques for more commercial applications. Rendering an entire scene using SDF is something that is very hard to do in a performant way (claybook has a lot of great resources on how they manage it though!) but sdf information is useful for a lot more than just that.

Open source is also definitely my goal, I don't think I have the time or energy to develop a product anyway, and would definitely want to encourage modification, contribution, and using things as a base or scaffold for other experiments.