Any chance we can get the vec3 or an id of the nearest center point?
Which vec3 would you want to get? As I can see it, the output is a vec2, the vec3s that are used inside the function are intermediate computations.
In the original implementation, from Texturing and Modeling, there is a concept of “ID”. Please let me know if I’m not making sense.
Pinging @Pryme8 as I think he’s the one who added the Worley block in the NME.
You are comparing a GPU version to a CPU version. No there is no ready way to get that info unless you modify the entire shader to just give you that info.
I’d recommend doing your CPU deploy along side the GPU one if you really need just the closest point ID which is not nessiarly something that normally comes with the data in a GPU version of the noise.
Maybe you could add it to the alpha channel but I’m also not really sure what that is going to do for you, there are an infinite amount of points in the whole system and only a finite amount of points per cell. I’m not sure what you are really trying to do though, I might be able to help more if I understood your end goal.
@Pryme8 In the 3D case, having access to the ID makes for a simple way to detect whether or not one is in the “boundary” between cells, ie by doing the 8 samples on a cube to see if there are different ID’s across them. The current case I’m thinking of is in the vertex shader, to hide/show pieces of repeating/periodic geometry. Think caverns, gorges, etc.
Your idea of using the CPU makes a lot of sense. Especially given the compute overhead of the above. Pre-generating 3D texture lookups would probably be even better.
Could the above be an argument for having a matching typescript version of the gpu worley noise algorithm in NME which includes ID? Should I put something on the backlog? Maybe do the same for Simplex? Other scenarios would include stuff like having the camera be able to detect where it’s at in the gpu noise field (via matching typescript noise algorithm), ie detecting collisions w/ a procgen canyon wall, etc. Starting to realize there are plenty of arguments for having access to matching noise algorithms on cpu/fragment/vertex.
On a bit of a tangent, would it also make sense to add 4D simplex noise in NME? Being able to do 3D combined w/ time, 4D, can make for some really nice effects. Same drill, have matching cpu/gpu versions. And in the interest of keeping the code simple, maybe just have the 3D version call the 4D version?
Are you trying to do something like this?
Or are you trying to construct actual geometry?
I think 4d noise should not be hard to add.
If I remember right @Deltakosh rules against more intricate nodes like perlin noise and looped procedural methods for us constructing them with our basic blocks as a custom node.
Honestly I don’t use the NME at all so what the best solution would be is kinda out of my realm of knowledge.
I love how into noise you are though, man after my own heart.
That’s an awesome demo.
Yes, right now, I’m working with geometry. Once the webgpu stuff hits GA I’ll probably start focusing on other techniques. Glad I’ll have someone to teach me!
I’ll put something on the backlog for 4D simplex noise.
@Pryme8 Quick question on the demo. Why is the 3D volume being stored in a 2D texture? Or am I misunderstanding?
To my knowledge webgl can’t on the fly generate 3d textures. So instead to fake a volumetric texture I used a flip book method and fake it with smart space conversions.
Ideally yes you would just sample from a 3d texture because that would allow better interpolation.
I don’t know if
RawTexture3D can help here.
Yeah that would help for loading a pre-complied volumetric texture. I don’t think there would be a way to manipulate it quickly or add procedural noise on-top other then sampling displacement.
If you know a way how @Evgeni_Popov then that will be a game changer for me.
You could in a compute shader in WebGPU (once 3D textures are supported by Chrome Canary)
For sure knew that was possible, I was hoping for some magical solution for webgl that I did not know of
@Pryme8 we got an approval on 4D noise
I wont have time for it, but I’m sure if you have any questions I will be able to help.
Got it, I’ll take a stab at it, thanks!