Pixelated lightmaps
Pixelated lightmaps
Hey everyone. I made a quake iii map in gtkradiant for use in irrlicht, and when viewed in the engine, all the textures in the bsp are all blocky looking. here's a SS to show what i mean... http://dl-client.getdropbox.com/u/92625 ... blocky.png
I viewed the same level in the cake engine, and the textures are smooth. Any help would be nice TY
I viewed the same level in the cake engine, and the textures are smooth. Any help would be nice TY
I made it with GTKRadiant. Heres the .bsp -> http://dl-client.getdropbox.com/u/92625/myQ3map.bsp
Ok, here's the whole .pk3. http://dl-client.getdropbox.com/u/92625/myQ3map.pk3
Looks like a bug to me, the lightmap renderers ignore the bilinear filtering flag on texture layer 1.
Reproducible in quake map example, replace the block of code that does bsp load and node creation with:
Renaming topic and moving to bug reports
Reproducible in quake map example, replace the block of code that does bsp load and node creation with:
Code: Select all
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* node = 0;
int c = mesh->getMesh(0)->getMeshBufferCount();
for (int i=0; i<c; ++i)
{
scene::IMeshBuffer* mb = mesh->getMesh(0)->getMeshBuffer(i);
mesh->getMesh(0)->getMeshBuffer(i)->getMaterial().TextureLayer[0].Texture = 0;
}
node = smgr->addMeshSceneNode(mesh->getMesh(0));
Duh I'm an idiot. I've renamed the topic again
It's because your lightmap is too small (128x128), try a bigger one. My new guess is that the other engine you mention enlarges and smooths the lightmap, or displays it using a shader.
We could always add lightmap shaders if someone wrote them though
(any volunteers?)
It's because your lightmap is too small (128x128), try a bigger one. My new guess is that the other engine you mention enlarges and smooths the lightmap, or displays it using a shader.
We could always add lightmap shaders if someone wrote them though
(any volunteers?)
Shaders don't affect filtering modes afaik. I still have to set the bilinear flag within the engine...
EDIT: Wait, my spidey-misunderstanding senses are tingling...
EDIT: Wait, my spidey-misunderstanding senses are tingling...
Last edited by BlindSide on Sat Dec 20, 2008 4:18 am, edited 1 time in total.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
So it's not possible to get a smoother transition between the pixel values in a vertex shader?BlindSide wrote:Shaders don't affect filtering modes afaik. I still have to set the bilinear flag within the engine...
Then I guess the cake engine must have a minimum lightmap size
I'm going to have a little play in rendermonkey with a 2x2 bitmap and see what happens
It would have to be in the pixel shader, unless you used vertex colors as the lightmap.
A simple blur might suffice, but it's a waste of runtime resources on something that could be done as a preprocessing step. Infact, an Irrlicht utility function could just be added that enlarges an image and then applies a gaussian blur, it's a good way to get half-decent quality out of trial versions of Deled for example, which only export to 128^2 or something.
Another quirky idea would be to blur the lightmap as a post-process, this involves rendering the lightmap information separately in another pass, and may cause some dark halos around objects (Unless you also render a depth map and only blur if the depth is close enough). I've tried this on shadowmaps and despite the obvious drawbacks it does leave everything looking alot smoother.
A simple blur might suffice, but it's a waste of runtime resources on something that could be done as a preprocessing step. Infact, an Irrlicht utility function could just be added that enlarges an image and then applies a gaussian blur, it's a good way to get half-decent quality out of trial versions of Deled for example, which only export to 128^2 or something.
Another quirky idea would be to blur the lightmap as a post-process, this involves rendering the lightmap information separately in another pass, and may cause some dark halos around objects (Unless you also render a depth map and only blur if the depth is close enough). I've tried this on shadowmaps and despite the obvious drawbacks it does leave everything looking alot smoother.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
I see the problem.. I do a 2x2 pixel with bilinear filtering on a quad in rendermonkey, I can see the pixelated effect if I zoom in but it isn't very bad at all.
However, if I then multiply my values by 4 like the M4 lightmap renderer does it looks similar to the quake map without a diffuse texture. So the scale comes after the texture read, causing those ugly steps. I doubt there's a way around this
So the answer is get a bigger lightmap!
However, if I then multiply my values by 4 like the M4 lightmap renderer does it looks similar to the quake map without a diffuse texture. So the scale comes after the texture read, causing those ugly steps. I doubt there's a way around this
So the answer is get a bigger lightmap!
Yeah, bilinear is performed in 8-bit on hardware unfortunately. There is a way around this, and it's to perform bilinear explicitly in the pixel shader, but this is expensive.
If you are interested anyway, basic formula is here.
If you are interested anyway, basic formula is here.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net