Mipmapping

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Recipio
Posts: 11
Joined: Sun Aug 14, 2005 11:46 pm
Location: Sweden

Mipmapping

Post by Recipio »

I can't get the mipmapping to work the way it should. I tried loading three different images (the same image of different sizes) but it seems to choose the wrong mipmap level at the wrong places. It seems it's depending on the angle in which I'm looking at the polygons rather than the z-value. I'm using draw arrays to render the polygons. I've seen this problem discussed in other threads but I haven't found a solution to it anywhere.

To debug it I tried using a red image for the largest mipmap level, a green for the middle and a blue for the lowest. The ground closest to the camera is somewhere between red and green and a bit forward it fades out to blue. That seems quite like I want it, but further away I have walls facing the camera and they are entirely red.

Has anyone got the built in mipmapping to work the way it should? If not, what's the best way to do the mipmapping manually?
siberianstar
Posts: 70
Joined: Thu Jun 22, 2006 9:24 pm

Post by siberianstar »

The PSP hardware seems to have a bug where a texture viewed from a particular angle will use larger mipmaps than necessary, which means the appearance will change on screen as view angle changes, and there may be a performance impact.
www.goop.org/psp/gl
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Re: Mipmapping

Post by rapso »

Recipio wrote: To debug it I tried using a red image for the largest mipmap level, a green for the middle and a blue for the lowest. The ground closest to the camera is somewhere between red and green and a bit forward it fades out to blue. That seems quite like I want it, but further away I have walls facing the camera and they are entirely red.
it sounds correct. the mipmap level is selected depending on the ratio between the pixels and texels. a triangle that is facing toward u, usually has less pixels per texel than a triangle on the ground.
Recipio
Posts: 11
Joined: Sun Aug 14, 2005 11:46 pm
Location: Sweden

Post by Recipio »

Sorry, almost forgot to write back here. I got a pm from shazz saying I should do the following:

Code: Select all

float slope = 0.4f;
sceGuTexLevelMode(2, 0.f); // manual slope setting
sceGuTexSlope(slope); // the near from 0 slope is the lower (=best detailed) mipmap it uses
And that worked. :)
Post Reply