I'm trying to make a 3D block with the three.js library.
I've done it. Now i wan't to put a texture on it. I did that and it's working :
var textureHerbe = [
new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture('img/texture/herbe/border.gif')}),
new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture('img/texture/herbe/border.gif')}),
new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture('img/texture/herbe/top.gif')}),
new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture('img/texture/herbe/bottom.gif')}),
new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture('img/texture/herbe/border.gif')}),
new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture('img/texture/herbe/border.gif')})
];
Thats the result :
But look at this, it's blured !
So i looked at this this link. And i don't know how to mix my code with his solution's code :/
Do you jnow how i can do it ? Thx and have a good day.
First of all you are loading the same texture several times. So assign it to a variable and then make the textures resolution-independent and render without blurriness.
var border_tex = new THREE.ImageUtils.loadTexture('img/texture/herbe/border.gif');
border_tex.magFilter = THREE.NearestFilter;
border_tex.minFilter = THREE.LinearMipMapLinearFilter;
var top_tex = new THREE.ImageUtils.loadTexture('img/texture/herbe/top.gif');
top_tex.magFilter = THREE.NearestFilter;
top_tex.minFilter = THREE.LinearMipMapLinearFilter;
var bottom_tex = new THREE.ImageUtils.loadTexture('img/texture/herbe/bottom.gif');
bottom_tex.magFilter = THREE.NearestFilter;
bottom_tex.minFilter = THREE.LinearMipMapLinearFilter;
var textureHerbe = [
new THREE.MeshBasicMaterial( { map: border_tex } ),
new THREE.MeshBasicMaterial( { map: border_tex } ),
new THREE.MeshBasicMaterial( { map: top_tex } ),
new THREE.MeshBasicMaterial( { map: bottom_tex } ),
new THREE.MeshBasicMaterial( { map: border_tex } ),
new THREE.MeshBasicMaterial( { map: border_tex } ),
];
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments