B4A Library Simplex Noise

This library generates a noise in 2D or 3D with the Simplex Noise algorithm of Ken Perlin. This algorithm is used to generate clouds, fogs, realistic terrains, etc. It's an improved version of the Perlin Noise algorithm.
Functions are not documented because I suggest that you read a few tutorials on Internet before using the lib (Google is your friend).
Since this library uses mainly the code of Stefan Gustavson, I credited him as the author. I added to his code a random generator for the seed, scales for each dimension, and two Multi functions to combine layers of noise. I included two basic examples using the libGDX library.
Don't ask me to explain you anything about this. As I said above, everything is explained at length in tutorials on Internet and the algorithm itself is of a very high level (I don't fully understand it).

In post #6, there's another example (3D landscape).
 

Attachments

  • SimplexNoise v1.1.zip
    14.4 KB · Views: 491
Last edited:

Informatix

Expert
Licensed User
Longtime User
Sounds interesting. Can you post a screenshot of what can be done with it?
If you take the result as a height and plot it in 3d, that gives things like that:
screen_result.png
 

walterf25

Expert
Licensed User
Longtime User
If you take the result as a height and plot it in 3d, that gives things like that:
screen_result.png
Very Nice Info, i ran the example you provided, and it runs very smooth, but how can i make it so that the smoke moves around?
 

Informatix

Expert
Licensed User
Longtime User
@Informatix
Hi,

How can I remove the space between the lines ?

I have a page together as a continuous surface
Reduce the grid step. But drawing a surface with lines is not very good for performance and you cannot apply a texture, different colors, etc. You should learn how to create a mesh with libGDX. You have an example of quad in the ShaderProgram_WaterSurface demo. The array value after X and Y (e.g. Verts(2)) is the Z value.
 

walterf25

Expert
Licensed User
Longtime User
The same example as above but with axis, colors and better use of screen space (needs libGDX v1.04).
Is it supposed to move real slow when I try to rotate?

I've tried the example on both my samsung tab 7 and my samsung s4, and it seems very slow.

Thanks,
walter
 

Informatix

Expert
Licensed User
Longtime User
Is it supposed to move real slow when I try to rotate?

I've tried the example on both my samsung tab 7 and my samsung s4, and it seems very slow.

Thanks,
walter
It's not supposed to be fast because drawing lines is an expensive operation but that should not be slow and on the three devices currently connected to my PC this example runs smoothly. All three are less powerful than your Samsung S4, so there's no reason for slowness on your devices, except they are... Samsung devices.
 

rkwan

Member
Licensed User
Hello, I am a newbie trying to use this good example to plot 3D scatter points.
However, I find that I cannot use the ShRdr.Point() to display anthing after drawing the axis lines
while using Shrdr.Circle2() can draw the circle.

B4X:
ShRdr.Begin(ShRdr.SHAPETYPE_Line)
   
        'Draws the 3 axis
        ShRdr.Color = Color1.WHITE
        ShRdr.Line2(0, 0, 0, 1, 0, 0)
        ShRdr.Line2(0, 0, 0, 0, 1, 0)
        ShRdr.Line2(0, 0, 0, 0, 0, 1)
    ShRdr.End
    'ShRdr.Begin(ShRdr.SHAPETYPE_Filled)
    ShRdr.Begin(ShRdr.SHAPETYPE_Point)
    ShRdr.Color = Color1.RED
    'ShRdr.Circle2(0,0,0.2,16)
    ShRdr.Point(0.5, 0.5, 0.5)
    ShRdr.End

Is it because I miss some other step/s before I can call the ShRdr.Point() please?!

Thanks & Best Regards,
Robert
 
Top