• Advertisement
Sign in to follow this  

Unity Unity - GPU calculations (Noise)

This topic is 642 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my game, I'm using BillowNoise to generate caves for my planets - it's also currently the most intensive part of the game. Th game isn't very graphically intensive, so I wanted to know if there are any good ways to move calculations to the GPU, fixing the CPU bottleneck.

 

Thanks! Again, just an idea.

Share this post


Link to post
Share on other sites
Advertisement
When getting values for noise in the caves, it slows down the generation by 20%. This random noise (BillowNoise) is necessary to get the correct look and structure of caves. If the value returned by the noise is over 0.5, the given block is set to be empty.

Share this post


Link to post
Share on other sites

Sample a 3D texture containing random values.  Depending on your use case this needn't be a huge texture, and if you don't need 3D noise you can get away with a 2D or even 1D texture.

 

If you also need to get the result back on the CPU things could get exciting (or interesting) though.

Share this post


Link to post
Share on other sites

You could generate only every second voxel with BillowNoise, and average the empty voxels inbetween afterwards with neighbours.. This will give you a good speed increase, and you'll probably not notice any big visual difference :)

 

Example:

1x 32x32x32 chunk = 32768 voxels

1x 16x16x16 chunk = 4096 voxels

= 8 times faster, if you only calculate every second voxel in a 32x32x32 chunk :)

Share this post


Link to post
Share on other sites

You could generate only every second voxel with BillowNoise, and average the empty voxels inbetween afterwards with neighbours.. This will give you a good speed increase, and you'll probably not notice any big visual difference :)

 

Example:

1x 32x32x32 chunk = 32768 voxels

1x 16x16x16 chunk = 4096 voxels

= 8 times faster, if you only calculate every second voxel in a 32x32x32 chunk :)

I will implement this idea - Still wondering, though, if it's possible to have the GPU do the math for the noise.

Share this post


Link to post
Share on other sites

You could try supplying your shader with a random seed through a constant buffer, then use this function to generate random numbers based on voxel XYZ (like XY, ZX, YZ etc. supplied as input to the function, with the random seed added/multiplied/whatever to the input):

float rand(float2 co)
{
    return frac(sin(dot(co.xy ,float2(12.9898f, 78.233f))) * 43758.5453f);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By RoKabium Games
      Another one of our new UI for #screenshotsaturday. This is the inventory screen for showing what animal fossils you have collected so far. #gamedev #indiedev #sama
    • By eldwin11929
      We're looking for programmers for our project.
      Our project is being made in Unity
      Requirements:
      -Skills in Unity
      -C#
      -Javascript
      -Node.js
      We're looking for programmers who can perform a variety of functions on our project.
      Project is a top-down hack-and-slash pvp dungeon-crawler like game. Game is entirely multiplayer based, using randomized dungeons, and a unique combat system with emphasis on gameplay.
      We have a GDD to work off of, and a Lead Programmer you would work under.
      Assignments may include:
      -Creating new scripts of varying degrees specific to the project (mostly server-side, but sometimes client-side)
      -Assembling already created monsters/characters with existing or non-existing code.
      -Creating VFX
      -Assembling already created environment models
      If interested, please contact: eldwin11929@yahoo.com
      This project is unpaid, but with royalties.
       
      ---
      Additional Project Info:
      Summary:
      Bassetune Reapers is a Player-verus-Player, competitive dungeon crawler. This basically takes on aspects of dungeon crawling, but with a more aggressive setting. Players will have the option to play as the "dungeon-crawlers" (called the 'Knights', or "Knight Class", in-game) or as the "dungeon" itself (literally called the 'Bosses', or "Boss Class", in-game). What this means is that players can choose to play as the people invading the dungeon, or as the dungeon-holders themselves.
      Key Features:
      -Intense, fast-paced combat
      -Multiple skills, weapons, and ways to play the game
      -Tons of different Bosses, Minibosses, creatures and traps to utilize throughout the dungeon
      -Multiple unique environments
      -Interesting, detailed lore behind both the game and world
      -Intricate RPG system
      -Ladder and ranking system
      -Lots of customization for both classes s of customization for both classes
    • By RoKabium Games
      Custom coffee mugs have arrived... More caffeine!
      Have a great weekend everyone! 
      #gamedev #indiedev #sama #caffeine
    • By Atwo Studios
       
      Hey guys,

      Anthony here from Atwo Studios bringing you some new updates for the new year!
      In this video I go over our game ROY, the new games and some general updates to the company!

      If you have not checked out ROY feel free to give it a try! Many people have said they enjoyed the game thus far!
      ROY: https://goo.gl/o6JJ5P
       
    • By Affgoo
      https://play.google.com/store/apps/details?id=com.NE.Alien
      still a lot of work to do, but its pretty stable  please let me know what you think <3
      Atlas Sentry is a game of destroy everything. Using your turret, simply swivel and shoot your way to victory, upgrading your weapons to unleash destruction on the variety of spaceships. The bigger your combo’s the more score you get! Earn silver as you play and then purchase new weapons and abilities to better deal with your enemy. Different enemies use different tactics and weapons, work out your own priorities in their destruction order. 

      Features: 
      **2 different game modes 
      **A level select mode with 20 difficult levels including a final boss, can you defeat it? **Arcade mode of endless destruction, how long will you last? 
      **High scores to compete against others, see who can take the top spot. 
       
  • Advertisement