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.

Program Announcements / [DBPro] TERSCULPT

Author
Message
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 15th Oct 2008 19:34 Edited at: 15th Oct 2008 19:38
The weird thing about tersculpt is I can't put my finger on how it makes curved hills exactly, I mean the code should really make a hill with straight side, like a cone. I'm guessing that it's the gradual raising of the terrain that causes the round effect, but really I was happy enough with the tools that I never bothered too much .

I am thinking about more exacting and unusual terrain sculpting tools, but I digress.

The terrain quads are 100x100, which is quite a big scale for most people but I like it because this allows more use of integers, which can have their own benefits - for instance there's no real need to use floats to store object positions at that scale.

To make a hill without having to build it up gradually like with tersculpt, it's probably best to use the distance from cursor but with a cosine function.

So no matter what size of terrain, you'd be checking the distance from the cursor and would have a range for the brush.

With this, you can work out the multiplier for the cosine function, which you would then use to give an angle. 1.0-(Distance/Range) would give you a value from 0.0 to 1.0, and any value below 0 is out of range. Grab the vertex distance from the cursor, divide it by the range, then multiply that value by 180.0.

With this angle, you can get the cosine and add 1.0 and divide by 2.0 : h#=(cos(angle)+1.0)/2.0

Then for that vertex, set the Y position to h# multiplied by the maximum height of your hill.

