Page 1 of 1

mip mapping with HLSL

Posted: Thu Dec 21, 2006 4:21 pm
by coldo
sampler2D sampTex0 : register(s0) = sampler_state { MinFilter = LINEAR; MagFilter = LINEAR; };


Why doesn't that work, when I use "register(s0)"???
I must use register(n) because otherwise it is impossible to set texture
units with textures. I need HLSL specific answer.

Posted: Thu Dec 21, 2006 4:22 pm
by coldo
I forgot to write, that it's about that I want at least linear mipmapping
and not nearest and point.

Posted: Thu Dec 21, 2006 5:12 pm
by Saturn
That doesn't work, because you confuse HLSL-syntax with fx-syntax. You can only use pure HLSL with Irrlicht.

But you don't need it anyway. Since you can decide the sampling filter in the Irrlicht SMaterial already. Linear is the default.

Posted: Sat Dec 23, 2006 8:39 pm
by coldo
Here is my code for loading terrain.

terrain = smgr->addTerrainSceneNode"../../media/terrain/heightmap.bmp");
float TERR_SIZE = 280;

terrain->setScale(core::vector3df(TERR_SIZE, 25.0f,TERR_SIZE));
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);

terrain->setPosition(vector3df(-TERR_SIZE*256/2,-700,-TERR_SIZE*256/2));
addTerrain(terrain,nWorld,terrain->getScale().X,terrain->getScale().Y,0,terrain->getPosition());


terrain->setMaterialType((video::E_MATERIAL_TYPE)matTerrain);
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
terrain->setMaterialFlag(EMF_POINTCLOUD, false);
terrain->setMaterialFlag(video::EMF_BILINEAR_FILTER, true);
terrain->setMaterialTexture(0, driver->getTexture("../../media/TERRAIN/alphamap.bmp"));
terrain->setMaterialTexture(1, driver->getTexture("../../media/TERRAIN/s5.bmp"));
terrain->setMaterialTexture(2, driver->getTexture("../../media/TERRAIN/s18.bmp"));
terrain->setMaterialTexture(3, driver->getTexture("../../media/TERRAIN/s17.bmp"));


Result is here: Image

Why the hell filtering doesn't work as it should????
Don't forget I'm using register(s0)... stuff in shader because of 4 texture support.

Posted: Sat Dec 23, 2006 9:40 pm
by sio2
It looks to me that one or more textures are point filtered...

You know, this may be the same kind of thing that I'm seeing. I'm loading Doom3 MD5 models and applying four textures in a high-level custom shader: diffuse, gloss(specular), normal-map, height-map. I can see "pixellation" as though one or more of the texture stages are point filtered.

I'm going to go and see if I can track this down in the source. More later...

Posted: Sat Dec 23, 2006 10:03 pm
by sio2
It's a bug; only the first two texunits are being set. I'm filing a Bug Report.

Posted: Tue Jan 02, 2007 2:01 am
by BlindSide
sio2 wrote:It looks to me that one or more textures are point filtered...

You know, this may be the same kind of thing that I'm seeing. I'm loading Doom3 MD5 models and applying four textures in a high-level custom shader: diffuse, gloss(specular), normal-map, height-map. I can see "pixellation" as though one or more of the texture stages are point filtered.

I'm going to go and see if I can track this down in the source. More later...
Is there a way to manually set the textures to point filtered?

Posted: Tue Jan 02, 2007 10:32 am
by sio2
BlindSide wrote:
sio2 wrote:It looks to me that one or more textures are point filtered...

You know, this may be the same kind of thing that I'm seeing. I'm loading Doom3 MD5 models and applying four textures in a high-level custom shader: diffuse, gloss(specular), normal-map, height-map. I can see "pixellation" as though one or more of the texture stages are point filtered.

I'm going to go and see if I can track this down in the source. More later...
Is there a way to manually set the textures to point filtered?
Individually, no. Currently, one setting is applied to all four texture units.