Texture on a textured terrain

Blitz3D Forums/Blitz3D Beginners Area/Texture on a textured terrain

ingenium(Posted 2006) [#1]
mmm...
i want to place a texture on a textured terrain...
like a circle to indicate what unit i have selected...
how can I?


elcoo(Posted 2006) [#2]
You mean like a sprite? I don't understand i think


elcoo(Posted 2006) [#3]
Yes, now i'm sure. You have to make a sprite. Well, maybe there's another possibillity. I'm also not to good in blitzbasic


ingenium(Posted 2006) [#4]
Here it is an example:
As you can see under the main character there is a circle that is not a sprite...


elcoo(Posted 2006) [#5]
Yes, i understand. I'm german so I've problems with the speech. I would make it with a sprite. And if u want to put screenshots in the forum, just copy the url in your post, without any "[img]"


ingenium(Posted 2006) [#6]
yeah sorry for the image :D


b32(Posted 2006) [#7]
After EntityTexture you can put a "index" parameter, that indicates which level of the entity is textured.
So you could apply the new texture using EntityTexture Terrain, texture2, 0, 1. If you want to move it, try using PositionTexture.


ingenium(Posted 2006) [#8]
yeah but the texture is repeated for the whole extension of the terrain! i don't want that!


b32(Posted 2006) [#9]
Then, use ScaleTexture texture, TerrainSize(terrain), TerrainSize(terrain)


ingenium(Posted 2006) [#10]
it's the same! the only difference is that the pieces of textures are smaller!


b32(Posted 2006) [#11]
Ah, so that is going into the right direction, then! Maybe try entering values yourselve, ie. ScaleTexture texture, 1024, 1024
And there is a EntityFX that is used for "clamping". You can disable repeating the texture on the sides of a mesh. Not sure about terrains though.


ingenium(Posted 2006) [#12]
can't find the entityfx command you are talking about...
fx -
0: nothing (default)
1: full-bright
2: use vertex colors instead of brush color
4: flatshaded
8: disable fog
16: disable backface culling
32: force alpha-blending

there is nothing for clamping...


b32(Posted 2006) [#13]
Yes, you are right. The right command is TextureFilter. (edit)However I tried it and it does not work.
Here is an example of what I mean:

!note!edited


ingenium(Posted 2006) [#14]
oh ok thnx


b32(Posted 2006) [#15]
I tweaked the example a bit and it seems that the best way to go for a clamping version, is using a big texture for the circle (terrainsize*3) and then scaling it up so only 1/3rd of the entire texture is shown. Finally, use PositionTexture to move it. That way, even when the circle crosses the edge of the terrain, the repetition of the circle on the other side still remains outside of the visible area. So then it doesn't repeat in sight.
(edit)OR: take 4 points. Read the TerrainHeight from their position and place them on top of the terrain. Then, move a quad to match these 4 points. This method is faster, but less precise. The more points the quad has, the better it 'fits' on the terrain.



Ross C(Posted 2006) [#16]
I sprite would probably be alot easier to do :)


b32(Posted 2006) [#17]
That is right. And considering that a character is above the terrain all the time, simply parenting the sprite to the object might work.
I guess every method has it's disadvantages. Using a sprite doesn't allow for moving the vertices up and down separately. Using EntityOrder causes the terrain to be rendered below any characters. The multitexture solution works, but it takes far more memory than needed. And using a quad (preferrably with multiple subdivisions) will also need some tweaking to get it right, because the distance between the vertices should somehow match the vertices of the terrain. Otherwise some parts of the quad will still end up under the terrain.



ingenium(Posted 2006) [#18]
I think i will use a sprite...


_PJ_(Posted 2006) [#19]
:)