One mesh with 3 texture paths, according Vram
Blitz3D Forums/Blitz3D Programming/One mesh with 3 texture paths, according Vram
| ||
Hi there, i'm making an apps which requiers large texture (photorealism), so i want to have 3 texture paths, according the amount of ram (32 64 128). Is it possible to specify a texture path with LoadMesh ? |
| ||
my mesh=loadmesh("Mesh.b3d") my texture=loadtexture("d:\my\path\texture.jpg") entitytexture my mesh, my texture |
| ||
Hi Osoko - there is no way with loadmesh to specify which texture(s) to load, however as Naughty Alien suggests you would have to write your own routine for loading the textures and applying it to the surfaces on the mesh. A fairly basic method would be something like this If TotalVidMem()>=128*1024*1024 then tex=loadtexture("high res texture") else if TotalVidMem()>=64*1024*1024 then tex= loadtexture("med res texture") else tex=loadtexture("low res texture") endif endif endif if tex<>0 then entitytexture mesh,tex something along those lines should help to get you going. |
| ||
I presume this methode works if the mesh has one texture map, but in my case it has severals texture maps. |
| ||
I get around this by having a "media store" of all media in their full quality. I have a seperate "Setup.exe" that when run, calculate the VRAM in the system and copes the files from the media store to their correct location. Any textures will be resized before saving. Note: Don't use the blitz in-build load/save image commands to resize textures, they do not support alpha so if you're using alpha, the textures will appear corrupted. Our racer does this, so that I can lower the texture size by half to fix the whole thing in about 16mb of vram. I used blitz image/Savebuffer commands though so it throws Alpha out of whack :( |
| ||
As an extension on Cygus's point. Why not: Texture your model with the textures. Create copies of the textures at lowers resolutions (128,64,32). Label them with exact same names and put them in a folder for each set Calculate RAM / VRAM Now, do some file processing. Copy the correct textures from their folder, into where the textures should be. It should be fairly quick, quickier than reading from buffers and such :o) TaDA! Load your models, and they will come with the correct textures for the RAM / VRAM amount :o) |