Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Ultimate Terrain/Landscapes

Author
Message
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Mar 2007 12:04
Yeah, that's just a leftover, there's actually nothing lit as the the shader has it's own lighting, that would have to be fixed if I added objects though.

I think your on the right track with the terrain, although maybe try and spread out your fine detail for longer, and only update the heights when you've moved a certain distance.

I plan to make a big memblock terrain, just a grid of polygons, maybe 128x128 grid, but when the grid is more than 64 units wide or high I'll spread out the size of the tiles, so it kinda warps out to the overall size I need, while keeping those middle areas high detail. I'm going this route as it's the easiest to work out, I mean blending the different regions of detail would be the tricky part in your case, so I'm trying to avoid anything too complex.

Hehe, I tried to cheat yesterday and used a test mesh loaded in, then spread out the outer detail verts depending on their position. It ended up multiplying right out of sight because the vertice offsetting is permanent, so each time it would spread things out more and more. I think to get around that I could have just limited to the spread out to the first pass, but it was late and I was stupid .

I'm starting to really like these vert adjustment commands, have they gotten faster? - I don't get any slowdown at all when updating the mesh, and my meshes have all been kinda high poly. I get about 700fps in my demo, I've been dying to know what frame rates I'll get with this method once a shader is working. Incidently I tried it with the old style colour mask shader too with the same results. I'd settle for either shader to be honest, I'm thinking that the big welded blanket mesh method will be great for performance.


Good guy, Good guy, Wan...
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 21st Mar 2007 18:06
The size is arbitrary as it relates to the scale of the terrain.
1 unit pitch could be 1cm or 1m. The amount of units per size was for explanation purposes only and not actual values.

Notice that I double the pitch, this means that between each transition I have, I go from three verts to two, this can easily be mapped with three polys. And since I know exactly where this will happen I can use a function to use the distant texture and fade to the near texture 0 to 100% transparent.

Here is a nice trick... (or Idea 3053)



You could use this to offset each successive row/col from the center to get a gradual outward enlargement of the grid...

I'm trying several methods at the moment, each new idea spawns several more ideas. My main issue is mapping this grid back to my original procedural texture for the heights.

*note In the above code example 'blah...' isnt a valid command.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 23rd Mar 2007 17:49
Ok guys..
Sort of related as its part of my Ultimate Terrain Project

I'm having a litle problem with my code. (See attached source code ->

This matrix appears to scroll and reposition correctly 99% of the time however at certain Camera Angle Y's it causes a jump in the matrix movement, I suspect there is something wrong in my 'RePosMatrix' function, at the moment I can't figure what...
Any help would be appreciated.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Mar 2007 18:23
Try using a float instead of an integer on the .ix, .iy, and .iz elements in your cam type.

When I tried it, I couldn't get it to jerk like that - I could when ix etc were integers, I think it's just some dodgy internal maths with integers and floats, causing the step to be inconsistant.


Good guy, Good guy, Wan...
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 23rd Mar 2007 18:35
Hi Van...

I'm using the integers because I'm updating the matrix offset every 2 units, using floats would just keep it the same as .X and .Z wouldn't it ?

I'll give your suggestion a try when I get home.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Mar 2007 18:44
Righto, well if your updating the matrix every loop anyway, why not just snap it to a grid based on the camera?

Like:
Function RePosMatrix()
MM = MW / 2
Cam.iX = int(Camera Position X()/4.0)*4
Cam.iZ = int(Camera Position Z()/4.0)*4
Position Matrix 1,Cam.iX-MM,0,Cam.iZ-MM
Update Matrix 1
EndFunction

I think that might avoid the issue.


Good guy, Good guy, Wan...
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Mar 2007 18:53
I was messing around with memblock matrices yesterday, and I think my bug was due to excessive vert counts, I made a 100x100 tile terrain instead, and it works. I'm not happy with the quality though, I mean I have it spread out the vert positions but there's a noticeable change in the distant terrain that's bugging me, so I'm gonna percevere with a more optimised terrain but with less poly's.

I'm getting some crazy frame rates with this small terrain though, view distance is a lot more, close detail is the same, but the frame rate is like 5 times more than with individual 32x32 tile terrains, even when deleting the unseen detail when updating the cam position.

I have it reserving a radius in the middle of the terrain that stays at the close detail level, then beyond a radius of 16 tiles the verts spread out like a spider web, so loose their grid appearance, which is actually really bad when it updates, especially as I'm using just 1 ground height for a vert that's supposed to cover 3x3 tiles or so.

Anyhoo, gonna try and get something more like my original mesh working, as that seemed to look better.


