Welcome,
Guest
. Please
login
or
register
.
May 24, 2013, 06:15:44 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Welcome to The Binary Zoo.
Please do not feed the animals.
29666
Posts in
1431
Topics by
164
Members
Latest Member:
Martoon
The Binary Zoo
General
Game Development
PT3D - procedural terrain creation tool
« previous
next »
Pages:
[
1
]
2
3
...
7
Author
Topic: PT3D - procedural terrain creation tool (Read 3174 times)
Prime_8
Bunnymonkey
Offline
Posts: 1207
PT3D - procedural terrain creation tool
«
on:
March 24, 2012, 03:19:06 PM »
PT3D - procedural terrain creation tool
PT3D , procedural terrain generator tool
powered by
Aeva
makes .n3d & .x xeported meshes..
uses perlin noise.. it's just starting ..
http://forums.nuclearglory.com/index.php?tid=3052
only a quick ressurection of PT3D ..
thisis a standalone version of a tool built into P3D ..
PT3D_012_a1.jpg
(106.2 KB, 945x531 - viewed 40 times.)
«
Last Edit: March 24, 2012, 04:14:26 PM by Prime_8
»
Logged
www.ejectedcore.com
fog
Binary Zoo
Zookeeper
Bunnymonkey
Offline
Posts: 12660
Re: PT3D - procedural terrain creation tool
«
Reply #1 on:
March 24, 2012, 06:05:05 PM »
Cool. Nice and simple to use as well.
Logged
T_M_C
Playtester
Bunnymonkey
Offline
Posts: 2668
TMC
Re: PT3D - procedural terrain creation tool
«
Reply #2 on:
March 24, 2012, 10:43:27 PM »
Yeh, nice work Prime.
Perlin noise seems to be the standard technique these days.
TMC
Logged
http://www.trinosis.com
Auto Cross Racing
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=91:autocross&catid=37:pc&Itemid=60
Zytron II
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=98:zytron2&catid=37:pc&Itemid=60
Prime_8
Bunnymonkey
Offline
Posts: 1207
Re: PT3D - procedural terrain creation tool
«
Reply #3 on:
March 25, 2012, 04:47:42 PM »
one way i'm looking into is to randomly draw a line across a height map/ bank
all data on one side get +1 unit step ,teh other gets -1 unit step.
the end points are randomly placed . do this for a few hundred itterations .. you will have jagged vallys and cravasses .
well that's the theory .
i need to sort a way to do this to a array
DWORD *buffer = new DWORD[ height * width ]
or even better
float *buffer = new float[ height * width ]
I just sorted the first steps of procedural texturing direct to v-ram , it's way faster than my old one .
again just plaing with noise. but could be any mix/ modulation . ie texture blending and the like.
just wish i had a faster way to write out a PNG
PT3D_012_7j.jpg
(126.91 KB, 638x592 - viewed 38 times.)
«
Last Edit: March 25, 2012, 04:54:33 PM by Prime_8
»
Logged
www.ejectedcore.com
T_M_C
Playtester
Bunnymonkey
Offline
Posts: 2668
TMC
Re: PT3D - procedural terrain creation tool
«
Reply #4 on:
March 25, 2012, 07:56:40 PM »
Quote
all data on one side get +1 unit step ,teh other gets -1 unit step.
the end points are randomly placed . do this for a few hundred itterations .. you will have jagged vallys and cravasses .
Thats a simple and clever idea.
That sounds a lot like a technique i once used for planet generation.
By taking a sphere mesh, selecting all the verticies on one side and raising or lowering them by x amount.
Choose a random angle and repeat for n number of iterations and after a short while the sphere mesh starts to produce hills, valleys and mountains.
The end results were pretty neat.
Quote
just wish i had a faster way to write out a PNG
I always prefer .Tga to .Png as a general rule, simply because photoshop doesn't automaticaly split .Png's into it's seperate channels.
Loading a .Tga into Photoshop automaticly gives me red, green, blue and alpha channels immediately for editing.
Which i find far more useful.
Do you support .Tga as well as .Png.
I don't know if the format is any quicker to read / write to though.
I take it you mean the Dwords are for the texture and not mesh?
TMC
Logged
http://www.trinosis.com
Auto Cross Racing
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=91:autocross&catid=37:pc&Itemid=60
Zytron II
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=98:zytron2&catid=37:pc&Itemid=60
Prime_8
Bunnymonkey
Offline
Posts: 1207
Re: PT3D - procedural terrain creation tool
«
Reply #5 on:
March 26, 2012, 12:36:22 AM »
i support a great many . dx12 and such will be lowering the supported formats .. ie jpg,dds,png, and tga
not sure but tga may get cut . ?
good old ms .
::
the problem i have is i have no fast way to edit the export buffer .. ie build data in a ptr or bank and do one write , is just not a option rite now .
do you have save to tga code ?
Logged
www.ejectedcore.com
Prime_8
Bunnymonkey
Offline
Posts: 1207
Re: PT3D - procedural terrain creation tool
«
Reply #6 on:
March 26, 2012, 05:45:57 AM »
ok skipping the export stuff . unless i support something fast ..
i will add cor functionality ..
PT3D013_sp_2.jpg
(140.96 KB, 709x616 - viewed 38 times.)
Logged
www.ejectedcore.com
T_M_C
Playtester
Bunnymonkey
Offline
Posts: 2668
TMC
Re: PT3D - procedural terrain creation tool
«
Reply #7 on:
March 26, 2012, 05:47:11 AM »
Not sure if this will help but it's the .tga loader in Blitzmax.
Code:
Strict
Rem
bbdoc: Graphics/TGA loader
about:
The TGA loader module provides the ability to load TGA format #pixmaps.
End Rem
Module BRL.TGALoader
ModuleInfo "Version: 1.07"
ModuleInfo "Author: Simon Armstrong"
ModuleInfo "License: Blitz Shared Source Code"
ModuleInfo "Copyright: Blitz Research Ltd"
ModuleInfo "Modserver: BRL"
ModuleInfo "History: 1.07 Release"
ModuleInfo "History: Fixed memory error due to pointer based array reference"
ModuleInfo "History: 1.06 Release"
ModuleInfo "History: Support for Run Length Encoded compression"
ModuleInfo "History: 1.05 Release"
ModuleInfo "History: Fixed 24 bit byte ordering"
Import BRL.Pixmap
Import BRL.EndianStream
Const TGA_NULL=0
Const TGA_MAP=1
Const TGA_RGB=2
Const TGA_MONO=3
Const TGA_RLEMAP=9
Const TGA_RLERGB=10
Const TGA_RLEMONO=11
Const TGA_COMPMAP=32
Const TGA_COMPMAP4=33
Type tgahdr
Field
idlen:Byte,colourmaptype:Byte,imgtype:Byte,indexlo:Byte,indexhi:Byte,lenlo:Byte,lenhi:Byte,cosize:Byte
Field
x0:Short,y0:Short,width:Short,height:Short
Field
psize:Byte,attbits:Byte
End Type
Function makeargb(a,r,g,b)
?BigEndian
Return (b Shl 24)|(g Shl 16)|(r Shl 8)|a
?
Return (a Shl 24)|(r Shl 16)|(g Shl 8)|b
End Function
Type TPixmapLoaderTGA Extends TPixmapLoader
Method LoadPixmap:TPixmap( stream:TStream )
Local
hdr:tgahdr
Local
w,h,tgatype,bits
Local
buffer[]
Local
sbuffer:Short[]
Local
bbuffer:Byte[]
Local
i,x,y,t,a
Local
pixmap:TPixmap
stream=LittleEndianStream( stream )
hdr=New tgahdr
If stream.ReadBytes( hdr,8 )<>8 Return Null
hdr.x0=stream.ReadShort()
hdr.y0=stream.ReadShort()
hdr.width=stream.ReadShort()
hdr.height=stream.ReadShort()
hdr.psize=stream.ReadByte()
hdr.attbits=stream.ReadByte()
bits=hdr.psize
w=hdr.width
h=hdr.height
tgatype=hdr.imgtype
If hdr.colourmaptype Return Null
If Not (tgatype=TGA_MAP Or tgatype=TGA_RGB Or tgatype=TGA_RLERGB) Return Null
If Not (bits=15 Or bits=16 Or bits=24 Or bits=32) Return Null
If w<1 Or w>4096 Return Null
If h<1 Or h>4096 Return Null
If bits=16 Or bits=32
pixmap=CreatePixmap( w,h,PF_RGBA8888)
Else
pixmap=CreatePixmap( w,h,PF_RGB888)
EndIf
For i=1 To hdr.idlen
stream.ReadByte
Next
buffer=New Int[w]
bbuffer=New Byte[w*3]
Select tgatype
Case TGA_RGB
For y=h-1 To 0 Step -1
Select bits
Case 15
For x=0 Until w
t=stream.ReadShort()
buffer[x]=makeargb(255,(t Shr 7)&$f8,(t Shr 2)&$f8,(t Shl 3)&$f8)
Next
Case 16
For x=0 Until w
t=stream.ReadShort()
a=255
If (t&$8000) a=0
buffer[x]=makeargb(a,(t Shr 7)&$f8,(t Shr 2)&$f8,(t Shl 3)&$f8)
Next
Case 24
stream.readbytes(bbuffer,w*3)
For x=0 Until w
buffer[x]=makeargb(255,bbuffer[x*3+2],bbuffer[x*3+1],bbuffer[x*3+0])
Next
Case 32
stream.readbytes(buffer,w*4)
End Select
ConvertPixels(buffer,PF_BGRA8888,pixmap.pixelptr(0,y),pixmap.format,w)
Next
Case TGA_RLERGB
Local
n,argb
For y=h-1 To 0 Step -1
x=0
Select bits
Case 15
While x<w
n=stream.ReadByte()
If n&128
n:-127
t=stream.ReadShort()
argb=makeargb(255,(t Shr 7)&$f8,(t Shr 2)&$f8,(t Shl 3)&$f8)
While n
buffer[x]=argb
n:-1
x:+1
Wend
Else
n:+1
For i=0 Until n
t=stream.ReadShort()
buffer[x]=makeargb(255,(t Shr 7)&$f8,(t Shr 2)&$f8,(t Shl 3)&$f8)
x:+1
Next
EndIf
Wend
Case 16
While x<w
n=stream.ReadByte()
If n&128
n:-127
t=stream.ReadShort()
a=255
If (t&$8000) a=0
argb=makeargb(a,(t Shr 7)&$f8,(t Shr 2)&$f8,(t Shl 3)&$f8)
While n
buffer[x]=argb
n:-1
x:+1
Wend
Else
n:+1
For i=0 Until n
t=stream.ReadShort()
a=255
If (t&$8000) a=0
buffer[x]=makeargb(a,(t Shr 7)&$f8,(t Shr 2)&$f8,(t Shl 3)&$f8)
x:+1
Next
EndIf
Wend
Case 24
While x<w
n=stream.ReadByte()
If n&128
n:-127
stream.readbytes bbuffer,3
argb=makeargb(255,bbuffer[2],bbuffer[1],bbuffer[0])
While n
buffer[x]=argb
n:-1
x:+1
Wend
Else
n:+1
stream.readbytes(bbuffer,n*3)
For i=0 Until n
buffer[x]=makeargb(255,bbuffer[i*3+2],bbuffer[i*3+1],bbuffer[i*3+0])
x:+1
Next
EndIf
Wend
Case 32
While x<w
n=stream.ReadByte()
If n&128
n:-127
stream.readbytes Varptr argb,4
While n
buffer[x]=argb
n:-1
x:+1
Wend
Else
n:+1
stream.readbytes(Byte Ptr(buffer)+x*4,n*4)
x:+n
EndIf
Wend
End Select
ConvertPixels(buffer,PF_BGRA8888,pixmap.pixelptr(0,y),pixmap.format,w)
Next
End Select
Return pixmap
End Method
End Type
New TPixmapLoaderTGA
TMC
Logged
http://www.trinosis.com
Auto Cross Racing
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=91:autocross&catid=37:pc&Itemid=60
Zytron II
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=98:zytron2&catid=37:pc&Itemid=60
fog
Binary Zoo
Zookeeper
Bunnymonkey
Offline
Posts: 12660
Re: PT3D - procedural terrain creation tool
«
Reply #8 on:
March 26, 2012, 07:13:13 PM »
What graphics editing program do you use Prime? Even the ancient version of Paintshop I use splits any image into separate channels with a single menu click.
Logged
Prime_8
Bunnymonkey
Offline
Posts: 1207
Re: PT3D - procedural terrain creation tool
«
Reply #9 on:
March 30, 2012, 08:06:28 PM »
hey guys . sorry have been offline at work this week ,
i founs my own implimentation for tga saving . i can open and save justabout anything .. but .. teh current api requires writing per pixel to the buffer that is saved out ..very slow .
so i found a TGA cxx export function and tweeked it a touch for my use. now i can export TGA in a flash .. and that is perfect .
I'll have look at adding your loader code into my saver , that will give a rounded TGA class.
I store my working image data in TGA compatable buffer now. RGBA , very handy .. as 4 dwords for speed. i could i suppose i could just put them in a bank in the structure == the v-ram ... that is a bitmap of 1 dword per pixel , and i bit shift it to get teh color componants .
I think i prefer teh TGA buffer as it is easier for human reading and faster with my set or perpixel filters ( i have all teh adobe like basic filters as per pixel alogos )
any how current pic .
iddvyd3gmozrjvf2cgm8z3ud2evbxzxs.jpg
(227.12 KB, 827x577 - viewed 40 times.)
Logged
www.ejectedcore.com
T_M_C
Playtester
Bunnymonkey
Offline
Posts: 2668
TMC
Re: PT3D - procedural terrain creation tool
«
Reply #10 on:
March 31, 2012, 06:34:29 AM »
Nice update Prime.
TMC
«
Last Edit: March 31, 2012, 07:17:49 AM by The_Masked_Coder
»
Logged
http://www.trinosis.com
Auto Cross Racing
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=91:autocross&catid=37:pc&Itemid=60
Zytron II
http://www.psytronik.net/main/index.php?option=com_content&view=article&id=98:zytron2&catid=37:pc&Itemid=60
Prime_8
Bunnymonkey
Offline
Posts: 1207
Re: PT3D - procedural terrain creation tool
«
Reply #11 on:
March 31, 2012, 12:09:38 PM »
cool thanks man
PT3D , procedural terrain tool 013a update
powered by
Aeva
Logged
www.ejectedcore.com
fog
Binary Zoo
Zookeeper
Bunnymonkey
Offline
Posts: 12660
Re: PT3D - procedural terrain creation tool
«
Reply #12 on:
March 31, 2012, 01:04:06 PM »
Is any post processing done on terrains like this Prime? Like checking for tiles next to each other with little change in elevation and replacing them with a single larger tile instead? Over a decent sized mesh that could be worth doing.
Apologies in advance if that's a total noob question.
Logged
Prime_8
Bunnymonkey
Offline
Posts: 1207
Re: PT3D - procedural terrain creation tool
«
Reply #13 on:
March 31, 2012, 05:54:54 PM »
fog, yep that's comming soon as i figure how to tessselate & and reduce nicely .
there are a few good reduction algos , and as with all thinsg code , each has it's own pros cons and features.
asimple one is shortest egde colapse. such that the shortest edge 's end vert is removed .
i have to figure what way to attack it .. on the finished mesh or mark verts i the data set as irrelevent , or low value because the normalis some % close to last and next .
here are some early render / beked out puts .. as fer as textures .
HeighttMap_1.jpg
(76.97 KB, 1024x1024 - viewed 36 times.)
lightMap_1.jpg
(86.12 KB, 1024x1024 - viewed 32 times.)
lightMap_bT_1.jpg
(190.35 KB, 1024x1024 - viewed 36 times.)
Logged
www.ejectedcore.com
fog
Binary Zoo
Zookeeper
Bunnymonkey
Offline
Posts: 12660
Re: PT3D - procedural terrain creation tool
«
Reply #14 on:
April 01, 2012, 10:59:36 AM »
Quote from: Prime_8 on March 31, 2012, 05:54:54 PM
asimple one is shortest egde colapse. such that the shortest edge 's end vert is removed .
I hadn't heard of that, what a great idea. The simplest solutions really are so often the best.
Logged
Pages:
[
1
]
2
3
...
7
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Feedback
-----------------------------
=> General
=> Games
=> Music
-----------------------------
General
-----------------------------
=> Game Development
=> Wildlife
Loading...