mip mapping with HLSL

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
coldo
Posts: 8
Joined: Wed Dec 06, 2006 9:38 pm

mip mapping with HLSL

Post 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.
coldo
Posts: 8
Joined: Wed Dec 06, 2006 9:38 pm

Post by coldo »

I forgot to write, that it's about that I want at least linear mipmapping
and not nearest and point.
Saturn
Posts: 418
Joined: Mon Sep 25, 2006 5:58 pm

Post 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.
coldo
Posts: 8
Joined: Wed Dec 06, 2006 9:38 pm

Post 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.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post 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...
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

It's a bug; only the first two texunits are being set. I'm filing a Bug Report.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post 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?
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post 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.
Post Reply