Procedural texture modulescript

Does something like this exist?
I’m doing some terrain generation, but without using procedurally generated textures that can cause rises and falls across large numbers of vertices, the terrain has to look mostly flat to limit the amount of difference between neighbouring vertices.

Something similar to the noise texture in Blender Cycles would be good, this kind of lighting would go amazingly with trenches created through a high distortion value.

1 Like

Such a system is impossible in Roblox. Roblox does not want its users to be able to see any image that isn’t moderated and procedurally generated textures can’t be moderated.

3 Likes

I don’t mean visible textures; procedural textures have a lot of uses, they’re simply a function where you put a vec2 or vec3 in and get a float or colour value out.
The important thing about a procedural texture is that it’s not just pure noise, the same inputs will give you the same results every time and very slightly different inputs will give you very slightly different results.
Since it’s not just pure noise, it means that I can use it to adjust the heights of vertices by hundreds of studs without getting spikes hundreds of studs high.

1 Like

You can’t change images on Roblox other than their transparency or their color multiplied by some value.

The closest you can get to what you want is to use multiple images on top of each other to create textures seemingly random ones.

Did you even bother to read?
This is pure math, no images.

2 Likes

Have you looked at Perlin noise? You didn’t mention it in your post so I’m not sure if this is sufficient or if you’re after something more customisable

It’s a start, but ever since I was 10 I hated that the results that algorithm produced.

Yeah, Perlin Noise gives me PTSD from back in the day. I see any problem that involves Perlin Noise as the solution and I can’t help but freeze and stare blanky.

So why did you even mention “textures” then? Are you trying to procedurally generate terrain?

If so, essentially, you’re talking about creating a height map to use them in your terrain generation.

I don’t think anybody created a system (module script) since storing image like data and doing processes on it (like blender or substance designer) would be far too memory intensive. You’d be better off procedurally generating on the spot for every grid you have for your terrain.

I’d suggest looking at Roblox’s Plugin for terrain generation as I believe that’s the most advanced one there is around.

Looks like he had ment height mapping, which is a method of displaying 2d values in a range as pixels colored at a varying degree of white and black, often used as a means of editing terrain data outside of the 3d environment the terrain’s displayed in.

I’m pretty sure your confusion is stemming from a correlation between the data it’s self, and the image representations of it. Completely forget about height map texture images and think of it as nothing more than a 2d array of numbers clamped to a range, usually 0 - 1. The indexes of the 2d array represent X and Z axis, while the value at any given set of indexes represents the Y axis alpha, which you apply to your predefined range to find the ‘altitude’ at that given point.

As @ForyxeV mentioned; roblox provides a perlin noise algorithm implemented as an additional method to the math library. Perlin noise belongs to a family of noise algorithms called gaussian noise, which are usually used together to generate terrain.

Manipulating these 2d arrays of noise is essentially identical to image manipulation of a white and black image, so there’s lots of awesome resources on code and algorithms for that. You’re going to want to generate multiple sets of noise data arrays, and ‘blend’ them together. From personal experiments I’ve noticed that Perlin noise is better suited for shapes like islands, as it produces black blobs. Simplex Noise (another gradient noise algorithm) produces more of what you would want for mountain ranges, as there’s better interconnectivity of ‘channels’ of white surrounding less intense black blobs.

Terrain generation is a monumental task mathematically, but there’s a lot of resources you can find on the internet to help you along. Here’s one of my personal favorite blog posts on the subject. The author provides a great summary of height map methods, as well as C-esque pseudo code you can adapt to Lua to have a good foundation to build off.