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 / Large Terrain - help with seams

Author
Message
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 30th Dec 2011 20:17 Edited at: 30th Dec 2011 23:08
So a while ago I posted a topic here that outlined larger terrain w/ terraforming. I got help from GG, Back Slash, Van B and Paul (among others) on how to use arrays to edit multiple objects in vertexdata. I finally got something I'd like to work with - but I am having issues with seams. Take a look, no media needed.

You need Sparky's Collision plugin and Ian M's Matrix Utility Plugin for the code to work. It is still a little sluggish - but good enough fps for what I need it for.

If you reach the corner of one plane with the brush (a point intersecting with the corners of 4 planes) - A small to medium sized seam appears. I am trying to fix this issue exactly. Any thoughts?



EDIT:
Here's an Image

EDIT 2:
I could make several arrays with types attached ( A(vertexnumber).X) and position them at the correct locations (AKA take the object width and height and determine which vertices are on the edges of each plane and then smooth them based on average... but that's something I've not done. I grasp how to, but if there is a method of doing so, someone let me know or I'm gonna reinvent the wheel here) That would solve the problem theoretically.

EDIT 3: I need to understand how to use the arrays... here's an example with a 'array fix' for the seams that IS NOT working correctly.


Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 31st Dec 2011 08:23
No one?

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 31st Dec 2011 12:19
I haven't studied your code closely, but are you sure that your shared edge vertices are overlapping?
For example:

where 2 represents the position of the top right vertex of the first segment as well as the top left vertex of the second segment and 4 in the same manner is the position of both the first segment's bottom right and the second segment's bottom left vertices. (The shared vertices should of course share normals and uv's (and diffuse, if you use that) in order to prevent visual artifacts).


"Why do programmers get Halloween and Christmas mixed up?"
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 31st Dec 2011 18:04
I'm not sure if they are - but without this array bit, only the corners (and surrounding vertices) appear to rip at the seams. I guess I'm trying to check the X and Z locations of vertices and if they are within an allotted distance, they equal Y.

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 31st Dec 2011 21:18
I do know that when using the MATRIX set of commands for terrain you can use the SET MATRIX TRIM which will trim the textures to stop the seams showing as I've used it recently. But with objects you might have to alter the UV's manually for the same thing.

Also if your textures are just a single image per texture then a texture flag may be out, unlikely though. I think what I mean is that it should be set to tiling by default but they can be set to non-tiling too.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 31st Dec 2011 23:10
Actually what I was refering to (seams) was the plane objects "ripping" at the corners as I terraform. Everything (objects making up the terrain) is entered into an array that includes the vertexdata for the pick objects as well as the objects left, right, top, bottom, and corresponding corners... like a square with 8 squares around it. For some reason, the corners of the pick object don't match the corners of the objects surrounding it. I am fiddling with this, but it appears to be a tricky bit of editing when using arrays. Damn it all.

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 3rd Jan 2012 08:48
Can someone show me how this is done? I have tried everything from calculating the positions of vertices on the edges of each plane and if a difference is present, normalizing the difference to saving each vertex's position and editing outside of vertexdata and then importing them into vertexdata - but nothing is elimination the issue. ANY HELP, OR IDEAS would greatly be appreciated. Feel free to use the code yourself if you can help me in any way possible!

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Rais
23
Years of Service
User Offline
Joined: 7th Jul 2003
Location:
Posted: 3rd Jan 2012 14:01 Edited at: 3rd Jan 2012 14:02
There's a slight problem with the array your using to track the terrain object numbers. If im looking at this correctly your creating a 8x8 grid of objects (64 objects) but your 'Objects' array is only can only hold 16 entry's (8+8).

Have a look at the section code below, 2 simple changes and it appears to work:
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 4th Jan 2012 20:49
Okay - seaming errors fixed. (You were right rais)

posting updated version after I write this terrain shader

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 5th Jan 2012 05:43
@Daryn Alsup

nice code

with the fix to the overlapping part posted by "Rais"

I noticed a line as if the land as an object was split in 2 peace

with texture added to it ,
it would be a bit less noticeable but it would still stand out
and might affect if the object moving on it would get stuck on it
or consider it an obstacle

I look forward to seeing how this go's

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 5th Jan 2012 10:15
This is due to the normals and lighting... the shader i'm applying to it will use the world matrix to position normals. Shading and any differences in 'shadows' that may create lines will be eliminated.

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 5th Jan 2012 10:29
a smaller x,z triangle between spots would blend better

how big a matrix would this be able to create ?

saying that even with hiding land farther away

there would be limit as to how much land could be created
and adding in every thing else to make up a level would all affect cps
even if the code was built into a dll

creating many matrix's and only showing the 6 with in an area would permit
large levels to be built

I've been playing Serious Sam Classic and there are large areas
even Grand Theft Auto broken down had large playing area's

and since "Real-time Occlusion Culling"
this would give some speed back . perhaps one day it can also be
dll'd to speed things up even more

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 5th Jan 2012 11:34
Per this post - feel free to MSN me @ [email protected].

What this code does is check the objects north, south, east and west of the pick object (returned by the 'pick' commands) as well as NNE, NNW, SSE, SSW corner objects and enters them all into vertexdata (not all at once mind you) and there the terraforming takes place. Just change the 'tile_sz' global to a higher value and see what happens... be warned though - you may need to change the camera view too or FPS will drop... as for the matrix I am talking about - its not a physical object persay - nothing you can see... just how normals are calculated based on world position not object vertex position(s)... (sorry for the lazy explaination but I mean: WORLD normalization vs per object normalization- in which case otherwise, you would notice the differences between objects)

Anywho, try changing the global variable and see how it renders - I originally was going to use this to make a city building game, but it can serve more than one purpose now. You could also create lods - create another set of objects 1/2 the size of the other and show them when the camera is "X" away from the object. - You would have to figure out the vertexdata array variance math

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 6th Jan 2012 21:56
@Daryn Alsup

for some reason in your first post to here

edit 2 would stop working and take me back to the edit screen
but edit 1 with the modification would not do that

I never got an error message it just quit

attached is the updated code and exe

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 6th Jan 2012 23:40
@Resourceful:

All the above errors have been fixed. I would like to correspond with you concerning this project and anyone else who would like to.

Here is it's purpose (one of them)

1)
I have made a function that writes LUAs containing each plane's location, vertexdata position and all mesh data. This function is used in the *Terrain Editor. The LUA file also contains the Terrain Name, *player entry point, portal(s) location to interior levels that the *Interior level editor can link with, merchant locations, enemy locations and types and other variables as well as how and when the *map location you've designed is available while the player journeys across the *World.

2)
Within the game engine, another function reads the LUA file you have *exported into the game *import folder. It is then told how to interpret the data and build it into the game itself.

