Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

I've started creating a large texture atlas for my terrain so that I can use more textures with less slots.  The problem is the default mip-map generation creates bleeding on lower mip levels, and from what it says here, I need to create each mip-map separately and then combine them.  Does anyone know of a way to manually set each mip-map level into a texture?

Can I perhaps make a .dds texture with the mip-maps I want and will the editor then convert it to .tex format using those mip-maps?

Link to post
Share on other sites

The .tex files doesn't seem to retain the mipmaps in the .dds file.  I've attached the test files I used.  Also I used this code to extract the mipmap level then later draw it to the screen;

//On Load
Texture* t = Texture::Load("Terrain/Textures/beach_dirt_b.tex");
char* buffer = new char[t->GetMipmapSize(1) * 4];
t->GetPixels(buffer, 1);
Texture* tex = Texture::Create(t->GetWidth(1), t->GetHeight(1));

//On Run
context->DrawImage(tex, 100, 100);

Here is what the second mipmap should like;





Using gimp to load and edit the dds file, I can see that it is defiantly saving the second mipmap with the edit I did.  It just not showing up in the conversion to tex.

Is it possible to add a command to the texture class; SetMipMap(Texture* texture, int level)?  Provided of course it has the right resolution for that level...




Link to post
Share on other sites

I wonder if its due to the default settings for the editor when converting an image to TEX that it automatically saves it as DXT1 and with the 'Generate Mipmaps' option selected? Is it overwriting your mipmaps because of this? These have always been settings i wish we had control over instead of them just being hard-written as the defaults.

Link to post
Share on other sites

Just a quick and dirty script to view the mipmaps saved inside a TEX file:

window = Window:Create("texture detail example",0,0,800,600,Window.Titlebar+Window.Center)
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
tex = Texture:Load("Materials/beach_dirt_b.tex")
mips = tex:CountMipmaps()

while window:KeyDown(Key.Escape)==false do
	if window:Closed() then break end

	for i = 0, mips-1 do 
		if i <= 4 then 
	context:DrawText("Number of Mipmaps: "..mips,2,2)


  • Like 1
  • Thanks 1
Link to post
Share on other sites

I tried the converter on my DDS that has only 5 mipmaps and got this when loading into the editor.  So I guess it's trying to calculate them still...?

Error: Texture mipmap count (5) does not match calculated mipmap count (10).
Error: Failed to load texture "G:/Leadwerks/Projects/TestingGrounds/Materials/beach_dirt_b.tex"


As a general rule are all mipmaps supposed to present?  Right down to the lowest size? (2x2 or 1x1)?

  • Like 1
Link to post
Share on other sites
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...