123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|427|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Terrain

Mon, 12 Nov 2007, 17:21
Toaster
I am having trouble with terrains. I want to create a terrain editor that can save the terrain to B3D and can paint the terrain with differant textures. Does anyone have any examples source code??

Thanks,
Toaster
Tue, 13 Nov 2007, 04:55
Jayenkai
Well, knowing next to nothing about 3D stuff I was hoping that someone else would've answered, but so far nope!
I'll suggest using a Heightmap instead of a specific terrain B3D file. Always seemed like the option to go for, so with a tiny bit of testing, I build up this small example for you.

Terrain Test

Note, there's no editor involved here, other than a plain basic image editor to draw the three images.



-=-=-
''Load, Next List!''
Tue, 13 Nov 2007, 08:49
power mousey

sorry, haven't worked that much
on terrains..or of terrains.

But what Jay said about heightmaps,
and also to color or texture the terrain with the associative heightmap as well.
Perhaps a generic structure or type:

a handle for default height map that can be changed
a file to load in the heightmap values an dwith an array too.
x,y,z real values to position.move.translate the terrain
xa,ya,za for rotation or turnentity of the terrain if need be.
a handle for a texture
and its width,height size too.
a string or string(s) for identifying tags
of the name of the terrain as well as for a colored texture or image texture. And if a image texture...the filename would suffice.

just some of the values within the structure or type.
more can be added or some can modified or deleted too.

Tue, 13 Nov 2007, 09:09
Toaster
Yeah I can load a terrain by opening up a hieght map but I would like to know how to modify the terrain like raise and lower it. Something with tool sizes and painting the terrain. Its for my editor right now I can load a terrain but if my users could edit it then they wont have to load the terrain in a different program first. Plus I really want to know how to texture splatter. I haven't found anything on how to do it in blitz3D.

Thanks,
Toaster
Tue, 13 Nov 2007, 09:17
power mousey

okay toaster,

again I haven't really done that much with terrains
yet. Perhaps I will later...more interested in skydomes and skycubes or skyboxes myself.

But quickly glancing thru the docs...

look at such commands as terrainheight, terraindetail,
terrainsize, createterrain,and modifyterrain. Docs can be your friend at times.

Take it from there...

Tue, 13 Nov 2007, 09:20
Toaster
Yeah I looked at it but you can only raise like one section of terrain at a time. Theres no tool sizes. I have stuff for skydomes and skycubes if you want it..
Tue, 13 Nov 2007, 09:56
power mousey

yes, by all means.

thank you.
Tue, 13 Nov 2007, 10:04
Toaster
Okay here's skybox code that I use.



I edited out the bottom part of the sky since I dont need it. Just uncomment it. To load the sky just do something like this: loadskybox("SkyNorth.jpg","SkyWest.jpg","SkySouth.jpg","SkyEast.jpg","SkyUp.jpg",1000,1000,1000)

This is the skysphere code I use:


Hopefully someone here knows how to do terrains correctly..

-Toaster
Tue, 13 Nov 2007, 10:11
power mousey

um yikes!!

this seems daunting toaster.
I see you have been busy toasting a
lot of bread.

I'll copy it and dissect it too.
In a non-biological sense.

Again, thank you.

Tue, 13 Nov 2007, 12:33
Forklift_Fred
I didn't answer earlier because it's not an area I've really looked at. I recently had a quick look at a simple tutorial on height map terrains but that's it. With Mousey's input I've done a bit of thinking and learned a bit myself.

Take another look at the Help example for ModifyTerrain()
The trick is to modify more than 1 point at a time if you wand different 'brush' sizes.

Very quickly, I added to the code and got a crude 3x3 brush effect
Original code:


Modified code:


Obviously, you would do the same for the next bit of code for when Z is pressed.

I suggest using a couple of For...Next loops to pick all the points relevant for the current brush size. If you chuck it into a separate function then you could vary the For...Next loop at will, you could probably use the same function to go up and down as well.

Remember, the documentation is your friend but it is only a starting point. In a lot of cases it's gives rather poor code but demonstrates how it works. It's up to you to expand and and adapt it to your requirements.

If you need any more help then feel free to ask.

-=-=-
Come rain or shine...
Tue, 13 Nov 2007, 14:20
power mousey

thank you Fred.
you have been helpful...and also to me.

Thanks
Tue, 13 Nov 2007, 15:07
Forklift_Fred
That's what it's all about
Wed, 14 Nov 2007, 08:44
Toaster
Thanks your code works but its rather spotty.. I think I know what to do now. Does anyone know how to paint textures on to the terrain with like a base layer then different alpha layers??