Good guy, Good guy, Wan...
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 23rd Mar 2007 23:24
Thanks Van
I got it working (it was the floats)
I changed the iX and iZ to float and modified the rePosMatrix function thus...



I've still got a slight delay when updating the procedural texture that I'm using for my height map,(note I've implemented an update system) but as the FPS are still in the 1000s, I can live with that.

Im using Cam.X,.Z to hold the player position, I'm going to modify the rotations using the mouse.

I'm trying to figure out the best way to modify my matrix to achieve the doubling in scale every 32 grids, I guess I'd only need to do this on initialization as it's only the Y component that'll change and I can get those directly from my heightmap using the X and Z component from the matrix.

Haven't figured how to handle near vertical land features like cliff's yet..

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 23rd Mar 2007 23:41
Here is how I intend to have my matrix, Ive only shown one transition here but I intend doubling each successive zone in a similar way with around 8 zones.
___ ___ ___ ___
| / | / | / | / | <- Grid 32x32 Low Detail
___ ___ ___ ___
|\ /|\ /|\ /|\ /| <- Grid 32x16 Transition
_ _ _ _ _ _ _ _
|/|/|/|/|/|/|/|/| <- Grid 16x16 High Detail

The highest detail zone will probably be twice as detailed as my previous demo...

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 30th Mar 2007 22:26
@gg I know that you have put alot of work into this and I was wondering if you could do one more thing with the shader.

I Would like to be able to put roads on the terrain, I would just like to make a black and white map or some 2-color map, that I would draw the road on. Then after the shader does its thing it can blend the road in. What do you think? Kinda like how you did the rgb map. Thank you.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 31st Mar 2007 01:03
OK - but not tonight.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 2nd Apr 2007 12:09
@David & GG
before you begin with the roads, I'd suggest thinking exactly what you intend doing....

let me explain, mostly, roads come in diferent flavours, single, dual cariageways, different road types m-way etc. each of these has a variety of border, hedge, wall, pavement, hard shoulder etc.
Texture mapping these could be done using a simple colour system.

Red value = road type
green value = border type
blue value = hedging type

The main point though is, most roads tend to cut into or protrude out of the surrounding terrain and tend not to follow the up's and down's religiously. I think you should have some code to modify the vert's accordingly.

I just love throwing spanners in the works, Implementing this should keep you guys busy for quite some time. hehe

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Apr 2007 12:57
And don't forget that you'll need more RGB maps to represent the different varieties of weeds, flowers, insects, birds, etc, that are found along every road (especially around here ).

All this should keep us occupied for quite a while.

But thanks for the reminder anyway. I'd forgotten I was going to look at this.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 2nd Apr 2007 13:15
One thing that might help, hopefully without getting too complex, would be a 1-bit transition. Like when you use the 1-bit tranparency mode, anything under like 25% transparency is ignored, anything above that is treated as no transparency, so you get really detailed edges, rather than fading out the alpha element, it makes it 1-bit and gives curves etc to the transparency. This is what I used for roads originally.

If you could do that with a layer on the colour mask, like Blue for instance, like anything less than 128 is ignored, but a blue value of 255 draws the road - then in the shader you could smooth it out, so instead of blending, you get really curvy tarmac. Not sure how easy this would be to do, really it's like this in DBPro code:

Blu=rgbb(pixel_color)
if blu<128 then blu=0 else blu=255

Might be real easy, but the actual smooth pixel by pixel blending would provide sharp but curvy track rather than blended. It wouldn't impact the rest of the shader too much either, you could still blend and shade using the colourmask. Know what I mean? - I'm sure it's possible that even say, a 8 pixel wide road could get the curves using this technique.This would be an absolute dream for a city based game like GTA, you'd only have to draw lines on an image to make an entire road system.


Good guy, Good guy, Wan...
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 2nd Apr 2007 13:31
So eh, Ummn, how do we set the display mode again? hehe

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 2nd Apr 2007 13:36
Come to think of it, I had a neat little function that created a random grid of intersecting lines of different lengths that I used to texture the sides of a Borg Cube. I'm sure I could addapt it to create a random City/Road network.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
jrowe
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: Here
Posted: 6th Apr 2007 01:31
Wow! this is great I'll definitely be implementing some of the ideas from this thread in my future projects. And GG, that shader is brilliant!

Tinnedhead Productions

For Fathers and Sons who enjoy wholy spirits.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Apr 2007 02:41
Thanks.

I'm going to be quiet for a few days - busy entertaining son and grandson (yes, true!), but after that I hope to be back to this thread.
Super Smash
20
Years of Service
User Offline
Joined: 4th Jul 2005
Location: At my computer
Posted: 6th Apr 2007 02:47
Is it a matrix the world is being built on? If so how do you texture it liek that?

I rule you all
-SuperSmashcz
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 6th Apr 2007 15:46
its just an object, and you use the shader in this forum, version 1 or version 2.

.....
Super Smash
20
Years of Service
User Offline
Joined: 4th Jul 2005
Location: At my computer
Posted: 6th Apr 2007 17:16
how can u make it a object? Like manipulate it in such a way that you can raise\lower parts of it, color parts of it, collision,its very interesting to me.

I rule you all
-SuperSmashcz
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Apr 2007 17:24
Why not read the thread instead of having someone explain it all to you - no offence but it seems kinda silly to go over this all again when it's been discussed so thoroughly already. There's examples posted, screenshots, every variation of decent terrain solution has been tested during the lifetime of this thread and there's 2 variants of terrain shader to play with too.

I already posted a working example of a tablecloth terrain object, you just have to look for it.


Good guy, Good guy, Wan...
revenant chaos
DBPro Master
18
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 11th Apr 2007 14:45
Great job so far, but you should eventually add in a way to make the player realistically slide down hills / stop the player from ascending too high, or up too steep of a slope
Alduce
22
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 11th Apr 2007 15:22
hi all, excuse me if i ask.. i download the demo file of this advanced terrain and this is awesome!! so.. is only a proprietary demo or this is a terrain editor? So is possible to think about have it?
Thx
Alquerian
19
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 11th Apr 2007 20:30
This is just a demo, it is not a terrain editor. I am tossing around the idea of implementing this in my terrain editor, however this method is currently too slow to be viable for most products. I am approaching this same issue through different methods, here is the WIP:

http://forum.thegamecreators.com/?m=forum_view&t=103391&b=8

Also, I think the Arrayinator is attempting to implement this in his terrain editor as well:

http://forum.thegamecreators.com/?m=forum_view&t=103526&b=8

Terrain Generation has a whole new face.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 17th Apr 2007 15:35 Edited at: 17th Apr 2007 15:43
I've just modified my code to include Fog...



this allows me to use a matrix 100x100 with 50x50 sections, as this stays with the player as they move, the scenery appears when in range and frame rates are still high and the updating edge is hidden by fog.

I'm still having problems though with my RigidMultiFractal Heightmap tearing when the player is in a negative X/Z position

@GG I was wondering if your shader could work with two light sources with colour ?

I'm thinking a Sun and a Moon both moving and changing colour.
Also the ability to clip or dissable when below the horizon, I can set a bit to 1 when either is visible.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Apr 2007 23:38
Quote: "I was wondering if your shader could work with two light sources with colour ?"


The code would need to be extended - but I'm sure it can be done. There will be some performance loss of course.

But I should sort out the roads issue first.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 18th Apr 2007 15:33
Damn!!! Thought I'd fixed my Procedural function (it's still bugged)

