I'm trying to create a realistic nebula scene with procedurally generated structures. I want to use the SDF data from generated volume in shader editor to combine with other mask and textures. I managed to get the positive and negative SDF values but only in geometry form. I need them to be an attribute (like density) so they can be used in shading.
Procedural nebuala (base structure)
The positive SDF in geometry context. I need this data in attribute context as density to be used in shader to combine with masks and textures
The density value generating the original procedural nebuala structure is also useless since it can't be manipulated beyond a certain limit.
I tried creating sdf's using geometry proximity more but it outputs a value of 0-1 inside and outside the mesh which is not what I need (shown below)
Here black line represents the boundary and gradient going inside and outside the mesh with no way to isolate the two gradients
Edit:
If you fill Your volume with enough random points you should be able to isolate the "two gradients"
Thanks. This seem to be generating the desired results and can be imported in shader tab. However there seems to be another problem, perhaps I should have mentioned it before. The data generated needs to be used in a cube volumetric object to control haze "around" structure. The current method doesn't allow usage of this data in a cubic geometry since it is different from the source generating the SDF, a transfer attribute or "sample at index" also won't work here. Essentially the destination for this data is a volume box, with various textures controlling haze including this positive distance data to control haze around the object. (Examples attached below)
A research paper describing the method under practice
The desired result. Using the sdf data (indicated by blue attribute node) in combination with a height mask and a voronoi pattern in a box shaped object
As you can see I'm trying to import the positive distance from the mesh into the shader of a cube to be used with other textures and patterns to make a final "haze effect" around the object.