Textures!.... its whats for dinner?

Blitz3D Forums/Blitz3D Beginners Area/Textures!.... its whats for dinner?

DroolBucket(Posted 2006) [#1]
I've made a wonderful looking terrain using DeleD-lite. I've exported it as a .x file and when i load it into the game everything works just fine the textures are already applied right onto the terrain

everything was wonderful and their was much rejoicing...

however, i decided i want to blend the textures together so it looks more natural

This causes a problem because the command TextureBlend wont work because the textures for my terrain are contained in the .X file

Does anyone have a way to get around this? or is it unavoidable and i'm going to have load the textures and mesh separately and then use texture blend? can this be solved using a brush or some other valuable asset of B3d that i tend to ignore?

-Droolbucket


Stevie G(Posted 2006) [#2]
http://www.blitzbasic.com/b3ddocs/command.php?name=GetEntityBrush&ref=3d_a-z

http://www.blitzbasic.com/b3ddocs/command.php?name=GetBrushTexture&ref=3d_a-z

These 2 should help.

Stevie


DroolBucket(Posted 2006) [#3]
So i basically copied out of the blitz docs that stevie recommended


level = LoadMesh("C:\Documents and Settings\Christian\Desktop\ter9.x")
ScaleEntity level, .35,.35,.35
PositionEntity level,0,0,0

ter_surf=GetSurface(level,1)
ter_brush=GetSurfaceBrush(ter_surf)
ter_tex=GetBrushTexture(ter_brush,0)
TextureBlend ter_tex, 1




The textures still wont blend =(

whats is stranger still is the different answers blitz gives for the command TextureName...take a look

When i do TextureName$(ter_tex)with the code above, i get a really strange bmp file that seems to be only 1 pixel (when i open it up with imageviewer) however when i use this code i get nature02.jpg (one of the textures i used when makeing the terrain in DeledLITE)


; Load mesh
crate=LoadMesh("C:\Documents and Settings\Christian\Desktop\ter9.x")
PositionEntity crate,0,0,100

; Get mesh surface
surf=GetSurface(crate,1)

; Get surface brush
crate_brush=GetSurfaceBrush(surf)

; Get brush texture
crate_tex=GetBrushTexture(crate_brush,0)




im just really confused is all, and looking for some answers

-droolbucket


b32(Posted 2006) [#4]
Maybe the first program can not find the texture, and the imageviewer makes the 1x1 bitmap, because it couldn't find it. I know this 1x1 bitmap from right-clicking the desktop, and choosing new->bitmap
The textures and the terrain should be placed in the same directory. And if possible, in the .X file, the texture names should be local, I mean without a path.

After finding the correct texturename, free the brush and the texture that you used to find it. Then, reload the texture using LoadImage and apply it to the model. This should allow you to apply and textureblending, I hope.


DroolBucket(Posted 2006) [#5]
Well that would work pretty well except that the Model i am using is multi-textured and when i use "getsurface getsurfacebrush and getbrushtexture" i only get one texture.

Then when i re-load it and use entity texture, the whole model is one texture

When i use texturename(terrain_tex) i get what i want to see (ONE of the textures i used to model the terrain)

oh and yes, The texture files in the .X are local

But the textures still wont do any blending for me =(
-Droolbucket


b32(Posted 2006) [#6]
That is probably because the mesh structure can have children and multiple surfaces. Here is an adapted version of the loadmesh example. It has a function that searches through the mesh and reloads all textures. I used LoadBrush instead of LoadTexture so I could use PaintSurface: