Fit bitmap into Plane

Software: Away3D 4.x

proyb2, Newbie
Posted: 23 October 2011 07:06 AM   Total Posts: 17

I plan to add bitmap consist of a piano keys into each plane, as each image must be the power of 2, How do I fit it exactly into a rectangle plane without distorted? And will both plane overlap each other if place side-by-side?

Do I have to create larger bitmap or use 3D model?

   

Richard Olsson, Administrator
Posted: 25 October 2011 07:00 AM   Total Posts: 1192   [ # 1 ]

Create a bitmap that looks good in Photoshop and has the right dimensions. Then resize it to the closest larger power-of-two dimensions. So if the texture is 500x300, just scale it up to 512x512. The texture will look stretched in Photoshop, but once you map it to a 500x300 unit plane, it will look right again.

   

proyb2, Newbie
Posted: 25 October 2011 11:23 AM   Total Posts: 17   [ # 2 ]

I did that on alternativa3D, some details was lost, so does in Away3D too. Is there any other method?

   

Avatar
80prozent, Sr. Member
Posted: 25 October 2011 11:43 AM   Total Posts: 430   [ # 3 ]

hi

you could use uv-mapping to make shure that only a part of the texture is mapped onto the plane.

the downside of this would be that you would waste some memory by loading a bitmap, but only using a part of it.

you could use the unused part of the bitmap on another mesh (again using uv-mapping) to prevent this memory waste.

 Signature 

sorry…i hope my actionscript is better than my english…

   

Richard Olsson, Administrator
Posted: 25 October 2011 11:48 AM   Total Posts: 1192   [ # 4 ]

You should not lose detail from doing this. Are you sure the lost detail is not due to something else, e.g. that the plane is displayed bigger on screen than the original texture (and hence the pixels of the texture are stretched/interpolated to match those on the screen) or that you are not using smoothing on the texture?

Can you show screenshots of this?

   

proyb2, Newbie
Posted: 25 October 2011 12:02 PM   Total Posts: 17   [ # 5 ]

Fitted to plane in 28x120:
http://i54.tinypic.com/awfjn5.png

Stretch to 256x256, is that smooth? I use nearest neighbor and bicube (default) in the resize option:
http://i56.tinypic.com/2uqhgjr.png

The line at the bottom of the image is vanish.

I not sure if it the issue with Z-view?

[Embed(source="wu49.png")]
private var ImageClass:Class;
  
public function 
Away3dHouse()
{
 view 
= new View3D();
 
view.camera.z=-320
 stage
.frameRate 60;

   
 var 
image:Bitmap = new ImageClass() as Bitmap;
   
 
// create the BitmapMaterial
 
var material:BitmapMaterial = new BitmapMaterial(image.bitmapData);
 
//material.smooth = true; //Tried with or without still the same result.
   
 
cube = new Plane(material,28,120); 
   

proyb2, Newbie
Posted: 25 October 2011 12:20 PM   Total Posts: 17   [ # 6 ]
80prozent - 25 October 2011 11:43 AM

hi

you could use uv-mapping to make shure that only a part of the texture is mapped onto the plane.

the downside of this would be that you would waste some memory by loading a bitmap, but only using a part of it.

you could use the unused part of the bitmap on another mesh (again using uv-mapping) to prevent this memory waste.

UV using blender to export as collada model?

   

Avatar
80prozent, Sr. Member
Posted: 25 October 2011 12:38 PM   Total Posts: 430   [ # 7 ]

for most cases i would do it that way. create Model with uv-mapping in 3d-Application like blender, and port it to away3d using 3ds,obj, collada or awd.

in your case you could do a much easier way.
modifiy the buildUV function in plane.as class.

inside the function you will find this code:

for (var yi uint 0yi <= _segmentsH; ++yi{
    
for (var xi uint 0xi <= _segmentsW; ++xi{
     uvs[numUvs
++xi/_segmentsW;
     
uvs[numUvs++yi/_segmentsH;
    
}
   } 

lets say the texture you will use is 1024*1024, but you only want to use 1024*512 of it.
change the line

uvs[numUvs++yi/_segmentsH

into this:

uvs[numUvs++= (512/1024) - ((yi/_segmentsH)*(512/1024)); 

didnt test it but should work

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

proyb2, Newbie
Posted: 25 October 2011 02:27 PM   Total Posts: 17   [ # 8 ]

I started using 3DMax studio 2011 but have no idea how to add plane and load into AWAY 4. If you don’t mind, could you advice?

   

Avatar
80prozent, Sr. Member
Posted: 25 October 2011 04:08 PM   Total Posts: 430   [ # 9 ]

sorry - i dont know anything about 3dsmax.
i am using cinema4d.
but the workflow should be the same:

create a plane primitive.
convert it into a editable mesh.
unwrap uvs (probably automaticly done when converting to mesh)
open uv-editor
set the new uvs / save the new uvs
export as *.obj or *.3ds
import in away3d using the away3d loader classes

hope that helps

 Signature 

sorry…i hope my actionscript is better than my english…

   

proyb2, Newbie
Posted: 27 October 2011 02:26 AM   Total Posts: 17   [ # 10 ]

oh dear, after spent days of persistance and try various methods, I found by setting

material.mipmap false 

has fixed the problem, the bitmap is now as clear as the sky!

Richard, I guess Away3D 4 should update the mipmap code for plane which should be disable by default, it’s nothing but confusion.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X