Forum
Contact





DirectX using C#
DirectX using C++
DirectX using Visual Basic



Latest Forum posts

 Account settings
  Posted by: igthorn
  When: 21/04/2014 at 10:20:00

 Pavtube 2014 Easter Deals with 20% off
  Posted by: igthorn
  When: 21/04/2014 at 10:16:23

 20% off on iMedia Converter for Mac
  Posted by: VIKIVannessa
  When: 20/04/2014 at 01:35:54

 Pavtube Video Converter Ultimate Deal
  Posted by: VIKIVannessa
  When: 20/04/2014 at 01:35:50

 Easter Day Deals
  Posted by: Applefly
  When: 19/04/2014 at 22:18:14

 40% OFF Pavtube DVD Ripper for Mac
  Posted by: VIKIVannessa
  When: 19/04/2014 at 02:02:54

 DVD Ripper with 40% off
  Posted by: VIKIVannessa
  When: 19/04/2014 at 02:02:22

 Get DVD Ripper Wind/Mac + $14 Coupon
  Posted by: VIKIVannessa
  When: 19/04/2014 at 02:02:03

 Backup DVD Escape Plan
  Posted by: Applefly
  When: 17/04/2014 at 06:00:12

 Disney DVDs to MP4
  Posted by: Applefly
  When: 17/04/2014 at 05:56:07

 DVD movies through media streamer
  Posted by: VIKIVannessa
  When: 16/04/2014 at 02:25:09

 DVD movies to play on Galaxy Tab 3 10.1
  Posted by: VIKIVannessa
  When: 16/04/2014 at 02:20:51

 Blu-ray to Apple ProRes
  Posted by: Applefly
  When: 12/04/2014 at 00:47:46

 HD H.264 MP4 format
  Posted by: Applefly
  When: 12/04/2014 at 00:43:23

 DVD collection to computer
  Posted by: VIKIVannessa
  When: 04/04/2014 at 07:13:33

 DVD movies to play on Galaxy Tab 3 10.1
  Posted by: VIKIVannessa
  When: 04/04/2014 at 07:11:27

 DVD movies to play on Galaxy Tab 3 10.1
  Posted by: VIKIVannessa
  When: 04/04/2014 at 07:11:27

 DVD Ripper to populate
  Posted by: Applefly
  When: 04/04/2014 at 05:01:35

 kids and family watch DVD
  Posted by: Applefly
  When: 04/04/2014 at 04:59:21

 Blu-ray movie for your lovely kids
  Posted by: VIKIVannessa
  When: 02/04/2014 at 05:47:49




Topic: Multi-Texure Paths and Roads



  
Goto parent category
  
Create a new user account


   Multi-Texure Paths and Roads
 Poster : Ashe
 Posts: 1
 Country : US
 City:

  
Posted by Ashe on 12/03/2007 at 21:24:30
Hello,

I was wondering if you could give any insight on how you would create a path or road on a terrain?

Thanks!

-Ashe
 Poster : H4N5
 Posts: 18
 Country : Netherlands
 City: Den Ham

  
Posted by H4N5 on 09/08/2007 at 10:15:30
Only the red value of the heightmap is used for the height. You could use the blue or green value for the road in the heightmap. You make the weight for the sandtexture 1.0f when the heightmap has a high blue value, and you have a path.
 Poster : H4N5
 Posts: 18
 Country : Netherlands
 City: Den Ham

  
Posted by H4N5 on 09/08/2007 at 13:05:36
The new SetUpTerrainVertices() method:

private void SetUpTerrainVertices()
        {
            VertexMultitextured[] terrainVertices = new VertexMultitextured[WIDTH * HEIGHT];

            Color[] heightMapColors = new Color[WIDTH * HEIGHT];
            heightMap.GetData(heightMapColors);

            for (int x = 0; x < WIDTH; x++)
                for (int y = 0; y < HEIGHT; y++)
                {
                    terrainVertices[x + y * WIDTH].Position = new Vector3(x, y, heightData[x, y]);
                    terrainVertices[x + y * WIDTH].Normal = new Vector3(0, 0, 1);
                    terrainVertices[x + y * WIDTH].TextureCoordinate.X = x / 30.0f;
                    terrainVertices[x + y * WIDTH].TextureCoordinate.Y = y / 30.0f;

                    terrainVertices[x + y * WIDTH].TexWeights.X = MathHelper.Clamp(1.0f - Math.Abs(heightData[x, y] - 0) / 8.0f, 0, 1);
                    terrainVertices[x + y * WIDTH].TexWeights.Y = MathHelper.Clamp(1.0f - Math.Abs(heightData[x, y] - 12) / 6.0f, 0, 1);
                    terrainVertices[x + y * WIDTH].TexWeights.Z = MathHelper.Clamp(1.0f - Math.Abs(heightData[x, y] - 20) / 6.0f, 0, 1);
                    terrainVertices[x + y * WIDTH].TexWeights.W = MathHelper.Clamp(1.0f - Math.Abs(heightData[x, y] - 30) / 6.0f, 0, 1);

                    float totalWeight = terrainVertices[x + y * WIDTH].TexWeights.X;
                    totalWeight += terrainVertices[x + y * WIDTH].TexWeights.Y;
                    totalWeight += terrainVertices[x + y * WIDTH].TexWeights.Z;
                    totalWeight += terrainVertices[x + y * WIDTH].TexWeights.W;
                    terrainVertices[x + y * WIDTH].TexWeights.X /= totalWeight;
                    terrainVertices[x + y * WIDTH].TexWeights.Y /= totalWeight;
                    terrainVertices[x + y * WIDTH].TexWeights.Z /= totalWeight;
                    terrainVertices[x + y * WIDTH].TexWeights.W /= totalWeight;

                    if (heightMapColors[x + y * WIDTH].B > 200)
                       terrainVertices[x + y * WIDTH].TexWeights = new Vector4(1, 0, 0, 0);
                }

            for (int x = 1; x < WIDTH - 1; x++)
            {
                for (int y = 1; y < HEIGHT - 1; y++)
                {
                    Vector3 normX = new Vector3((terrainVertices[x - 1 + y * WIDTH].Position.Z - terrainVertices[x + 1 + y * WIDTH].Position.Z) /
                        2, 0, 1);
                    Vector3 normY = new Vector3(0, (terrainVertices[x + (y - 1) * WIDTH].Position.Z -
                        terrainVertices[x + (y + 1) * WIDTH].Position.Z) / 2, 1);
                    terrainVertices[x + y * WIDTH].Normal = normX + normY;
                    terrainVertices[x + y * WIDTH].Normal.Normalize();
                }
            }

            terrainVertexBuffer = new VertexBuffer(device, VertexMultitextured.SizeInBytes * WIDTH * HEIGHT, ResourceUsage.WriteOnly,
                ResourceManagementMode.Automatic);
            terrainVertexBuffer.SetData(terrainVertices);
        }
 Poster : H4N5
 Posts: 18
 Country : Netherlands
 City: Den Ham

  
