Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9244653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:05:21+00:00 2026-06-18T09:05:21+00:00

Currently, I have a random terrain generator, which I am sure works properly, however,

  • 0

Currently, I have a random terrain generator, which I am sure works properly, however, when I attempt to build a set of VertexPositionColor, it does not render properly. This is what I currently have (overhead view):
overhead view

My code:

List<VertexPositionColor> w = new List<VertexPositionColor>();
int width = 20;
int height = 20;
float terrainScale = 2.0f;
long seed = (DateTime.Now.Millisecond + DateTime.Now.Second * DateTime.Now.Hour);
ProceduralLayeredMapGenerator plmg = new ProceduralLayeredMapGenerator(seed);
Random rand = new Random((int)seed);
for (int y = 0; y < height; y++)
{
    for (int x = 0; x < width; x++)
    {
        Vector3 position = new Vector3();
        position.X = x;//(x - width / 2) * terrainScale;
        position.Z = y;//(y - height / 2) * terrainScale;
        float point = plmg.getPoint(x, y);
        Color computedColor = new Color(rand.Next(255), rand.Next(255), rand.Next(255));
        position.Y = (point * 2);
        w.Add(new VertexPositionColor(position, computedColor));
    }
}
colors = w.ToArray();

And then the drawing code:

foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
    pass.Apply();
    GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, colors, 0, colors.Length / 3, VertexPositionColor.VertexDeclaration);
}

How can I get it to look something more like this:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:05:22+00:00Added an answer on June 18, 2026 at 9:05 am

    If you want to draw a TriangleStrip then you must add the vertices in the order in which they will be used to draw the triangles; right now you’re adding vertices top-to-bottom, left-to-right. Also, to render a height map like that you’ll need to use multiple TriangleStrips.

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

Sidebar

Related Questions

I currently have this snippet which spits out a random image $imgDir = 'images/';
I currently have a method to attempt to get a random float between two
I currently have the code below which successfully sets a random image from an
I currently have built a system that checks user IP, browser, and a random-string
Currently, I have an array of Strings, each with random characters in it that
Currently have password protection on my main and sub directories, however I'd like to
I currently have a table of concentrations, which are linked to a table of
I currently have a string which contains the characters A, B and C for
Is it possible to model random failures in Alloy? For instance, I currently have
Currently have a Magento install running which seems to be printing #.UD3vymhSSYV at the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.