Currently, my UVs are being clamped, but I'd like them to wrap around for tiled textures. How do I configure this? I've been looking for a few hours now but I can't figure it out.
I'll note that I'm using the Unlit HLMS. In the samples it seems PBS does tile by default.
edit:
I just tried setting my materials to PBS as well but that just seems to make them not render, event though tudorhouse.mesh renders fine.
To illustrate, here's my rather mangled looking custom mesh:
[2.1] Setting UVs to wrap-around. Topic is solved
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Setting UVs to wrap-around.
Via code:
Via JSON:
The non-JSON materials do not provide a way to change the texture addressing mode from script.
Cheers
Matias
Code: Select all
assert( dynamic_cast<Ogre::HlmsUnlitDatablock*>( item->getSubItem(0)->getDatablock() ) );
Ogre::HlmsUnlitDatablock *datablock = static_cast<Ogre::HlmsUnlitDatablock*>(
item->getSubItem(0)->getDatablock() );
//Make a hard copy of the sampler block
Ogre::HlmsSamplerblock samplerblock( *datablock->getSamplerblock( N ) );
samplerblock.mU = Ogre::TAM_WRAP;
samplerblock.mV = Ogre::TAM_WRAP;
samplerblock.mW = Ogre::TAM_WRAP;
//Set the new samplerblock. The Hlms system will
//automatically create the API block if necessary
datablock->setSamplerblock( N, samplerblock );
Code: Select all
"samplers" :
{
"sampler_name" :
{
"u" : "wrap"
"v" : "wrap"
"w" : "wrap"
}
},
Cheers
Matias
-
- Gnoblar
- Posts: 15
- Joined: Mon Jun 25, 2018 7:05 pm
- x 3
Re: [2.1] Setting UVs to wrap-around.
Thanks for the help. As it turns out I hadn't compiled with rapidjson so I'll wait till tomorrow to try it out.