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.

3 Dimensional Chat / realistic landscape texturing?

Author
Message
Jetmech
22
Years of Service
User Offline
Joined: 25th Oct 2002
Location: Dayton Ohio
Posted: 28th Dec 2003 02:31
Been working on a Geoscape type landscape editor ( believe it or not it was inwork long before I ever knew of Geoscape he he) and Im looking for a decent way to generate realistic texturing based on altitude and terrain type. it has the option to create an object from the matrix terrain so Im dealing with (possibly) 2 different processes. Ive tried all kinds of different tiling methods for the matrix, and setting each vertex color based on the height for the object, came close but not what ime looking for :-(

any ideas?
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 28th Dec 2003 02:34
What program are you using?

Boy i sure wish i had a life....
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 28th Dec 2003 06:36
Quote: "Been working on a Geoscape type landscape editor"




Hmm, would love to see this done. Ive been waiting for heightbased texturing for a while. Might want to find some examples of texture blending code and see if you can implement it. I know Puffy did some heightbased texture blending on a matrix, and Kevil did too in his example. Check those out.

Kevil posted his source in the Code Snippets, Puffy never released his I dont think...

RPGamer


Dont forget to Join the Forums!
Jetmech
22
Years of Service
User Offline
Joined: 25th Oct 2002
Location: Dayton Ohio
Posted: 30th Dec 2003 07:47
@ Underlord, Sorry bout that, I'm using DB pro

@ RPG maker, thanks, Im checking them out now!
adr
22
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 30th Dec 2003 11:44 Edited at: 30th Dec 2003 11:46
http://www.flipcode.com/tutorials/tut_proctext.shtml explains texture-blending based on a heightmap and as for the texture blending algorithm itself...

point(1,x,y) gets the RGB colour value from a pixel on bitmap 1. So if you want to blend two pixels, you need to get the other corresponding bitmap pixel....

non-tested code alert
-------------------------
blend# = 0.3
colour1 = point(1,x,y)
colour2 = point(2,x,y)
blendedColour = (colour1*(blend#))+(colour2*(1-blend#))
-------------------------

blendedColour is now the colour of colour1, blended "30%" towards colour2. That's as far as I've got with texture blending - I'm still trying to make a contiguous memblock mesh correctly...

Hope this is useful

(cheers to TheDarthster for pointing out that to blend two colours, all you is add em)

Can I ask you a Question?
What is it?
It's an interrogative form of sentence, used to test knowledge. But that's not important right now.
arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 30th Dec 2003 17:06
Blending is not a problem, problem is that you have to create tilles for every blending posible since you can texture martix with only one image file (have to contain all texture) ..similar goes for meshes.

for two diferent textures I use 16 tilles, 2 original + 14 blended (from right to left, from top to down, from left top corner etc...)

For more than two textures number of blended tilles rapidly increase since you have to combinate more than two of them.

If you have all tilles in one image file then you have to make tille data (I use 2dimen. array) for example based on height and texture matrix tilles with apropirate texture tille.

I am just working on terrain generator were texture is applied depending on height over sea ...rocks and grass. Should be finished soon
adr
22
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 30th Dec 2003 22:15
I'm not gonna use matrices... I'm gonna use meshes, which makes the terrain texture generation a bit more straight-forward.

Can I ask you a Question?
What is it?
It's an interrogative form of sentence, used to test knowledge. But that's not important right now.
arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 30th Dec 2003 23:32
you are not going to have it much easier since texture for martix and mesh have the same limits ...have to be one file and there are limits in size depending on your g.card.

In some situation that might be ok to use one texture and wrap it around terrain, but if you want reasonable detail than you have to find way around. Only way I can think about is to split your mesh terrain to blocks and then texture each with separate texture. Thats just idea I am no expert in this

For blending textures I use 2 diferent textures I want to blend and greyscale source texture (for example being black at left and then going smoothly to white at right side)
then I do this:

x,y are pixel coordinates in image (you have to do it for each pixel)

for 1.texture
c=point(x,y)
fr=RGBR(c)
fg=RGBG(c)
fb=RGBB(c)

for 2.texture
c=point(x,y)
sr=RGBR(c)
sg=RGBG(c)
sb=RGBB(c)

for greyscale blending texture
c=point(x,y)
v#=RGBR(c)/255 (255 is maximum value posible)
-you dont need to get G and B values since in greyscale all are the same

final calculation
vr=(sr-fr)*(v#)+fr
vg=(sg-fg)*(v#)+fg
vb=(sb-fb)*(v#)+fb
ink RGB(vr,vg,vb),0
dot x,y
Jetmech
22
Years of Service
User Offline
Joined: 25th Oct 2002
Location: Dayton Ohio
Posted: 31st Dec 2003 03:57
ADR thanks for that flipcode article, that gave me some awesome Ideas to try out. Hopefully if this works, I'll have something worth uploading by the end of the week!

@ RPG Gamer - never was able to find the code snippet you were talking about!
Jetmech
22
Years of Service
User Offline
Joined: 25th Oct 2002
Location: Dayton Ohio
Posted: 1st Jan 2004 09:15 Edited at: 1st Jan 2004 19:36
"Blending is not a problem, problem is that you have to create tilles for every blending posible since you can texture martix with only one image file (have to contain all texture) ..similar goes for meshes"

Not exactly true, as long as you supply the base textures. using the article that ADR referenced I managed a decent way to blend textures on the fly.

I have 5 textures each one for a different height region. grabbing the Matrix Height and the coressponding pixel color from each texture, figure out the percentage that each texture would be visible at that height, then blend the colors according to the percentage and write the final color to a new bitmap.

This gives me a final bitmap with all the textures blended nicely, I then just grab the image and texture the matrix with it. I'll post some screenshots this weekend

arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 1st Jan 2004 19:35
Hove big are final textures (tilled) ?
Jetmech
22
Years of Service
User Offline
Joined: 25th Oct 2002
Location: Dayton Ohio
Posted: 1st Jan 2004 19:48 Edited at: 1st Jan 2004 20:32
Ive experimented using 128,256 and 512 Textures tiled on a 64X64 and 128X128 matrix, needless to say the smaller the texture the worse the quality. in about 5 minutes Im going to post a PRE alpha
version of the editor in the Work In Progress section. still a lot of work to go on the texturing, but i think im on the right track.

check it out, let me know what you think

John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 1st Jan 2004 20:03
In the code snippets area, look for the post by Kevil


Dont forget to Join the Forums!
Jetmech
22
Years of Service
User Offline
Joined: 25th Oct 2002
Location: Dayton Ohio
Posted: 1st Jan 2004 20:40
Yes I saw that Post earlier, he's doing some awesome stuff there!, when I saw that post i realized that memblock matrix work he had done must have been what you were refering to earlier. unfortunately as far as texturing was concerned he used just one base grayscale texture and then set the diffusion color for the different heights. problem with that is if you crank up the ambient light, you lose all the color and end up with a gray landscape

Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 1st Jan 2004 21:27
Im working on a DBC world editor, and I know that blending textures is hell, I've heard that C&C Generals uses 400 base tiles and 16119 blended tiles


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 2nd Jan 2004 18:09
Quote: "Ive experimented using 128,256 and 512 Textures tiled on a 64X64 and 128X128 matrix, needless to say the smaller the texture the worse the quality"


Yea and that is the thing unfortunately...
I am applying tiles no les than 256/256 big which gives their look still fine. For two diferent textures I use, I need basic texture 1280/1024 big divided to 20 tilles: 4variations of firsth texture, 2 wariations of second texture and rest are transitions between them.
Here is howe its looking (I was making it smaller for posting):


I want to be able to use 3 diferent textures later which will increase number of combination between them of course.

Once I was asking if size of texture used on matrix (basic one) is limited and somebody told me that not unles I get tilles no more than 256*256 big. I was running some tests and it seems that size is limited, probably by graphic card. When I tried texture which was too big it seems that it was resizing it or at last quality of texture droped. That mean that if you want to use too many diferent textures you have to give up their quality (bigest possible size of texture tilles will be smaler)
If you have diferent experience, please post here...
Jetmech
22
Years of Service
User Offline
Joined: 25th Oct 2002
Location: Dayton Ohio
Posted: 2nd Jan 2004 18:16 Edited at: 2nd Jan 2004 18:44
heres some screenies using a 128 X 128 matrix and 256X256 texture

theres an alpha download in the workin progress board.





thats using a 1 snow,1 rock,2 grass and 1 mud textures (5 total). the program reads one pixel from each texture and then gets the height of that position on the matrix.
it then determines the % of each texture that would be visable at that height ie. at 500 there would be 100% snow, and 0% of everything else, however at 450 it may be 50% snow and 50% rock so it would blend 50% of the color values of those two textures.

I would think it wouldnt be to hard to adapt that to any tiled map where you could just use an array to tell which tile goes where and have your program create the finished map as 1 texture. Ive used a 512X512 image to texture a 128X128 matrix and it looked pretty good.

John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 2nd Jan 2004 18:37
Very very nice man! Im looking forward to this


Dont forget to Join the Forums!
arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 2nd Jan 2004 20:31
If you try to position character on such a terrain, one texture pixel would be bigger than your character. In fact one tile of your matrix is textured with only 2*2pixels.
Even if you use 512*512 texture you get only 4*4pixels per matrix tille.

I am texturing one matrix tile with 256*256 pixels. My matrix tile is dozen or more meters big so even such detail is not great.

I would never be able to get texture detail I need like this. Even if I would accept detail level I cant do that because my world is much bigger than matrix I use. I am positioning matrix center at camera position and reading height at martix points from map array + texture tille number ...all in real time. If I would try to generate new texture each time I need to reposition matrix it would be probably so slow that it would be useles.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 3rd Jan 2004 00:41
rotate matrix tile will help with these issues and has been requested as a new command. It will drastically improve space per sector or division.

I have a texture according to a heightmap but i need a better blending process until that comes I have to wait or try and code it myself.

Login to post a reply

Server time is: 2025-06-27 17:30:58
Your offset time is: 2025-06-27 17:30:58