May need to post code to see if anyone can figure whats wrong...
It fills the bitmap as expected.

When I move the player X/Z and they cross any grid line the whole heightmap gets copied and offset pasted onto itself then the whole new edge is filled with the procedural function with the relevent offset. all this appears to work fine until...

under close inspection it appears, as destinctive landmarks scroll off the heightmap, if you reverse back along the same path or do 180 the map scrolls correctly but the procedural infill no longer matches what just scrolled off.

I,ve tried several modifications but can't figure why this is happening, I hope it's not something simple like the float issue I had earlier.

I'm also trying to modify the code to allow for scalling of the procedural so from 0 to 100% width/height of the heightmap I can scale the procedural from 1:1 to 100:1 or even bigger, if I do this in realtime I guess the effect would look like your shrinking, ala "Inner Space (The Movie)".

I've Stripped down my attached code back to the minimum you'll need some sort of Perlin2D() function for this to work.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Apr 2007 23:40
@TinTin

I've had a very quick look at your code and haven't really got to grips with it yet.

However, the following lines don't "feel right" to me. What are they supposed to do exactly - and do they actually do it?

david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 19th Apr 2007 02:56
I cant get it to run, but I agree with gg that something isnt correct in those lines.

What exactly is the perlin2D that I need, what does it create, the image the heightmap is grabbed from?

why not just post the perlin2d you have so I can run then debug this.

Thank you.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 19th Apr 2007 14:18
To explain what those lines do...

