Reusing textures
Blitz3D Forums/Blitz3D Programming/Reusing textures
| ||
Hi Guys, some advice please. is it possible for 2 or more meshes to share the same texture ? (so ya dont have to load it in seperately for each mesh) But, I would like to rotate the texture on the second mesh - (if it makes a difference) Also.. what would be the best way to use a LOD - I've got 2 meshes, 1 a high poly count, one low.. should I just use HIDEENTITY - switching where necessary ? and would this stop any unnecessary processing on the mesh that isnt being displayed. (I know it hides them.. but does it stop blitz from doing the maths on it ?) Thanks, Paul. |
| ||
(I know it hides them.. but does it stop blitz from doing the maths on it ?) Not unless you stop it animating and turn off collisions with it yourself. Even then it won't be a complete "freebie" but it will be better than rendering the high poly version. |
| ||
A texture can be applied to more than one mesh. But then any changes to the texture will appear on all those meshes. That includes RotateTexture. |
| ||
Well, if you create an external configurer where you can choose whether loading the highpoly or the lowpoly, then you should easily be able to only make it load the right model. Do it like this: ;Read config file configfile=OpenFile("config.cfg") polylevel=ReadInt(configfile) CloseFile(configfile) ;Load models (0=low poly, 1=high poly) if polylevel=0 then ;Load highpoly models player=LoadMesh("player_lowpoly.x") model2=LoadMesh("model2_lowpoly.x") scene=LoadMesh("scene_lowpoly.x") ;etc.. else player=LoadMesh("player_highpoly.x") model2=LoadMesh("model2_highpoly.x") scene=LoadMesh("scene_highpoly.x") endif I think you understand the clue. Do this in the loading section... |
| ||
LOD = (adaptable) Level Of Detail The idea behind LOD is to switch between several models (like 1 very detailed and another one very gross) at runtime, based mainly on the distance from the camera. Advanced implementations even do it in a continuous way (polygons are removed or added at runtime in a continuous way. Not really doable in blitz). So you have to load all (most ot least detailed) the versions anyway. |
| ||
hmmm... ok, thanks guys. At least the terrain isnt animated, so I can probaby get away with using the ENTITYINVIEW command - and just switch the various sections of map terrain off and on. That just leaves the problem of finding out the distance that a section is away from the camera then switching the mesh, LODing as needed. |
| ||
You can change the way a texture is mapped by manipulating vertex texture coordinates - VertexTexCoords surface,index,u#,v#[,w#][,coord_set] Never used it tho - so I dunno if it does what you want. |
| ||
what does the VertexTexCoords do actually ? Does it change the location it uses for texture information inside that full texture, like lower right rectange etc..?? Just curious, for future ref, maybe make some general purpose textures, and just move texture coords for different objects to try and save on texture space. Ken |
| ||
Hi, storm3. thps3cu.com/chrml here ;). |
| ||
hyperblitzer/ChrML why the name change ? Also can anyone answer my question about the Vertexcoords ?? Am I correct on my thoughts ? |
| ||
Hi Storm, Yes you are right in thinking that, you can change the texture coordinates a mesh takes from a texture. Appreciate the advice guys, but I think somewhere along the lines the wires got crossed !?. As Koriolis has pointed out, I'm just trying to find the quickest way to calc and display which mesh to use - and if I can use the same texture for both levels of LOD (2 meshes, sharing 1 texture) - but finally I got there in the end. :) |
| ||
misc info: if you load several meshes with the exact same texture map, they will all share the same map rather than load lots of seperate ones. for example you load three different levels at once and they all refer to wood.jpg, blitz will only manage one wood.jpg internally giving a substantial video memory saving. |