- Home /
3D textures for Constructive Solid Geometry
Hello all,
I am working on procedural generation of meshes using Constructive Solid Geometry. In practice I am implementing this using Signed Distance Fields to actually perform the Constructive Solid Geometry operations on volumes, and then I am using Marching Cubes Algorithm and/or Dual Contouring to generate a mesh from the final volume obtained from the Signed Distance Fields operations.
The issue I am running into, is that I was to defined a 3D material such that I can render any point on the surface as well as the interior volume, for example imagine a texture that could be used to render a jaw-breaker candy. The surface has a given color, but if you were to slice the model in half, you would get a different texture on the interior (example below).
I saw that Unity supports 3D textures, the issue with this is the memory usage. I don't necessarily need to store all of the pixel values for every point in the model, as most of the time I would only care about the outer surface of the model as well as some cross-sections of the model.
As I understand it, my question boils down to two different possibilities:
Is it possible to have a shader evaluate the color of a pixel based on a function (instead of loading it from a 3D array)?
Is it possible to have a "sparse" data structure for Texture3D such that I only need to store the values of the pixels at the surface, and create a new texture including the cross sections when needed?
Your answer
Follow this Question
Related Questions
Stretch second texture within Shader 0 Answers
Prefabs made in Unity are insanely slow, and don't show textures. 0 Answers
Patch on a sphere of varying size 0 Answers
3d text mesh hides plane object 1 Answer
texture/mesh/shader problem on Android 3 Answers