Say the player has moved +/- X units in the X and/or Z direction.
The XM and/or ZM gets set to +/- 1 to flag a move.
The previous Image copy/paste offsets the bitmap by +/- 1 in that direction.
These lines then fill the empty edge's with new pixels, hence the for 0 to 100 (the heightmap is 100x100) each pixel of which, will be mapped to a matrix vertex as its height.

I've attached a cutdown (very basic) Noise.dll just stick it in your Compiler\plugins-user\ folder.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 21st Apr 2007 04:34
I just put in the welded vertex's code into my terrain and I can now generate random terrains on the fly, so easy. Also the vertex's update so much faster. I can now write the function for real time land deforming. This terrain system is really starting to take off. and using GG's terrain shader, the terrian will automatically texture itself in real time. So when you blow a hole in the ground it will automatically texture it correctly. This is getting so sweet.

Anyways, using my memblock terrain I can still only get two textures working with gg's shader.

@gg if you are there, I will post the code, and perhaps you can figure out why, I can only use two textures instead of all 4, for the land.

Let me know and I will post what I got. Thank you.
Alquerian
19
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 21st Apr 2007 07:24
Quote: "Also the vertex's update so much faster. I can now write the function for real time land deforming. This terrain system is really starting to take off. and using GG's terrain shader, the terrian will automatically texture itself in real time. So when you blow a hole in the ground it will automatically texture it correctly. This is getting so sweet."


This is EXACTLY my goal in finding welded vertices. I am glad that we now have a viable solution.

Visit the Wip!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Apr 2007 13:42
Quote: "@gg if you are there, I will post the code, and perhaps you can figure out why, I can only use two textures instead of all 4, for the land."


What FVF format are you using, or converting to?


Good guy, Good guy, Wan...
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Apr 2007 22:59 Edited at: 21st Apr 2007 23:02
Quote: ""@gg if you are there, I will post the code, and perhaps you can figure out why, I can only use two textures instead of all 4, for the land"


Are you using the shader which blends the four textures according to altitude and slope? If so, the problem is probably to do with the settings assumed for the altitude scale of your model. I'd need to see both the shader (to be sure we are talking about the same shader ) and the dba code.

Edit:

@Van B and David W

You asked for roads to be included. I hope to sort that out tomorrow or Monday. But just to be sure I'm working with the right shader, could you confirm which shader you want modified?
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 21st Apr 2007 23:03 Edited at: 21st Apr 2007 23:25
@ David W
If you look at my code, hopefuly when I get it working correctly, You will see that by using a Procedural equation to generate the height map, I will be able to create a virtualy limitless terrain that once the player has moved far enough to have generated a whole new heightmap, they can backtrack to thir starting position and the terrain will be as before.

I think that by using the result from multiple functions i.e. RigidMultiFractal + Blob + fCos, I should be able to generate an island of a certain size, with mountains, valeys, plains, bays, cliffs etc...

Add GG's shader to this and things start to look realy nice, of course your fasst memblock terrain would also be an enhancement.

I've also had an idea of not using greyscale for the heightmap because this limits me to 256 heights which is realy small...
I've thought of this idea
Height = RGBR(C)+256*RGBG(C)+256*256*RGBB(C)
which gives a height range of 0 to 16777215, much better.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Apr 2007 00:18
Quote: "I've thought of this idea
Height = RGBR(C)+256*RGBG(C)+256*256*RGBB(C)
which gives a height range of 0 to 16777215, much better"


Sounds good - but how would you create the texture?
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 22nd Apr 2007 01:35
@gg I am using the shader that uses the altitude and slope. I am going to check the fvf format, and see if that is the problem first.

With the other shader, you can already paint a road onto it. Anways, With the new terrain/with roads shader, you can take out the normal mapping because its really not needed, and just causes overhead anyways. That will free up some textures/memory at the least.

Thank you.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Apr 2007 13:21
Quote: "With the other shader, you can already paint a road onto it."


Of course you can - how silly of me.

Quote: "With the new terrain/with roads shader, you can take out the normal mapping "


I was thinking of keeping that as a feature so that you could get a ridge, kerb or edge effect along the sides of the road. It could affect performance though, so if I have time I'll use two (or even three?) techniques, with and without normalmapping.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 22nd Apr 2007 18:29
sounds good.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Apr 2007 01:28 Edited at: 23rd Apr 2007 11:52
Making progress. Got the basic idea working - just needs final testing/tweaking with suitable terrain object and textures.

The attached screenshot shows the DarkShader preview window with the shader applied to a sphere. You should be able to make out the road.

Intend to get a decent demo finished tomorrow (the roads don't include normal mapping yet - I'll see how it works out without first).

