Mipmaps?

Hey mipmaps are off and the game looks not blurry but when i export it to a runtime its looks blurry again.

Does anyone know how to solve this?

in BlenderPlayer


in GameEngine


thanks for thinking :slight_smile:

My problem with mipmaps was everything looked… fuzzy? It looked like TV static :open_mouth:
Not sure what to do when it’s blurry. It only happened when I hadn’t made materials for the textures. I still don’t,
I like the grainy effect!
Not sure I can help you here, unless whatever I said up there ^ was the solution.

Good luck! :slight_smile:

You should look into blenderplayer options with “blenderplayer -h”.

There is a game engine option “-nomipmap” that can be set to provide the desired effect.

Yes, but ideally shouldn’t there be a way to tell the blenderplayer respect the mipmap settings in blender? That seems like it would be the “expected behavior” to me (since one would expect the game to look the same in the internal and external player). Otherwise one must use a shell script to launch the game binary (or use a creative workaround like SolarLune’s script that automatically restarts the blenderplayer with -nomipmap).

As this question comes up relatively frequently, and as some games do depend on having mipmaps disabled, I’d like to suggest a solution: It would make sense to have a setting for this in the Render buttons panel.

Ideally, blenderplayer would just respect the mipmap settings in blender, by default.

thanks for the info but where can i find that?

Ideally blenderplayer don’t have bugs =)

You have to run the blenderplayer binary from the terminal like so:

./blenderplayer -g nomipmap = 1 yourfile.blend

(change that to blenderplayer.exe if you’re on a Windows operating system)

You could automate this with a shell script on any unix-like OS.

#!/bin/bash

./blenderplayer -g nomipmap = 1 yourfile.blend

(be sure to set the executable bit in the file permissions)

If you’re on Windows, you can accomplish the same thing with a batch file (.bat). Use Notepad to make a file that contains the command and save it as something that ends with .bat (in the same directory as your game, of course).

Hi, I guess nobody knew this, but Moguri committed an ability to disable mipmaps via Python awhile back. It’s been a few months, so you’ll need a relatively recent Blender version (the latest release candidate from the website should be fine). This is the API function. You probably want to do something like:



from bge import logic, render

render.setMipmapping(logic.RAS_MIPMAP_NEAREST)


I use this now instead of messing with the No Mipmaps setting in Blender and my launcher. With the ability to disable mipmaps, toggle full-screen mode, and set the game window size all via Python, the launcher has become a bit unnecessary to me.

awesome SolarLune but could you make a step by step tutorial ( shame on me ) i did something wrong i bet… my python skills are as good as a 3year old baby trying to cut a bread with a machete XD

weird blender does it only with low res textures like above

i used 32x32 pixels
but when i use 512x512 everything is fine

i tried downloading 2.68, and it says:

Attribute error: "module" object has no attribute called "RAS_MIPMAP_NEAREST"

Excellent news, and no, I wasn’t aware. It’s been a while since I’ve actively followed the commit logs.

@luc.ki - Ah, my mistake. It should be render.RAS_MIPMAP_NONE. The constant is stored in the render module, not the logic module, and nearest-interpolation mipmaps (RAS_MIPMAP_NEAREST) don’t do anything for the interpolation between the textures. Setting them to be off actually sets the interpolation for the textures present in the game to nearest, making them crisp / pixelly.

@F3RO - Sure. Here’s an example.

MipmapExample.blend (461 KB)

The reason why the textures are blurry is because the BGE interpolates textures linearly by default, stretching them and making them blurry / smoother. Note that if you scale them up, as you did, using Nearest or no interpolation, then the result will be pretty much the same as disabling mipmaps.

Anyway, the script in the example is just



from bge import render

render.setMipmapping(render.RAS_MIPMAP_NONE)


in a text resource. A Python controller on the camera calls this script. The controller is connected to an Always sensor that only runs once.

Note that I believe this re-creates the textures if necessary, so it should probably only be done once, perhaps when the game begins. This also should work both in Blender and the BlenderPlayer. Note that I think this causes the graphics card to work slightly harder than having the mipmaps set to be normal, which is unfortunate. It probably won’t be an issue in Single or Multi-Texture mode, but GLSL mode might be harder on your graphics card.

cool, thanks, it works nice in singleTexture and in GLSL, but in multiTexture it takes off all the textures and only shows the colors of the materials, have any idea why this happens?



edit: its definitely not working on multitexture, it doesnt even remove the mipMaps, and some objects loose their textures D:
other edit: perhaps its my damned ati card messing all the stuff?

cheers
-lucki

yeeess its working thanks man

looks good again

GameEngine.exe


TopViewMode


a last question:

how can i turn off vsync for blender and the game engine?
i want to see how big the difference is between a laptop with low specs and my pc

I believe you just have to disable it on your graphics card. As a side note I like the style your going for it kind of reminds me of mega man legends for the ps1, nice work!

thanks
once i have nearly everything with textures and story ready i open up a new thread to let you guys give me some advise :wink: