smooth texture
and how to avoid the 2nd map tiled?
You use the same texture map as the first 1 guess so we have to overide it for the 2nd?
You use the same texture map as the first 1 guess so we have to overide it for the 2nd?
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Try it at first without tiling, just to make sure it's working. Then what you can do, is set it up so that the 3rd texture stage uses the 1st texture stage( and you can tile those texture coords ) but leave the 2nd texture stage to use use it's default texture coords and don't tile them, so that the alpha map is correct.
I'm still looking at getting this working properly myself. I'm noticing different results on different computers. I'll let you know when I can figure something out.
I'm still looking at getting this working properly myself. I'm noticing different results on different computers. I'll let you know when I can figure something out.
hestill tiles it. the strangest is that the tiling times stay the same, even if they have no tile only strecth on the x model
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
@Spintz
the texture stays tiling. The 2nd texture stretches to the ends of the model, but why when i use the blend it tiles 400 times on the model?
the texture stays tiling. The 2nd texture stretches to the ends of the model, but why when i use the blend it tiles 400 times on the model?
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
I load data from special xml file,
irr::scene::IAnimatedMesh* anim = Device->getSceneManager()->getMesh(StructXML->Filepath);
if (anim) {
irr::scene::ISceneNode* node = Device->getSceneManager()->addAnimatedMeshSceneNode(anim,0,-1,StructXML->pos,StructXML->rot,StructXML->Scale,false);
if (StructXML->collosion == 1) {
irr::scene::ITriangleSelector* selectos = Device->getSceneManager()->createOctTreeTriangleSelector(anim->getMesh(0),node,128);
node->setTriangleSelector(selectos);
selector->addTriangleSelector(selectos); //meta select
selectos->drop();
}
node->setMaterialFlag(video::EMF_FOG_ENABLE,true);
node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS,true);
video::ITexture* texture1 = Device->getVideoDriver()->getTexture(StructXML->texture0.c_str());
video::ITexture* texture2 = Device->getVideoDriver()->getTexture(StructXML->texture1.c_str());
video::ITexture* texture3 = Device->getVideoDriver()->getTexture(StructXML->texture2.c_str());
node->setMaterialTexture(0,texture1);
node->setMaterialTexture(1,texture2);
node->setMaterialTexture(2,texture3);
node->setMaterialType(video::EMT_SOLID_2_LAYER);
}
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Doens't make any difernce when i say
this should set all textures layers the same right?
even this doens't help. i only have 1 texture layer
Code: Select all
Device->getSceneManager()->getMeshManipulator()->makePlanarTextureMapping(anim->getMesh(0),0.01f);
even this doens't help. i only have 1 texture layer
Code: Select all
node->getMaterial(0).Texture1 = texture1;
node->getMaterial(0).Texture2 = texture2;
node->getMaterial(0).Texture3 = texture3;
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
makePlanarTextureMapping only modifies the 1st texture coordinate. So, this will only scale your base texture. A workaround, so you don't have to modify the makePlanarTextureMapping function, would be to change the material to -
This will make the 3rd texture stage use the 1st texture stage's texture coordinates and take advantage of the scaled texture coordinates from makePlanarTextureMapping.
Code: Select all
//! Solid 2 layer material renderer
class CD3D9MaterialRenderer_SOLID_2_LAYER : public CD3D9MaterialRenderer
{
public:
CD3D9MaterialRenderer_SOLID_2_LAYER(IDirect3DDevice9* p, video::IVideoDriver* d)
: CD3D9MaterialRenderer(p, d) {}
virtual void OnSetMaterial(SMaterial& material, const SMaterial& lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices* services)
{
// base texture( texture stage 0, normal operations, but save them to the temp register )
pID3DDevice->SetTextureStageState( 0, D3DTSS_RESULTARG, D3DTA_TEMP );
// alpha texture( texture stage 1, we just need to grab the alpha value from the texture at this stage
pID3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pID3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
// this the the blend texture, we want to blend this color with the color from texture stage 0( which is
// in the temp register ) using the alpha we got from texture stage 1.
pID3DDevice->SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_BLENDCURRENTALPHA );
pID3DDevice->SetTextureStageState( 2, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pID3DDevice->SetTextureStageState( 2, D3DTSS_COLORARG2, D3DTA_TEMP );
pID3DDevice->SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, 0 );
services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
}
virtual void OnUnsetMaterial()
{
// base texture( texture stage 0, return the target to current, rather than the temp register )
pID3DDevice->SetTextureStageState( 0, D3DTSS_RESULTARG, D3DTA_CURRENT );
pID3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );
pID3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
pID3DDevice->SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_DISABLE );
pID3DDevice->SetTextureStageState( 2, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pID3DDevice->SetTextureStageState( 2, D3DTSS_COLORARG2, D3DTA_CURRENT );
pID3DDevice->SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, 2 );
}
};
Last edited by Spintz on Sun Mar 04, 2007 2:36 pm, edited 1 time in total.
100% thanks, there's still something wrong with the coords but i think that's the model, i think i can fix that.
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
i have to give texture 1 als the coords of texture 0 else its still wrong, but the problem is that i want to tile texture 0 and 2 and 1 must stretch. and that goes totaly wrong. and by this way even texture 1 is tiled.
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
You can't currently do that with Irrlicht. There's one setting for wrap/clamp that gets applied to all four texure units. It's one of the around dozen issues I've pointed out that are being addressed by Hybrid, I believe.strong99 wrote:i have to give texture 1 als the coords of texture 0 else its still wrong, but the problem is that i want to tile texture 0 and 2 and 1 must stretch. and that goes totaly wrong. and by this way even texture 1 is tiled.
I also mentioned this to Spintz and he has already addressed this in IrrSpintz. He's also added per-texunit texture addressing *and* spcifying filtering per wrap-direction (UVW).
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781