Alpha grass on to the alpha terrain

Blitz3D Forums/Blitz3D Programming/Alpha grass on to the alpha terrain

Pinete(Posted 2007) [#1]
Hi all,

I've trying to put some grass quads on to a terrain composed
by various surfaces with alfa (texture splatting).

I'm using Blitzgrass and the problem is, I guess, to maintain
the order of drawing with the different terrain layers and
the alpha quads of grass. When I start painting a texture (i'm making a terrain editor) on to the terrain, it obscures all the grass placed at this area before, hiding it.

I've tried with entityorder but it doesn't works.

Maybe alpha quads are not compatible with a terrain composed for various layers.....

Please, someone could point me in the right direction or give me how to solve this?

Thanks in advance!

Stevie G(Posted 2007) [#2]
Alpha objects will always give you issues as z-ordering is disabled. This may help ...


Pinete(Posted 2007) [#3]
Thanks Stevie!
I will try to implement this... results are not guaranteed!!
I will return if I don't know how to implement...
thanks a lot!!!

Pinete(Posted 2007) [#4]
However, the problem with the z-order and alpha entities
doesn't only appears when the texture is alpha, it also
appears with entitys with alpha <> 1

I'm wrong??

This could means working with a terrain with texture splatting is a source of problems... isn't?


Naughty Alien(Posted 2007) [#5]
use mask instead of alpha for grass and problems will dissapear

jfk EO-11110(Posted 2007) [#6]
Texture splatting? I think you're not using a Terrain (CreateTerrain), but a Terrainlike mesh, probably made with T.ED or so?

If so, make sure not to AddMesh the grass to the Terain mesh, this would cause Z-Problems. The problem could also be caused by single surface grass. I wouldn't be surprised if the upset Z-order of the grass patched makes DX use the culling version of a distant Quad for a near quad and therefor skip it from rendering.

If you decide to use some kind of single surface grass system then you need the z-sort workaround, as published in the grass demo in the code archives.

It is however complicating things and may slow things down, so maybe you should try to use (in blitz) masked DXT3 (with alpha) textures. There are DDS/DXT export plugins for Photoshop and gimp etc.

Masked DXT with alpha is much better than ordinary masked textures, eg. BMP because it will use a curved outline instead of the texel contours of masked BMPs.
It will however not give you such smoothly blended Grass as Alpha.

Pinete(Posted 2007) [#7]
I've implemented the Zorder retweaked by beaker, the last in the link Stevie G has pointed some posts ago and I've a problem...

It seems works but in some of the rotations of the camera,
the problem continues appearing, I say, I place the grass with mouse and after that, paint the terrain with a texture...

In some angles of Y rotation of the camera, the grass appears to be placed on to the terrain but in other anglas, while I'm turning around the grass looking it, suddenly, dissapears...

some idea??

Beaker(Posted 2007) [#8]
Are you adding to the grass dynamically? (with the mouse?)

Pinete(Posted 2007) [#9]
Hi Beaker,

yes, I'm adding the grass dinamically, I've a terrain (mesh) based on the F.L.E terrain editor source by RifRaf (in fact, is the same, I've touched some things like scales, but not much)...

and I'm working with BlitzGrass, adding the grass with the unique function to do it, GR_AddGrass().

I've tried to insert the five alpha layers of the terrain in the zorder list and each quad of grass I create dinamically,
in the own function of Blitzgrass.

If you could help me I can send you the complete code and media by email, I'm sure it can be a silly detail, but I cannot to find how to solve it... I'm not an advanced coder as you are... :/

Thanks in advance and regards!