123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|531|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Blitz3d - Grayscale to texture map

Sat, 16 Sep 2017, 09:30
Moon

Question/Help: Grayscale to texture map


hey all
im Moon, im new to the site as well as coding [so go easy on me]
and was wondering if I could get a little help if possible

my goal is to use a Grayscale images as a texture map in blitz3d
where each colour from black to white will have a different texture
aiming for around 19-20 different textures in total [but would be happy with 2 textures working based of a grayscale image]

any assistance on where I should start would be appreciated
Wed, 20 Sep 2017, 05:24
HoboBen
Hi Moon, welcome

As you haven't had a reply so far, do you think maybe you could explain a bit more about what you are trying to do? Maybe a really simple picture of what the result might look like?

-=-=-
blog | work | code | more code
Wed, 20 Sep 2017, 06:02
GfK
I believe he's talking about using a splatmap to reveal different textures based on the pixel colour of the grayscale image.

Pretty sure that's beyond BB3D's remit.
Wed, 20 Sep 2017, 09:36
HoboBen
Oh! I think you can do this with texture blending, for at least two textures? Unfortunately the Blitz3D documentation isn't online any more. But look at the texture blend modes like add and multiply, you might be able to get something working that way?

-=-=-
blog | work | code | more code
Sun, 01 Oct 2017, 23:11
Moon


I know blitz3d can read the greyscale image to create a terrains height map based of the greyscale images colour
I essentially want to know how that is done [the code behind the command LoadTerrain() ]
from there I wish to exchange each greyscale colour from black to white for a different texture
Mon, 02 Oct 2017, 04:21
TomToad
I once created a heightmap texture creator program from reading this book https://www.amazon.com/Focus-Terrain-Programming-Game-Development/dp/1592000282
Unfortunately, I don't know what happened to it, on one of my old drives somewhere .

The basic idea was that you would start with several textures, such as sand, grass, rock, snow, etc... You would create an empty texture in which the other textures were baked into depending on the height of the terrain. So if you defined below 50 as sand and 50-100 as grass, you would pick a textel from the sand texture wherever the terrain was 49 or below, and from the grass texture when it was 50-99. You would probably blend textels close to the boarder, maybe set at 5 or something depending on how sharp you want the edges. For example, if you set the border at 5, then height of 45 will be 100% sand, 46 would be a 90% sand, 10% grass blend, 50 would be 50%-50%, etc...

The book is worth a read. It is out of print now, but can be picked up used for a few bucks.
Mon, 02 Oct 2017, 06:56
Moon
thanks
ill give the book a read and see if I can understand it

on a side note
got most of the texture placement worked out in theory [with some simple maths]
just having difficulties in turning it into code and which commands to use
my computer and I also tend to disagree though