Posted by H4N5 on 09/08/2007 at 13:09:00
Remember to make your heightmap a redscale image instead of a greyscale image!
 Poster : Anonymous
 Posts:
 Country :
 City:

  
Posted by Anonymous on 09/12/2012 at 21:16:32
Επειδή παρατηρώ μεγάλη κίνηση μέσω του Google να υπενθυμίσω πως το παρόν ποστ γράφτηκε στις 7 Αυγούστου 2009 οπότε δεν αποτελεί κριτική για τη δολοφονία του Σωκράτη Γκιόλια. Επιφυλάσσομαι στο προσεχές διάστημα να γράψω σχετικό ποστ.SOSTOΟ Τρωκτικός είναι ένας κιτρινιάρης συκοφάντης, εκβιαστής και λογοκλόπος που άξιζε να κλείσουν το βόθρο που είχε για μπλογκ. Αυτά για να ξεκαθαρίσω συνοπτικά την προσωπική άποψή μου για αυτό το άθλιο μπλογκPLAKA KANEIS OSO PALIO KAI NA EINAI AYTO DEN TO GRAFEIS!!!  Η ανωνυμία δεν είναι ούτε δικαίωμα, ούτε κατάκτηση. EINAI DIKAIWMA MOU!!! pios eisai esi( oxi esi prosopika milao gia ton kathe esi [giati preepi na eimaste kai akriveis vlepeis ])Υπερασπίζεστε την ασυδοσία και την τρομοκρατία του λόγου, στο όνομα μιας ψευδεπίγραφης ελευθερίας της έκφρασης, γιατί να την υπερασπιστούμε εμείς οι υπόλοιποι;asidosia ipirxe iparxei kai tha iparxei  ayto einai to internet ti perimenate??? tromokratia logou poli kanun alla kaneis den eipe tpt.tromokratia logou iparxei kathimerina stin tileorasi .propaganda kai pseydi stoixeia.thapsimo tou oti den mas simferei kai proothisi tou oti mas aresei i mas exoun plirosei na proothisoume!e-lawyer says:August 8, 2009 at 9:48 pmΜπράβο JAGO, πολύ καλή τοποθέτηση.Ως νομικός βέβαια, είμαι υποχρεωμένος να επισημάνω ότι η ελευθερία της έκφρασης περιλαμβάνει κάθε μορφή λόγου, όσο δυσάρεστη ή κακογουστη ή και κακοπροαίρετη κι αν είναι, εφόσον δεν απαγορεύεται από νόμο προσβάσιμο, προβλέψιμων συνεπειών και αναγκαίο σε μια δημοκρατική κοινωνία.den to diavases katholou ayto????kai an ipirxe sikofantia pseydologia kai otidipote allo sto troktiko.blogspot giati to idio to site den katirgise to blog? giati den eginas katagelies oste na  krithoun  oi ipeythinoi??? perimeno mia apantisi sou!!!!!!!!!!! kai i katagelia dld pou les esi oti tha kaneis ti einai??? sevasmos i amesi apeili???

  
Post a new reply
 





Google
 
Web www.riemers.net
If you appreciate the amount of time I spend creating and updating
these pages, feel free to donate -- any amount is welcome !
- Website design & DirectX code : Riemer Grootjans -
©2006 Riemer Grootjans


News
Home
Forum
XNA 2.0 Recipes Book (8)
XNA 3.0 Recipes Book (8)
Downloads
Extra Reading (3)
Matrices: geometrical
Matrix Mathematics
Homogenous matrices
Community Projects (1)
Tutorials (160)
XNA 4.0 using C# (89)
DirectX using C# (54)
Series 1:Terrain (14)
Opening a window
Linking to the Device
Drawing a triangle
Camera
Rotation - Translation
Indices
Terrain creation
Terrain from file
DirectInput
Importing bmp files
Colored vertices
DirectX Light basics
Mesh creation
Mesh lighting
Series 2: Flightsim (19)
Series 3: HLSL (19)
Short Tuts (2)
Resizing problem
Checking Device caps
DirectX using C++ (15)
DirectX using VB (2)