Edit: Attached the screenshot this time.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 23rd Apr 2007 04:36
here is my the project with the welded vertexes, and the .dbo file that I am using. when you run it you will see what I am talking about, only using 2 textures. It looks good though. Thanks for taking the time to look over this.

If anyone can help me get this to use more than 2 textures it would be very helpful and appreciated

Thank you
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Apr 2007 11:51 Edited at: 23rd Apr 2007 12:14
Ok, I'll have a quick look today.

I'll also edit my previous post and attach the screenshot.

Edit: Just had a quick look at your demo. As you say, it looks good. My immediate reaction is that you are only seeing two textures because there are no steep slopes and there is not much range in altitude. I'll now have a closer look at the code and see if there is a simple fix.

Edit2: It would help if you could tell me which textures you expect to see on which parts of the terrain (although I can probably deduce it from the code).
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 23rd Apr 2007 12:26
@GG Sorry for the delay, it's been hectic this weekend.
1st as I intend using a procedural function to generate my heightmap on the fly, this should return a value somewhere in the range -1.0f to +1.0f per pixel.
2nd I just have to multiply this to get the height range required this would then be refactored to get the desired colour and viola an odd coloured heightmap with a masive height range.

P.S. Has anyone managed to figure out why I'm getting a different patern with my scroll function yet ?

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Apr 2007 12:46 Edited at: 23rd Apr 2007 19:22
@david w

The reason you are only getting two textures is that the normals for your terrain vertices all seem to be (nx,ny,nz)=(0,1,0). The shader uses this to calculate the slope (it just uses ny). So all the terrain is interpreted as flat. The only remaining dimension is the altitude - high will give one texture, low will give another.

Fix those normals (I couldn't see any lines changing the normals in your code) and you should start seeing the other two textures.

[Edit: just seen the following function GenerateNormalsForLimb. It is obviously not working as intended.]
[2nd Edit: Yes, it probably is working as intended - you've generated the normals BEFORE you randomly change the height of the terrain. You need to recalculate them every time you change the heights. I'll do a bit more experimenting.]
[3rd Edit: The following two changes to your code allow the normals to be recalculated. You then see all four textures at various places. I haven't checked to see if the normals are in fact correct though:




]

In your example, ny = 1 will interpolate between grass and sand depending on altitude, ny = 0 will interpolate between rock and gravel. Values inbetween will give you a mixture of all four textures.

@TinTin

Quote: "@GG Sorry for the delay, it's been hectic this weekend."


Me likewise - and the recent fine weather here has forced me to venture outside and catch up with some very overdue gardening. It's raining today so I might get some coding things off my list - which seems to be growing daily for some reason.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Apr 2007 22:03
Here's a demo of the new terrain blending shader which now includes roads (more like "trails" or "tracks" really). This version doesn't have extra techniques for normal mapping, etc. I'd like some feedback before taking this further.

The demo would look better with seamless textures and a more interesting heightmap, but I hope you get the idea.
Alquerian
19
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 23rd Apr 2007 22:57
That is really awesome GG, great work. It's nice to be able to define your roads via a color/image map as you do. Looks very nice too

Visit the Wip!
The ARRAYinator
19
Years of Service
User Offline
Joined: 13th Aug 2005
Location:
Posted: 24th Apr 2007 01:25
Very nice! I am currently in the process of implementing your wonderful shaders into my editor Gamescape 3d in the wip boards. Id just like to thank you all especially you gg your shaders are just amazing! Thanks!



TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 24th Apr 2007 01:27 Edited at: 24th Apr 2007 01:58
That's Superb GG,(I want to be your Beatch!!!) hehe.
Can't wait to see how this'll look plugged into my RMF terrain (once I've figured out the bug)

While your at it, maybe a vertex shader to modify the mesh so that the road always remains flat across it rather than folowing the curves of the landscape...

David... Nice functions, The FPS are through the roof on my PC, I might have to steal some of those.. hehe

I'm having a few issues with my procedural.dll, I get some functions working then others break, I'm also trying to figure out how to limit the inputs to certain ranges (this should be simple)

I look into my cristal ball and see... a massive terrain several hundred kilometers square, with vast mountain ranges, valeys, rivers etc. All rendered with a 128x128 matrix.

Oooh. ther's an idea, Rivers, these can only flow downhill and must cut into the terrain.!!! hmmmm (GG)?

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
TinTin
19
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 24th Apr 2007 15:24
@ Van B I recall you saying that you were going to start a dedicated thread for this stuff...
Have you done it yet ?
If So, Where is it ?

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.

Login to post a reply

Server time is: 2025-08-09 02:06:18
Your offset time is: 2025-08-09 02:06:18