We have to use 1.0-(distance/range) because the distance function will be 0.0 when the vertex is right on the cursor centre, when really we want that to be 1.0 so it becomes the maximum and can be used as a multiplier.
These hills would kinda cut into the terrain, which might be usefull but doing a check for the existing Y position of the vertex and only adjusting it if it's below the new height would avoid this. It's always a good idea to use a heightmap from the outset though, there's simply no comparison between standard 3D collision checks and an old fashioned interpolation check. When your doing a lot of height checks it's good to have an interpolation function (like GETHEIGHT#(x#,z#) in tersculpt).


Health, Ammo, and bacon and eggs!
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 15th Oct 2008 19:47
Just to add...

>>I kinda figured out what is means:
>>st_x = Left side of rectangle, en_x = Right side of rectangle
>>st_z = Bottom side of rectangle, en_z = Top side of rectangle

>>Am I right?

Yeah, this is the range of height points that will most likely be in range of the cursor.

>>I think it may have to do with this check:
>>Quote: "brush_v#=vr#/brush_range#
>>if brush_v#<1.0"

>>Where if the value is less then 1 then it won't update that point. Right?

Yup, it will only affect points within the brush range.

>>brush_v# = (distance from center) / (?)

>>Quote: "brush_range#=(cursize*100.0)+100.0"
>>What does this calculate?

>>Quote: "ter(xx,zz)=ter(xx,zz)+((1.0-brush_v#)*15.0*elapsed#)"
This seems to determine the height at that point. What I don't understand is how it is calculated. First what is elapsed#? Why is the number 15 important? Is that the speed?

Yeah, the 15.0 is like the brush strength, and elapsed# is worked out with timer() to give predictable results no matter what the frame rate. The thing with shaders is that on less powerful machines they can really slow things down, so it uses timer based adjustments. This means that moulding a hill for 1 second gives the same hill (probably) no matter how fast the PC is.

>>Quote: "(1.0-brush_v#) "
>>Also, what does this mean exactly?

This is a value 0.0-1.0 which is passed to the paint function as a multiplier, so it's really the brush strength depending on the distance from cursor.


Health, Ammo, and bacon and eggs!
Dark Fire
15
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 15th Oct 2008 23:05 Edited at: 15th Oct 2008 23:08
Wow, thanks you are the greatest!

I should be able to get a ton more done!

I have been theorising about how to make tersculpt faster and I came up with a great idea. Why not just have one big plain and when you move it is molded into what it is at that position? (Using the array) Basically, it is the same as your cursor except the terrain object changes as you move it. (You still have the cursor though.) This would keep the framerate about the same the entire time using the program. (The array may cause a change though.)

When working on my program I came up with another question. How did you handle negitive numbers with the ter() array? I was trying to get around that some how, but I couldn't figure it out.

Thanks,

Dark Fire
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 15th Oct 2008 23:39
Does that already DarkFire, great minds think alike ehh!

It uses patches of terrain, 1 big one that is moved that represents the terrain, and a smaller one that is updated in realtime. So when you edit it only updates the smaller one and will update the real terrain randomly and when your done clicking the mouse. There's a big performance increase in doing this, because it's so much quicker to update the smaller terrain.

In the engine, I use lots of terrain meshes as limbs on a main object, and as you move the limbs get repositioned and updated, seems to work pretty well, and lots of room for optimization too. There's quite a few variants of the terrain mesh, because I wanted an editor that would be good for any game type, be it FPS, RTS, RPG, any person view - then decide on the engine variant that's best for that game type. The RTS version for instance only needs a fairly small terrain mesh as there's not so much on the camera, and the FPS version with all the terrain limbs allows you to set any draw range you like.

Tersculpt2 will have much better engine examples with it.


Health, Ammo, and bacon and eggs!
Dark Fire
15
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 15th Oct 2008 23:59 Edited at: 16th Oct 2008 00:01
Thanks for that!

I only have one more question:

Quote: "How did you handle negitive numbers with the ter() array?"


This was huge road block for me.

Edit:
Also, what I meant about the terrain was having just one big terrain. Would doing that cause any problems?

Thanks,

Dark Fire
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 16th Oct 2008 00:13
The ter() array is a float, so it supports negative numbers just fine.

Having 1 big terrain should be fine, but it would have to use limbs because of the mesh vertex size limit - limbs would allow you to hide them if they are not in the screen as well which would save on performance.


Health, Ammo, and bacon and eggs!
Dark Fire
15
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 16th Oct 2008 00:23 Edited at: 19th Oct 2008 22:07
@Van B - Thanks for the quick response.

Quote: "The ter() array is a float, so it supports negative numbers just fine"


I was thinking it would be something complex. Again, I thought about it to much.

Edit: Now I have another question. How do you handle resizing of the ter array? I wasn't able to determine the bounds or figure a way to dynamically size it as you go along.

Edit Again: I am now having problems figuring out the relationship between the terrain points and world points. I want to be able to specify a world point and get them converted to a terrain point.

Thanks,

Dark Fire
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 2nd Dec 2008 04:37
Im getting errors when I try to export to advanced terrain some illegal image errors.

The admiral
Dark Fire
15
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 8th Feb 2009 20:52
I have been getting the same errors. I saved my terrain in a .ter file, loaded it, and generated the Advance Terrain, and it gave me the "illegal image" error.

Let me know if you have a more stable version or could fix these bugs.

Thanks,

Dark Fire

My future self met up with one day to teach me what I know today.
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 16th Feb 2009 14:03 Edited at: 17th Feb 2009 20:41
I haven't been getting any errors. Truly amazing program you've got here, Van B. I plan to use it in a project I'm going to try and tackle . At first glance I wasn't sure it would be too easy to use in my game, but after looking at you examples it actually looks pretty easy thanks to the functions.

EDIT: Wait I got an unknown image error when exporting the advanced terrain at a resolution multiplier of 6.

EDIT 2: It happened on 4 as well.

Edit 3: Also, I have two questions:
1. Is it possible to reduce the .TED file size?
2. Is it possible to scale down the terrain? I was looking at your Tiled Engine demo and couldn't figure it out .

Game Guy
15
Years of Service
User Offline
Joined: 9th Oct 2008
Location:
Posted: 8th Mar 2009 22:26
Hi. I downloaded it because it looked nice and I could use a world editor. But I got a error message. I attached it so you could see. Please explain what this means and how to fix it (if you can that is)

Zab Productions Game and Program Company.

Attachments

Login to view attachments
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 8th Mar 2009 22:34
That would mean that in the project settings tabs, the screen resolution is set to something with a 32 bit depth. However, it looks like your video card doesn't support 32 bit. Find the resolution in the project settings and change it to 64, then recompile.

(If 64 still doesn't work, you may have to try 16)



kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 8th Mar 2009 22:43
That isnt to do with colour. Its the screen resolution is too high. Set it to 640x480 or 1024x768. All graphics cards support those.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 8th Mar 2009 22:50
Ah, you're right, if you have a bad depth it gives you "Screen depth is invalid".



Beast E Gargoyle
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Sunny San Diego, CA
Posted: 7th May 2009 20:58
Tersculpt is an incredible program. Excellent job on it. I have a question; I am using the grass.png texture for some of my land segments and when I save it and try and re-open it, it is telling me it is unable to load the grass.png texture in the enironment folder, but I checked and it was in there? Any help or thoughts would be greatly appreciated.

Thanks,

Beastegargoyle

The Last Great Swordsmen a 3D hack N slash http://lastswordsmen.freezoka.com
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th May 2009 19:45
Thanks!

Sadly I've no idea why the grass.png file is giving you problems. What art package are you using?, maybe it would be better to try a different file format.


Health, Ammo, and bacon and eggs!
Beast E Gargoyle
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Sunny San Diego, CA
Posted: 8th May 2009 21:03 Edited at: 12th May 2009 04:09
I actually resolved the grass error message. I made some terrain for the start of my level saved it and sent it to my friend. He is unable to open the level from inside of Tersculpt and I have tried numerous times to export the A.T. for it, but have been unable to because I think my processor can't handle it because it just sits there. You have to press [enter] after you enter the res-multiplyer, right or another button?

Edit: Could someoen please export the A.T. map from this for me. I would really appreciate it. Thanks.

The Last Great Swordsmen a 3D hack N slash http://lastswordsmen.freezoka.com

Attachments

Login to view attachments
level
14
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 12th Jun 2009 10:59
Heloo great program many kudos to you.
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Jun 2009 14:45
Thanks Level, just wish I had more time to spend on it's sequel.

BeastE, Sorry but my motherboard died last week so I can't help - if nobody comes forward by the time I get a new one, I'll convert it for you.


Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2024-04-19 00:22:13
Your offset time is: 2024-04-19 00:22:13