playing with texture spatting

Community Forums/Graphic Chat/playing with texture spatting

scribbla(Posted 2010) [#1]
ooops dropped the `l` splatting not spatting


i only just found out about this, yep i know its been about for years, i must get out more

am i going overboard with 4 tiles and 3 alpha maps

2 tiles are 512
1 tile is 256
1 tile 1 pixel black ( i use this for shading so i can lose a lot of the tiled look by picking out different bits of the tiled texture
plus its the only way i can think of shading without actualy modeling the geometry and grabbing an AO map)

alpha maps are 512

it just seems like im adding alot of maps , i havnt even tried it in blitz yet,
also just bought FastEXT just for multitexturing, god i hope its easy , setting this up in modo has been a real pain in the ass



with the 1 pixel tile (shading)





without the 1 pixel tile






ImaginaryHuman(Posted 2010) [#2]
It looks pretty good actually. No idea personally if this is a good approach or fast or whatever but it does look good in the latter 2 terrains.


DareDevil(Posted 2010) [#3]
your image is fantastic

Good work


scribbla(Posted 2010) [#4]
looks like its just going to stay a few images

i can not figure this multitexturing in fastext, there is example code, im just not getting it, its beyond me

im probaly the worst at coding on here

i dont suppose anyone has any simple splatting code using FastEXT for idiot to learn from ?


Ross C(Posted 2010) [#5]
Are you trying to use a blend mode of alpha, on a texture? If so, i know the support is a bit shakey in blitz. I do know there is a ton of more texture blend modes in fastEXT, you might try altering the texture blend mode?


scribbla(Posted 2010) [#6]
Hi Ross

sussed it

lightwave was not exporting both UV sets, so it took me while to figure out where the problem was,

i now export with 1st set then create second set in UU works a treat
got upto 4 tiles and 3 alpha then just get a mav on 8th texture, which sets me thinking blitz only allows 8 textures on a surface (0-7)

i think i read something about having different colours for the alpha , that way you could have 1 alpha map with multiple colours , havnt got a clue how that would work


Ross C(Posted 2010) [#7]
*Shrugs* :D

Nice to see your still working on kidx!


scribbla(Posted 2010) [#8]
had no work for last 2 weeeks

so i thought i would try and learn about splatting for big levels


Matty(Posted 2010) [#9]
Looks great.


chi(Posted 2010) [#10]
Multitexturing with FastEXT is pretty simple...

tex00 = LoadTexture("textures.dds",1+8) : TextureBlend tex00,1
tex01 = LoadTexture("alphamp1.dds",1+2) : TextureBlend tex01,FE_ALPHAMODULATE
tex02 = LoadTexture("textures.dds",1+8) : TextureBlend tex02,FE_ALPHACURRENT
tex03 = LoadTexture("alphamp2.dds",1+2) : TextureBlend tex03,FE_ALPHAMODULATE
tex04 = LoadTexture("textures.dds",1+8) : TextureBlend tex04,FE_ALPHACURRENT
tex05 = LoadTexture("alphamp3.dds",1+2) : TextureBlend tex05,FE_ALPHAMODULATE
tex06 = LoadTexture("textures.dds",1+8) : TextureBlend tex06,FE_ALPHACURRENT
tex07 = LoadTexture("lightmap.dds",1+8) : TextureBlend tex07,5


cheers, chi


Ruz(Posted 2010) [#11]
looking nice scribbla. the kid character is looking really nice these days also
perhaps he need a bit more self illumination as he looks a little grey with the shading


scribbla(Posted 2010) [#12]
thanks guys

code always good to look at, thanks chi

Ruz its always good to get tips from the top ;)

i knew things were going too well today, im having major issues with painting to the alpha channel with modo, its not basicly if you select use alpha only

if i load in a tga with alpha on from a demo and paint that a little more it paints on the alpha....

weird stuff with modo or me


i think i will take a look at blender for the splatting


ardee(Posted 2010) [#13]
Excellent little video tutorial for texture splatting in Blender by Pablo Vazquez artist on Blender's open game project (Peach) and now on their new open movie project (Durian).

http://vimeo.com/1146131?pg=embed&sec=1146131


scribbla(Posted 2010) [#14]
yeh ive seen that good vid, googled splatting and that led me onto blender


scribbla(Posted 2010) [#15]
chi if you get chance could you please cast your eye over this i posted in the user libs/ FastEXT thread as you seem to have this nailed down


#posted in userlibs/fastext thread

can any body tell me where im going wrong and how to fix it

i have a simple plane with a hill textured with 4 colourd tiles and 3 alpha maps

im using FastEXT

the problem is
when ever i turn the mesh and a part of the ground goes behind the hill the hill becomes transparent
which is not good its got to be something to do with alphas or aliens or something, i could be wrong but it looks like an alpha is blending with its self


zip file Clicky

code and exe
code wont run unless you have FastEXT the exe will



#edit i just dowloaded chi`s fastterrain if that uses the fastext blend then it works fine, dont know what im doing wrong


Ross C(Posted 2010) [#16]
Generally, i've found alphaed blended items, tend to lose their z-buffer location, and therefore aren't rendered in the correct order. I got around it by using the add blend mode. I don't know if that will work in your circumstance though...


scribbla(Posted 2010) [#17]
thanks man
but no it dont work :(

apparently i need to disable alpha-blending for mesh (Blitz3D set it automatically, if you uses one or more alpha-textures)

ive tried the fastext command
EntityBlend mesh,FE_NOALPHA
but im still getting the problem, even re made the mesh converted in UU, its just a plane with a bump in the middle


i thought i was onto a winner , about to jump in and make a big level


im doing something wrong, but cant see where


i wish i had a different hobby ;)


Ross C(Posted 2010) [#18]
Have you tried the entityfx command? Perhaps the entityfx flag for the entity has been set to force alpha blending?


scribbla(Posted 2010) [#19]
yep tried set it to 0 , nope

im coming to the conclusion its not me for once ;)

i just used one of the supplied demos on multitexturing
and loaded a plane with a hill instead of the createcube() that was in code


same problem


updated zip
zip file 2 Clicky

using the blending demo supplied, all i did here was load a plane instead of createcube() & added "EntityBlend mesh,FE_NOALPHA" (turn off alpha)


not the actual level, just mucking about, but you can see the alpha issue


painting on lightmap to pull out some of the details on the rock/pebble tile



Ross C(Posted 2010) [#20]
Only thing i can think of, is vertex alpha is at work here. And i'm not sure how to get rid of it, without cycling through all the vertices in the surface and manually unsetting it.


scribbla(Posted 2010) [#21]
nice idea
just tried it

surf=GetSurface(cub7,1)
verts=CountVertices (surf)
EntityFX cub7,2+32    ; vert color and  force alpha

For v=0 To verts-1           ; vert count starts at 0 so vert total-1 for loop
  VertexColor surf,v,50+v,100,100,1  ; sets surface,vert index,color,alpha
Next





still same effect thanks for trying


chi(Posted 2010) [#22]
There´s nothing wrong with your code... it´s your mesh! Just convert your .b3d to .3ds and get rid of this line: EntityBlend mesh,FE_NOALPHA.


scribbla(Posted 2010) [#23]
wayhay it works

3ds instead of b3d thats all it was

many thanks for taking a look


scribbla(Posted 2010) [#24]
little question how many UV sets can a 3ds mesh have as i think it only exports 1



1 for alpha
1 for tiles


jhocking(Posted 2010) [#25]
The images in your first post look great, I love seeing other people making cartoony character-based games because that gives me inspiration for my own projects (mostly cartoony character-based games.)

got upto 4 tiles and 3 alpha then just get a mav on 8th texture, which sets me thinking blitz only allows 8 textures on a surface (0-7)


That's true, Blitz only allows 8 textures. I think that's a limitation of the graphics card, I dunno. What many texture splatting systems do (eg. terrain editors) is the alpha values aren't a texture but rather vertex alpha. I don't know if Lightwave exports vertex alpha but if so that's another thing you might consider, using painting vertex colors to control where each texture is visible.

That way you don't have to use a UV set for the alpha maps, but it does have the disadvantage of duplicating the polygons a lot.


scribbla(Posted 2010) [#26]
thanks joe

im back to square one again,

i need a mesh format that works and saves 2 uv sets,

i need a beer or 6


this brings me to the question
is splatting actualy doable in blitz3d


jhocking(Posted 2010) [#27]
You might consider just doubling your terrain polygons so that the base layer is a normal model without alpha transparency, and then as another model on top is the rest of your texture layers with alpha transparency.


scribbla(Posted 2010) [#28]
too many polys, if i have a detailed level, not just the rollling hill type


1: cant get .b3d to work properly
2: 3ds works great, but only has 1 UV set , need two
3: .x & md2 only have 1 uv set

= i dont see how splatting can be done in blitz using fastext

hope im wrong i was on cloud nine when i started


ardee(Posted 2010) [#29]
When you say .b3d doesn't work properly what is it that doesn't work?

I'm pretty sure when Blender's .b3d export got support for 2 UV sets I did a quick trial that worked OK. I do remember having to open the .b3d file in Ultimate Unwrap to correct a few flags etc though and reset the texture layers to the correct UV sets.

Mind, my memory might be playing tricks.

I'll have a play about with it at the weekend.


scribbla(Posted 2010) [#30]
i get what looks like an alpha problem on a b3d file

if you did a trial on a flat plane then that will always work as nothing goes behind anything, just create a simple plane with a hill in the middle and try that

the code im using



updated zip
zip file 2 Clicky

thanks ardee , for any help you can give , even confimation of what im getting


jhocking(Posted 2010) [#31]
too many polys, if i have a detailed level, not just the rollling hill type


Have you actually tested it? On modern graphics cards the polygon count is nowhere near as important as it was in years past; videocard makers have improved polycounts so much that things like fillrate and texture memory are usually bottlenecks before polycount.


scribbla(Posted 2010) [#32]
ok just tried it

it works, but i still dont like the idea of double mesh if i have a level with thousands in

but very inventive idea ;) thanks
--------------------------------------------

for using just 1 mesh
by my little unserstanding the alpha needs to be turned of the mesh, i know "entityalpha,mesh,1" has no effect
also the fastext "EntityBlend mesh, FE_NOALPHA" has no effect
ive cycled through each vert and set vertexalpha to 1, still no good

i dont think FastEXT blends/splatting will work on a .b3d mesh

?????????


chi(Posted 2010) [#33]
Actually .b3d works fine with FastExt... I think it´s more a problem with your editor (export).
Just let me know if your problem still persists... maybe i can help you somehow ;)


scribbla(Posted 2010) [#34]
thanks chi

i still have the problem

im using
modo & lightwave to model
Ultimate Unwrap to save to .b3d


this problem will not go away

chi can you get this model to show properly, modeled in lightwave converted with Ultimate Unwrapo to .b3d,..... thanks for your help
zip file 2 Clicky


chi(Posted 2010) [#35]
sorry scribbla, couldn´t convert it properly... i tried over 3 hours to get this damn model to show correctly ;) no chance!
could you please give me your model exported from lightwave only? so i can check if it´s a problem with uu3d.


scribbla(Posted 2010) [#36]
thanks for the help, its drove me nuts over last few days

simple plane with hill on direct from lightwave

trippled
2 uv sets

hillplane.lwo Clicky


i have to
mesh1=CopyMesh ( mesh,mesh )

just to make it show up as jhocking suggested, which tells me theres no way to turn the alpha of the mesh, ive tried entityalpha and FE_NOALPHA, it dont work ;)


Ross C(Posted 2010) [#37]
It really does sound like the vertex alpha. Only way to elimante that, is to cycle through each vertex of the mesh, and set each vertex to 0 alpha. I believe it's the VertexColor() command you would use for this.


scribbla(Posted 2010) [#38]
i tried that ross

didnt work

surf=GetSurface(cub7,1)
verts=CountVertices (surf)
EntityFX cub7,2+32    ; vert color and  force alpha

For v=0 To verts-1           ; index,color,alpha,......vert count starts at 0 so vert total-1 for loop
  VertexColor surf,v,50+v,100,100,1  ; sets surface,vert change colour as well just so i know im going thru them all...... 
Next




.3ds works but only has one UV set , need 2 for tiles and alpha maps


jhocking(Posted 2010) [#39]
oh wait you're setting the mesh to EntityFX 2, that means alpha transparency is on for the entire mesh. Yeah, if you have alpha transparency on for the entire mesh then you will definitely see distant parts of the model overlapping in odd ways.

Is that necessary for texture splatting? I've never done texture splatting so I don't know, but I would think you only set alpha transparency for the relevant texture layers but not for the entire mesh.


scribbla(Posted 2010) [#40]
ive tried it with and without thats just pasted from old code

ive got that many bits of code knocking about in the folder, ive tried allsorts the code in the zip has none of that nonsense it has all new nonsense ;)


Ross C(Posted 2010) [#41]
Well, firstly you need to find your surface, from your mesh:

surf = GetSurface(mesh,index) ; index being the number of the surface. You'll probably need a bit of trial and error finding the right surface.

For loop = 1 to countvertices(surf)

   vertexcolor surf, loop, VertexRed(surf,loop), VertexGreen(surf,loop), VertexBlue(surf,loop), 1

Next



That should cycle through all the vertices in a surface and delete all alpha information, resetting to completely opaque.


scribbla(Posted 2010) [#42]
ive tried it ross when you first suggested it, i know im getting all the verts due to the colour changes , set alpha to 1 ,..but it doesnt get rid of the alpha issue

im at a loss ?


Pete Carter(Posted 2010) [#43]
Ive got a rubbish fix, that may help? Have you got ultimate unwrap?

If you have, you can export the mesh twice from your graphics program, I use Cinema4d .obj. Exporting once with your first UV applied and then with the second UV set, Then in unwrap you can load the second model and save the UV set as a file and load the first model and apply the saved UV set as the second UV. I have to do this as Cinema4d doesnt export anything with 2 uv sets.

should work if a bit long winded

Pete


scribbla(Posted 2010) [#44]
i can get both uv sets from Ultimate unwrap
i just export the mesh from lightwave with the main uv (planer type), then copy uv set 1 to 2 in UUnwrap and scale set up up and out of uv space for tiling, save as .b3d


Ross C(Posted 2010) [#45]
Well, only 3 things i can think of is doing this. The texture blend, the entity alpha, or the vertex alpha. If it's not vertex alpha, or, entityalpha, it must be the texture. Have you tried using .bmp files as your textures? Since bitmap can't have alpha in blitz, it should eliminate that.


scribbla(Posted 2010) [#46]
was worth a try Ross

but still has same issue,

.3ds works great any format on textures...but only has one UV set, so it must be something up in the .b3d file format

copymesh .b3d works great but double polys

a basic cube works one side does not show the other, but put a hill on one of the cube surfaces and it has the same problem

the basic problem
the alpha from the tetxures is still effecting the mesh even after turning the mesh alpha off

i even thought is there any way to build the mesh from scratch in blitz ,
like load in a .b3d and copy all the verts and triangles and build it in code , get the UV sets ...so it would strip everything out
...but then i thought whoa tiger sit down and have a nice cup of tea, thats way beyond you & silly idea thats what CopyMesh(mesh) does a deep copy same as create(Mesh) ;)

i give up


chi(Posted 2010) [#47]
there seems to be no fix for the alpha problem... sorry! lightwave exports and fastext blends doesn´t work together (i think).

little workaround: apply 1 uv to fit your alpha maps. convert to 3ds and scale the textures (same uv) to your need.

clicky ;)

... but if you need lightmaps too it could get tricky ;)


cheers, chi


scribbla(Posted 2010) [#48]
thanks for trying

so you have a .b3d file working with this or do you use blitz terrains

what modeler do you use chi ?

one thing after another
if i use the 3ds and scale texture/tiles
im going to loose any lightmap info i may have painted in, due to scale texture not matching placement of uvs,
like if i paint on lightmap where pebble in tile is matching that up in blitz is....lol im rambling again....i understand what im on about , damn #%@#


RifRaf(Posted 2010) [#49]
good stuff,

Chi, werent you working on a terrain editor using alpha&color maps ?


chi(Posted 2010) [#50]
@scribbla: 3dsmax9, b3d-pipeline and gile[s] 1+2. -> .b3d files work with fastext... i´ll check the lightmap problem... got an idea ;) -> edit: didn´t work, sry

@rifraf: yup, i DID work on a terrain editor... but i switched to dx9 (irrlicht) and so this project is on hold for now (or maybe forever???)


scribbla(Posted 2010) [#51]
wayhay just got an email from MikhailV

with a code fix that works, now thats what you call after sales support
SUPERB


great timing , i had already tied the knot and was standing on the chair ;)


chi(Posted 2010) [#52]
sweet!!! did he mentioned the problem? just curiouse ;)


sting(Posted 2010) [#53]
I would love to hear the solution as well.


scribbla(Posted 2010) [#54]
from email:
Function that allows to deceive a Blitz3D (internal mechanism of disconnecting
ZBuffer).

MikhailV has wrote a function to deal with it
simple function call on loading alphas..,i think it basicly stops the alpha textures going thru to the mesh


full code, just replace mesh and textures with your own





function



kudos to the man, superb support there from MikhailV


Noobody(Posted 2010) [#55]
You could also just bake all your textures and lightmaps into one single texture and put that on your terrain. If that texture is too big (say, >1024x1024), then you could split it up into smaller ones and distribute them among smaller terrain chunks.

That would save you the hassle of having to bother with realtime texture blending - only one texture, no alpha/zbuffer problems. It should be faster too, because you don't have to use a copy of the terrain for each texture layer.

Also, CreateTexture with flag 2 and sometimes 4 causes problem on newer graphic cards. Both my laptop and desktop computer display just a black texture and many people (at least on the German forums) have experienced problems as well.


Kryzon(Posted 2010) [#56]
That's you getting the support you were entitled for :)

I seriously have no idea how he comes up with this stuff. Nobody else has, anyway.

Good luck with your game.


scribbla(Posted 2010) [#57]
yep, very happy customer


stayne(Posted 2010) [#58]
I haven't tried this yet with a native blitz terrain. Judging from above I'm assuming it's possible to multitexture a blitz terrain without making copies? Wow this is good (and I'm sure old) news.


scribbla(Posted 2010) [#59]
never used it on a blitz terrain only .b3d but i would think its the same

yep no copies, thats what i had to do before copymesh() just to stop the alpha...but not anymore :)


Kryzon(Posted 2010) [#60]
I liked this thread, Scribbla.
Not a lot of people tried to achieve texture splatting with B3D (even myself, I've always been a "what if..." about this).
But you went throught all the trouble to test it, and proved it is possible.

Congrats.


scribbla(Posted 2010) [#61]
i always wondered how large terrains were textured, it was you i think that led me onto splatting & FastEXT....so its your fault ;)

its good fun , just what i was looking for thanks for heads up on splatting



needs a splatt editor, setting this up in modo is grueling


Kryzon(Posted 2010) [#62]
I don't know if this is what you're doing:

perhaps you could try tesselating your terrain a lot, changing the display mode to flat-shaded and un-textured, then using Vertex Paint to paint where the Alphas should be (using different colours for each layer).
Then you go to the top view, align your terrain to this view, render that view (or screenshoot it) and use this image as reference for when painting the alpha channels in some other program.
Might be easier than try-and-error approaches.

Then you'd only have to tweak a bit the channels after testing (and seeing if something appears where it shouldn't).

But yeah, a WYSIWYG alpha painting application would be handy indeed (perhaps that's something you could try coding, huh?).


scribbla(Posted 2010) [#63]
just playing about painting now
i think ive sussed it, trust me to do it the long way
in modo
you have to have copies of your mesh , each with a tile,alpha or lightmap on

so 4 tiles(alphas inbetween and a lightmap = 5 mesh layers,just so can see the results in realtime by painting in/out the alphas or on the lightmap, but figuring out which to paint in or out was a pain, just tried putting all meshes on same layer, its now real easy to figure out what wants painting in/out

for a template i just bake out an AO map, then paint a few highlights/shadows on the flat tiles

by having 2 rock and 2 grass textures you can totaly get rid of the tiled look and pick out some details in the tile using a lightmap gets real good results

just playing about


as for me coding an editor, i can just about string a few "if whens and whatfors" together, theres no real coder in me fighting to get out ;)


scribbla(Posted 2010) [#64]
just a heads up, dont know if this is old news for any one splatting
to use 9 images on a mesh ( i beleive direct 7 or graphics cards only allows us 0-7 , 8 total)

4 tiles
3 alpha
1 colour map
1 lightmap

(9 maps)

combine the lightmap and colour map alphas, leave the background of the colour map black and the alpha layer will pick it up for the lightmap, you also have to paste any shadows that go over the colour map, onto the colour map(image layer) as the alpha will not sort this out , but its easy enough using the original colour alpha when selecting the bits you want, confused ..i am......... this may be old news and im just late to the party

i was panicking for a moment thinking i had to get rid of a tile, for small levels you would just colour map it but for big stuff i think tile and colour map is the way go

colour map


colour & lightmap on alpha channel




just testing,
the explosion is not aligned to camera yet so thats why it looks weird
(havnt figured out how to do it yet)


blitz render



Kryzon(Posted 2010) [#65]
Very nice, but what is the size of those textures?


GaryV(Posted 2010) [#66]
The last shot, is AMAZING!


scribbla(Posted 2010) [#67]
tiles are 256 x 4
2 rock, 1 grass, 1 sand

alphas are 512 x 3

colour & lightmap (same image) 1024 x1
on a bigger level this size would not look that great

total just over 3 & half k


@GaryV
thats a look ive been after for ages, getting real world textures to look cartoony, colour choice, bluring and crank up the saturation


RifRaf(Posted 2010) [#68]
damn

guess im going to have to make my own texture alpha blend terrain editor now!

looks great!


scribbla(Posted 2010) [#69]
i beleive blender works as a good editor for this, although ive never used it so i cant say how good

video
http://vimeo.com/1146131?pg=embed&sec=1146131