weird blurry artifacts with material.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

weird blurry artifacts with material.

Post by Cube_ »

So, while I could create a new material for each cube I don't really want to do that (optimizations become impossible) so instead I declare some materials as such

Code: Select all

video::SMaterial* material = new video::SMaterial();
and do this in my cube generation logic (instead of my previous method of making new materials all the time)

Code: Select all

buf->getMaterial() = *material;
And it works.
Sorta.
the material comes out super blurry though.
comparison screenshots
expected result:
http://i.imgur.com/3tgVdBP.png
actual outcome:
http://i.imgur.com/XvaSIq6.png
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: weird blurry artifacts with material.

Post by CuteAlien »

Compare the values of the buffer material with the material after copying it. They should be identical - but maybe operator= in SMaterial has a bug? (I don't think so, but who knows...)

But something about materials:
- Why create one with new anyway? You can just use on on the stack.
- Nodes usually overwrite buffer materials unless you set IMeshSceneNode:: setReadOnlyMaterials to true. Meaning you can also set the node materials later on. Mentioning this as I said in another thread already you can just create one mesh and use that in all nodes. Just in case you don't do that because you need different materials at some point. There's no need to worry about that.
- And nodes having own material also means - if you set the lines above _after_ creating the node, then the node won't be affected.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: weird blurry artifacts with material.

Post by Cube_ »

I have no particular reason for creating the material with new really, it makes for easy testing though, as for why I don't just instance every mesh... that works fine if I only had maybe 12 different blocks but alas I have a lot more than that, my small testing set is 31 different ones and the final amount will be much greater.


Why would the node overwrite the buffer materials anyway? (the reason I'm declaring the materials before the mesh and then setting the buffer materials to these materials is to allow optimizing, greedy meshing only works on meshes with the same material)
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: weird blurry artifacts with material.

Post by CuteAlien »

No idea why that is the default - this decision was made before I joined Irrlicht. Maybe it's just a typical case that you use same mesh with different materials. I can only tell you it's there and how to disable it if you don't want that :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: weird blurry artifacts with material.

Post by Cube_ »

I'll disable that behavior as I set my own materials, anyway after experimenting it seems materials default to having bilinear filtering on, which is of course completely awful looking for low res (8x8px) textures.
"this is not the bottleneck you are looking for"
Post Reply