Hi all,
firstly, I’m completely new to Away, but looks like a fab tool. I’ve lots of experience writing shaders, so down the line hope to contribute on that front.
First of all tho, I have to get my head round Away3D!
I’m having an ‘issue’
I’m creating hundreds of Meshes based on PlaneGeometry. Each uses the same bitmap texture, but different uv co-ords / uvScale. This works as individual Meshes.
I’m then using Merge to create a single mesh. However after this, every plane subMesh has the same uv geometry, so has the same uv co-ords.
Here’s a snippet of code:
var squaresMesh:Mesh;
squaresMesh = new Mesh(null, planeMaterial );
squaresMesh.z = 100;
//
var subMeshes:Vector.<Mesh> = new Vector.<Mesh>;
for (var i:int=0 ; i<2000 ; i++) {
var singleMesh:Mesh = new Mesh(new PlaneGeometry(20,20,1,1,false),planeMaterial);
singleMesh.rotati singleMesh.rotati singleMesh.rotati
singleMesh.x=Math.random()*800-400;
singleMesh.y=Math.random()*800-400;
singleMesh.z=Math.random()*800-400;
for (var j:int=0 ; j<singleMesh.subMeshes.length ; j++) {
singleMesh.subMeshes[j].scaleU=1/32.00;
singleMesh.subMeshes[j].scaleV=1/32.00;
singleMesh.subMeshes[j].offsetU=MagicMath.randomInt(32)/32.00;
singleMesh.subMeshes[j].offsetV=MagicMath.randomInt(32)/32.00;
}
subMeshes.push(singleMesh);
}
var merge:Merge = new Merge();
merge.keepMaterial=true;
merge.applyToMeshes(squaresMesh,subMeshes);
After this point every plane in squaresMesh has the same uv data, and altering it changes all of the planes uv. I want each plane to have different uv
Think I’m misunderstanding the way to use merge, but I can’t find anything on forums etc.
Thanks in advance
Danny