the white part should have the volume in blue and the black part in red but it doesn't work I leave you an image that explains the problem better
-
1$\begingroup$ It's going to depend on the texture coordinate you use. Typically I'd expect an image texture to describe a surface, but you can project it over an axis if you want. Long story short: An image really doesn't have anything to say about a volume. It doesn't have any depth. $\endgroup$– Allen SimpsonCommented Jul 27, 2022 at 19:00
1 Answer
As was mentioned, because you're dealing with volumes, you need to use 3D Textures! :)
You can get these by using procedural textures with the type set to 3D. To get that squiggly shape, for example, you could do something like this:
Then, to get that circular shape, you could do something like this:
You could then add them together to get something like this:
If you only want the shape to appear on the front of the cube, you can use a noise texture to create a mask for the added textures:
You can then multiply the mask with the result of the added textures. This isn't perfect, but you can play with the settings to get what you want:
Finally, you can adjust the result with a color ramp and then plug that into the factor of the mix shader to get what you'd like:
Procedural shading is tricky at first, but it's really powerful! Best of luck!