About sampler variable in HLSL

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
williamlai3a
Posts: 13
Joined: Wed Sep 19, 2007 11:57 am

About sampler variable in HLSL

Post by williamlai3a »

I have 2 sampler variables in my HLSL code.
I would like to ask how can I pass two textures: one is a noise map of 128 X 128, another one is a 1 X 256 gradient map, into the shader by using services->setPixelShaderConstant(...)?

indeed, I have the following in my program:

Code: Select all


scene::IAnimatedMeshSceneNode* test = smgr->addAnimatedMeshSceneNode(mesh_water, 0, 700);
test->setPosition(core::vector3df(10,10,10));
test->setMaterialTexture(1, driver->getTexture("./resource/Shader/Flame.tga"));
test->setMaterialTexture(2, driver->getTexture("./resource/Shader/NoiseVolume.jpg"));
test->setMaterialFlag(video::EMF_LIGHTING, false);
CShaderCallBack* mc = new CShaderCallBack(this->device);
		
s32 newMaterialType1 = this->gpu->addHighLevelShaderMaterialFromFiles(
	vsFileName, "vertexMain", video::EVST_VS_3_0,
	psFileName, "pixelMain", video::EPST_PS_3_0,
	mc, video::EMT_SOLID);
mc->drop();
		

Thx a lot
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Its not necessary in hlsl, in the pixel shader you do:

sampler2D myTex : register(s0); // Register it as the first texture.
sampler2D myTex2 : register(s1); // Register it as the second texture.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply