LoadTexture <> LodBrush

Blitz3D Forums/Blitz3D Programming/LoadTexture <> LodBrush

Yue(Posted 2012) [#1]
what is the difference between these two commands?, sorry for my ignorance.


RemiD(Posted 2012) [#2]
Apparently you have taken the time to search :
http://blitzbasic.com/b3ddocs/command.php?name=CreateTexture
http://blitzbasic.com/b3ddocs/command.php?name=CreateBrush

A brush is a collection of properties such as Colour, Alpha, Shininess, Texture etc that are all stored as part of the brush. Then, all these properties can be applied to an entity, mesh or surface at once just by using PaintEntity, PaintMesh or PaintSurface.




Bobysait(Posted 2012) [#3]
+ Textures are independants pixel-arrays with some stuff around to manipulate it (let's talk about Low-Level)

+ Brushes are container for materials (they enable to manipulate colors, blend, fx AND textures, they are High-level aspect for mesh)


All the stuff you do, both with textures and brushes, affects the internal brush of the mesh (EntityColor/EntityTexture/EntityFx ...etc), so EntityTexture(entity,texture) will not add a "texture" to an entity, it adds the texture to the "Entity-Brush" of the entity

Then to answer your question :
+ "LoadTexture" loads a single texture.

+ "LoadBrush" loads a single texture then creates a brush to handle it and finally returns the brush (not the texture)



Now, let's go a bit deeper :
each blitz3d "mesh" has one brush (you can access it using EntityBrush(entity), it will return a copy of the brush, so modifying the returned brush will not affect the entity, you have to "repaint" the entity using PaintEntity to overwrite the internal brush)

each surface of the mesh has (or not) a brush
(if not, then it uses the default entitybrush)

each brush may (or not) contains up to 8 textures

So, when you do "TextureEntity", you just add the texture to the EntityBrush (it is made internaly)


Some warning(s) :
/! you can't add a texture to a layer (the layer is the "slot" you specify in EntityTexture Entity,texture,Frame,Layer) that the mesh brush already uses (there won't be any error, but the texture won't be drawn)
So, just remember you can't override the default texture material, you can just "Add"
For exemple : a mesh with EntityColor 255,0,0 will be drawn "red-scaled", whatever the brushes affected to any additional surfaces (surface brush colors and pixels will scale between 0 and 255 red channel)



Here is an exemple on how to use multiple brushes on the same mesh



if you want, add a EntityColor Mesh, 255,000,000 above (or below) EntityTexture Mesh,texHo,0,0 and you'll see what I meant.


Have fun

Last edited 2012