I am not proficient enough to create a replica (nor would I want to) of the Dragon Age editor - BUT I am dexterous enough to model something similar.

The same method of writing LUAs could be used for a City Simulation or other type of Game, not just RPG. While I am basing the Game of a book I wrote in College, the actual look of the game is going to either make or break it. I am trying to make it as real-life looking as possible. Other wise the story will be flawed by the entire look of the game.

Resourceful, you are very creative in your thoughts, thus, I would love to correspond. Please message me or IM me if you are interested. If the game can be marketed, your contributions will be paid as well. That is a great length away however.

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 6th Jan 2012 23:41
ummm there is bug

it seams 2 squares from ware you start

x,z
0,0

you cant go past
x,z
0,3

but left to right of 0,0 to 8,0
is changeable

every thing look correct in the code

check out the attached pic

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 6th Jan 2012 23:43 Edited at: 6th Jan 2012 23:46
Here is the updated code - I remed out the media - try it - if you get the media error(s) - look and rem it out... it's hard to do at one glance - so forgive me if I missed something

EDIT - ALSO added color object to rgb(128,128,128) so it's not so bright.



Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 7th Jan 2012 00:24
@Daryn Alsup

I've added you to msn message

I had the grass and the rocky grass
still looking for
Ice Cliff
snow

as for TerrainTexture.fx I guess I will have to do a forum or net search
I've collected 81 fx files

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 7th Jan 2012 06:59
@resourceful

ill attach the shader in a few

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 7th Jan 2012 08:05
@Daryn Alsup

thanks that would be of help

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 7th Jan 2012 08:45
Here is the project - PLEASE NOTE that I only included the terraforming code and associated media for good ole pride's sake. tell me what you think - the fps is killed by the shader... can go down to 15 - sometimes lower. I am trying to resolve this as I am not a true shader writer like GG, but I am trying really I am!!!

Note that there is fog. If you open the TerrainTexture.fx in notepad and see the fogred, foggreen and fogblue variables and change the backdrop color to the same in DBPro, you'll see how the fog looks. Right now it's only based on how high the camera is. I am trying to have the fog vary based on height AND distance - so far away objects and really high objects get fogged - but we will see how that looks once I'm finished with the environment box I am making now.

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 7th Jan 2012 09:00 Edited at: 7th Jan 2012 09:09
@ Resourceful, I am on messanger now

anyone else want to brainstorm with me, please I encourage you to

