perlin | Perlin : An Efficient and Ergonomic Document Search-Engine | Search Engine library
kandi X-RAY | perlin Summary
kandi X-RAY | perlin Summary
Perlin is a free and open-source document search engine library build on top of perlin-core. Since the first release no stone was left untouched. The then-perlin was moved to perlin-core and it will be replaced by a more top-level library. This new perlin aims to provide a user-friendly abstraction around perlin-core for document search engines. The documentation for version 0.1 can be found at and the code is available at the 'v0.1' tag.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of perlin
perlin Key Features
perlin Examples and Code Snippets
static float[][] generatePerlinNoise(
int width, int height, int octaveCount, float persistence, long seed) {
final float[][] base = new float[width][height];
final float[][] perlinNoise = new float[width][height];
static float[][] generatePerlinNoiseLayer(float[][] base, int width, int height, int octave) {
float[][] perlinNoiseLayer = new float[width][height];
// calculate period (wavelength) for different shapes
int period = 1 <&l
Community Discussions
Trending Discussions on perlin
QUESTION
I'm currently working on a 2D top-down game written in Java(FX). With each new game world a random map (background and vegetation) will be created based on Perlin Noise, the amount of created objects lies between 5000 - 7000. The individual parts of the vegetation (trees, bushes, rocks, etc.) are represented as rectangles "filled" with an image.
While playing the game, a player can exit a current world and create a new random one whenever he/she wants. When doing so, 5000 - 7000 new objects will be created that all need an image.
As far as I know there are two ways in JavaFX to add an image to a rectangle:
- By using rectangle.setFill(new ImagePattern(new Image(path)))
- Or by adding a CSS styleclass and using -fx-fill: url(path)
With the first option I very soon ran into OutOfMemoryErrors, while the second option runs perfectly smooth. I decided to start up VisualVM to see how big the difference in memory usage actually is, and it is insane. See the screenshots from VisualVM below to get an idea (3 new world are being created):
While both options store the image data within the memory's byte[], I'm wondering where this huge difference in memory usage is comming from? Is CSS somehow able to "fill" the rectangle without creating some sort of an image container and the image itself? If so, wouldn't it be possible to adapt that to JavaFXs setFill() method? What am I missing?😅
...ANSWER
Answered 2022-Mar-22 at 19:57You appear to be creating a new Image
for every rectangle. If you're creating 5000-7000 rectangles, you then have 5000-7000 Image
instances, which presumably replicate a lot of the same image data.
Instead, just cache the Image
s so you only load one per path:
QUESTION
Is there a good way to generate a random point in a 2D plane where the probability of choosing any specific location is based on Perlin Noise?
Essentially, when I generate a lot of points using such a method I would like to see many points in the areas where the Noise has high values and not so many in those where the value is lower.
Any ideas?
...ANSWER
Answered 2022-Mar-20 at 22:23Simple rejection-based approach:
- Generate random point
- Calculate Perlin noise value greater than or equal to 0 and less than or equal to 1 at point
- Generate random number greater than 0 and less than or equal to 1
- If random number is greater than Perlin noise value then discard point and go back to step 1 and try again, otherwise that's your point
QUESTION
I've been trying to make a 2D Minecraft-like game. I'm to the point where I've done the terrain generation, but I want to do cave generation now. I've experimented with Perlin noise, but found that the best I could get to were long connecting caves that never have dead ends. I then found out about perlin worms and realized it would be able to generate worm like caves.
I tried to do research on perlin worms, but there barely seems to be anything on it. Could you make a perlin worm function from a perlin noise function? If so, can you make it so that you could input a coordinate pair and it would return a value for that position like perlin noise functions?
Thanks in advance. All I need are ideas :)
...ANSWER
Answered 2022-Mar-01 at 13:12Perlin worms can be created from Perlin noise or any other noise by just considering if the terrain is in a narrow range around the middle value of the terrain.
It is kind of hard to explain, so I've created a visual representation for how you transform a noise into worms.
Original Noise (value noise) Transformed to WormsQUESTION
I am trying to generate a grid across my map and add nodes depending on the perlin noise value. Depending on the value obtained from the perlin noise at a location, I will add a new Node which will be of a certain type e.g. Mountain, Water etc to represent terrian. Here I am trying to make it so that if the value is > 0.5, this mean it's only mountains and so a black coloured cubes should surround the mountain areas, However, my black cubes do not match the mountain areas from the perlin noise and I cannot seem to figure out why I am going wrong. Would appreciate any insight into how I could go about achieving this.
...ANSWER
Answered 2022-Feb-23 at 04:59It think the issue is in
QUESTION
I need to create an animated smoke-like texture. I can achieve this with the 3D perlin noise using gradients passed from the CPU side, which i did:
But on the current project I cannot pass an array from the normal cpp-code. I'm limited to only writing HLSL shaders (although, all the following stuff is written in GLSL as it's easier to set up). So I thought I need to generate some sort of random values for my gradients inside the fragment shader. While investigating how I can tackle this problem, I figured out that I can actually use hash functions as my pseudo random values. I'm following these articles (the first and the second), so I chose to use PCG hash for my purposes. I managed to generate decently looking value noise with the following code.
...ANSWER
Answered 2022-Feb-04 at 11:26Oh, well. After I have posted the question, I realized that I haven't scaled the generated gradients properly! The function produced gradients in the range [0.0; 1.0] but we actually need [-1.0; 1.0] to make it work. So I rewrote this piece of code
QUESTION
[EDIT] Solved, see below for solution.
I am trying to generate a height map using Perlin Noise, but am having trouble with generating truly unique maps. That is, each one is a minor variation of all the others. Two examples are below:
And here is my code (most was just copied and pasted from Ken Perlin's implementation, though adapted for 2D):
...ANSWER
Answered 2022-Jan-27 at 02:26With some help from a friend of mine, I resolved the problem. Because I was using the same PERMUTATION array each generation cycle, the noise calculation was using the same base values each time. To fix this, I made a method permute()
that filled PERMUTATION with the numbers 0 to 255 in a random, non-repeating order. I changed the instantiation of PERMUTATION to just be a new int[].
QUESTION
I'm following the advice in this SO post. I want this blob to turn into other 3D models and back (like this). This set me on the path of Morphing, but I want to use shaders. The SO post (first link) has a basic run-through of how to do it. I'm currently adapting the example linked in that post to just go from start position
to end position
according to the variable time
. However, either the sprites are not displayed, or they are fixed at the end position. Please take a look and let me know where my logic is off.
Here is a snippet:
...ANSWER
Answered 2022-Jan-25 at 17:23Your time variable is not updating, it does if it is in animate() function.
shader:
QUESTION
I need a little help, I have this Perlin noise function, but I don't know how to properly create offsets.
I am using this to create infinite terrain generation and when I use this script it the noise values of individual chunks don't fit together properly. And they create holes.
Is there a way of fixing this ?
...ANSWER
Answered 2021-Dec-22 at 14:54It is quite simple actually, just add the chunk x,y coordinates to Mathf.PerlinNoise. Taking your code as an example, you can:
Pass chunkPosition as an argument to it:
QUESTION
I'm currently playing around with developing a game written in OpenGL instead of any popular game engine. This game revolves around procedural generation, wherein I need to generate a randomized floor (tileset) built from procedurally generated tiles (rooms), using a player defined (or random) seed, which'd provide the same resulting tileset each time used.
I found it difficult to generate such randomized tiles.
Let's consider this image a layout of such a room where the color black represents the room's surface and white stands for free space (beyond the player accessible area):Perlin noise I played around with doesn't necessarily generate an image with a singular ink blob that would touch at least one side of the image, which is what would be required for me to generate a tileset (requiring all tiles to be uniformly sized and have at least one entrance).
If you'd enlighten me on how to handle this particular problem, I'd be very thankful.
...ANSWER
Answered 2021-Dec-02 at 13:51There is definitely no one correct way to handle this. When dealing with random generation, you always have to be a little bit creative depending on how your generated room can be interacted with, and how it should look like. Some questions you might want to ask yourself at some point:
does your room have to be convex? Can you deal with rooms that have holes in the middle? Maybe they are even desired? I'm going to use the term "convex" loosely here, for lack of a better word, to describe a shape where each point is on the "outside"
how many exits should a room potentially have? 1-4? Should this number be dependent on the seed, or will it be supplied by whatever algorithm generates the level layout?
are the exits always in the center of their respective side? eg. top center, bottom center?
The image you supplied above is special, in that it is fully convex, and it has exactly 2 potential exits on opposite sides. This particular generation is relatively easy to replicate: Imagine it as a stack of blocks of varying width and height. All you have to do is generate the correct amount of random blocks and place them on top of each other randomly. Just make sure your blocks overlap sufficiently so there is a still a path from bottom to top.
Connecting 2 sides is simple: just stack your blocks from bottom to top and you will already have 2 potential exits.
Both other sides could be connected by either just straight up placing tiles from the respective side toward the center until they touch the room, or, which I find a more interesting idea: overlaying a second iteration of the same algorithm rotated by 90 degrees. This solution might generate holes/pillars though, which might not be desired.
QUESTION
I have the function CreateChunk(x,z)
that creates a "chunk" of terrain in the specified coordinates x and z that is a plane, whose vertex heights are modified with Perlin noise and then painted based on their height (a layer of water is added too) as you see below :
Everything works fine until I try to make more chunks:
I know this is how it should work and there is nothing wrong, but, what can I do to "synchronize" them so where one ends, the other starts? While keeping a procedural generation.
If you need the code tell me, but I was just asking for an idea to follow.
...ANSWER
Answered 2021-Nov-29 at 22:09You need to know what tile you want to build and what density of noise you want to have on the tiles.
For some ideas, have a look at this forum post: https://discourse.threejs.org/t/help-getting-the-actual-position-of-a-vertices-in-a-buffer-geometry/29649/4
And I'll leave the snippet here. Maybe it will be helpful for other seekers :)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install perlin
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page