Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 37625
In Process

askthedev.com Latest Questions

Asked: January 12, 20252025-01-12T03:14:45+05:30 2025-01-12T03:14:45+05:30

How can I apply continuous 2D Perlin noise to a procedural 3D mesh while considering its surface normals?

anonymous user

I’m working on a procedural generation project, and I’ve hit a bit of a roadblock. I’ve generated a 3D mesh using Perlin noise, but now I want to add some detail to its surface that makes sense based on that existing mesh structure, and I want to use a continuous 2D Perlin noise for texturing.

The first challenge is maintaining the continuity of the 2D noise across the 3D surface. The concepts in Sebastian Lague’s tutorial were super helpful for generating 2D Perlin noise, but I’m unsure how to map that noise onto the 3D mesh without making things look stretched or distorted. I need the noise to flow naturally across the surface. Do I just project the 3D coordinates down to 2D when sampling the noise, or do I need to do something more complex?

Additionally, I thought about taking the noise value at each point on the mesh and translating that value into height based on the surface normal. But how exactly do I go about calculating this height adjustment? My goal is to create a kind of “biome” effect inside this 3D environment, so I want to ensure that the variations in the noise correspond meaningfully to the surface shape without disrupting the overall coherence of the mesh.

If I wanted to apply different textures or features based on regions—like adding “mud” in some low areas and “rock” in elevated spots—would I need to layer the 2D noise in specific ways to achieve that, or use additional Perlin noise functions to blend between different types?

I’m really hoping to unlock this next step in my project because I envision a massive cave-like environment with varied textures and elevations that feel real and immersive. Any tips, tricks, or resources you could share would be immensely appreciated. Thanks!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2025-01-12T03:14:46+05:30Added an answer on January 12, 2025 at 3:14 am

      Sounds like you’re diving into some exciting stuff with your procedural generation project! It can definitely be tricky to blend those textures on your 3D mesh without things getting all stretched out.

      So, when it comes to maintaining the continuity of the 2D Perlin noise across your 3D surface, you’re on the right track by thinking about projecting 3D coordinates to 2D. A common way to do this is to use the mesh’s UV mapping. If your mesh has UVs, you can sample the 2D Perlin noise using those UV coordinates directly, which should help keep things looking nice and smooth. If not, you might need to compute those UVs based on your mesh’s shape so that it doesn’t distort when you apply the noise.

      Now, for adjusting the height based on the surface normal: what you can do is calculate the normal at each vertex of your mesh, and then use that normal to adjust the height of your mesh slightly based on the noise value you get. Basically, you take the noise value, scale it to your desired height, and then move the vertex along the normal direction. It’s like giving your surface some bumps and dips while keeping it aligned with its overall shape!

      If you want to create different textures or features like “mud” in low areas and “rock” in high spots, layering the 2D noise could be a good approach. You could generate multiple layers of noise with different scales and use them to blend between textures. For instance, if the noise value indicates a low area, you could blend in a mud texture, while high areas could fade into a rocky texture. You can also use thresholds based on noise values to determine where to switch textures.

      Lastly, don’t forget to play around and tweak values! Procedural generation is as much about trial and error as it is about following concepts. There are tons of resources online, like forums and YouTube tutorials (Sebastian Lague has some great ones), where you can find more tips and examples.

      Good luck, and have fun with your cave-like environment! It sounds like it’s going to be a really engaging world!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2025-01-12T03:14:47+05:30Added an answer on January 12, 2025 at 3:14 am

      To map 2D Perlin noise onto your 3D mesh while maintaining continuity, you should consider using a combination of UV mapping and the mesh’s normal vectors. Projecting the 3D coordinates onto a 2D plane directly (for instance, using the X and Z coordinates) can help, but it’s crucial to ensure that the UV mapping accounts for the surface curvature and orientation. You can achieve this by deriving UV coordinates based on the mesh’s normals as well as its position in 3D space. A common approach is to use the dot product between the normal of each vertex and a consistent reference direction to generate the UV mapping. This method will help you obtain noise values that appear consistent and cohesive across the varying surface areas of the mesh.

      For generating a biome effect, you can indeed modify heights based on the noise values and the normals. After obtaining the Perlin noise value at each vertex, you can calculate the adjustment by projecting this value along the normal vector. To create the specific textures, consider layering multiple noise functions or applying thresholds to the noise values—higher values could correspond to rocks, whereas lower values could represent mud. This multi-layering approach allows for smoother transitions between different biomes and can give you that organic feel you’re aiming for. Additionally, utilizing blending techniques, such as linear interpolation or noise-based masks, will enhance the visual fidelity and variation in your cave environment. Resources like “The Nature of Code” or articles on texture blending can provide further insights into these techniques.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.