EDIT : Here is an image of the working shader (that still needs tweeking)

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 7th Jan 2012 09:16
@Daryn Alsup

I would call what you have dun so far
very successful ;o)

I see what you mean about the fog changing as you change the hight

from what I see in the "TerrainTexture.fx"
I understand what your going for but I'm not at the point of making such

the cps only drop when you are building
I had 59 before and 12 while building and it did not matter how
much of the land was changed

I'm not shire if it posible to optmise the code for building land
so the cps stay at 59 but even at 12 the speed works

in the blitz1 the showing the location ware the mouse is
is defiantly a nice feature

so far your on the right track

one thing I have noticed though out this is when you move back from
the land far off parts start to disappear

so for even a larger area more would not be seen and could take away
from figuring out what is to be dun next

to move side ways - is to move forward
Since a Strait line gets thin fast
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 7th Jan 2012 09:25
@Daryn Alsup

I'm not shire what time it is ware you are
but ware I am it's 2:21 am cst Canada

I most folks are out to lunch so to speak lol

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 8th Jan 2012 23:43
Okay - so here's a little update. Thanks to resourceful, I'm deciding to nix using a shader on the terrain for now - although there will be one later on. I am going to implementing a "paint terrain" function - I owe resourceful many, many, many thanks for helping me grasp the concept.

Make a type including the object u, v, x, y, z data

IWidth=Image Width(1)
IHeight=Image Height(1)

(retrieve the vertex count for the array
global dim arrayname(vertex count) as type

ObX#=get object size X(1)
ObZ#=Get object size Z(1)

Now we make a memblock from the main image, and copy it into a new memblock

we make a for - next for both U and V locations
Ensuring we're using the pick commands correctly, we then check to see if (a mouse click or a button has been pressed) the location returned is on the object, then scale both the object size down to the image width and height.

IN THEORY
When we click or whatever on the terrain object, we are actually scaling the location down to the image width and height and writing to the image in memblock, updating it's color - or texture, which is then merged with the existing memblock for the primary image we copied from - which gives you the paint effect.

DOUBTS and WORRY
Speed - but I expect as much.

I am working on this right now... but I will tell you how it goes - I know that blitz terrain has some sort of paint function - but I intend to load textures and use them as the paint - with an alpha brush that changes how each image is blended on the other

ALSO NOTE
Since we are copying to one memblock from another, the second is a temp - which will merge its contents and then be deleted. The first will be made into the image we made and relayed back on the object(s)

It maybe harder than it actually appears to be - but I think it's worth the investigation.

Daryn

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 9th Jan 2012 03:54
Okay - using the memblock commands how do I determine the current pixel X and Y position of the image?

I'm doing a check between pick X and Z, scaled to the image width and height locations

(like if pick X was 100.00 but the image is 25.0 wide and high, and the max size of the object was 200.00, I can scale it all down to the right size via the objects UV data ... how do you determine the present pixel position in a for-next loop from the current memblock byte(s) being read?)

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 9th Jan 2012 21:05
I am looking for how to retrieve the current pixel being drawn from the byte being proccesed during a For-Next loop based on the memblocks size, which is containing an image...

sorry - *BUMP*

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 10th Jan 2012 07:47
Here - I've tried my best to come up with a reason why it isn't working... anyone got an idea why?


Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 10th Jan 2012 08:11
ummm in the function location() section

global Dist# as float
Global Object as integer
Global PX# as float
Global PY# as float
Global PZ# as float

you have these set to used when that function is called
they should only need to be stated once before the do/loop second

as for why it's coming up with an error 7801
line 129

vector dose not exist
it's trying to read anther vector and nun is available to be read

to move side ways - is to move forward
Since a Strait line gets thin fast
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 10th Jan 2012 08:42
I have a function (vector exist) and it gets made in a function if it doesnt

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 11th Jan 2012 10:36
I've been working with "Daryn Alsup"
to help with his project

I'm not as far along in understanding of vectors
but he has made great strides with help from other here

I had found an example with painting on objects
there are similarity's to what "Daryn Alsup"
created but the way this example was dun seams to be closer
the needed results

I know he has not posted the code he has created but perhaps
this might provide a pointer and help him out

one other thing after him showing the math

he can create a space of 508,400.5 square miles

which from what I can is larger than the earth
so this open's a lot of possibility's for
games and simulation programs

it also means a faster and more than 2 cpu's or even 4
would be much better unless a math equation can be worked out
to take care of every thing in view and out of view

to move side ways - is to move forward
Since a Strait line gets thin fast

Login to post a reply

Server time is: 2026-07-10 00:43:08
Your offset time is: 2026-07-10 00:43:08