Light and Textures

Software: Away3D 3.x

Tempy111, Sr. Member
Posted: 22 December 2015 10:42 AM   Total Posts: 133

Sigh,

I got a DirectionalLight all working. BUT when I set up the texture for the main character (before I do others), I can’t get both Lighting and texture to appear. the model comes off as untextured but with light and shadows.

I load a BitmapFileMaterial which works normally, for the light I tried whiteShading and then Phong.. the lines for both (I used one or the other was)

var newMaterial:WhiteShadingBitmapMaterial = new WhiteShadingBitmapMaterial(RabbitTex.bitmap,{repeat:true}); 
var newMaterial:PhongBitmapMaterial  = new PhongBitmapMaterial(Cast.bitmap(RabbitTex.bitmap),{repeat:true}); 

I tried just using the bitmap data from the texture, didn’t work. so I found out and tried ‘Bitmap’ and that seams to be okay.. but probably not. I tried just passing it, then I tried to cast it as you can see.

neither works.. I think I haven’t got the bitmapData to pass right..

problem is, most Tutorials and guides use embedded bitmaps more then filematerials so.. help is tricky.

once this is done I can work on shadows ^_^ maybe

   

Tempy111, Sr. Member
Posted: 22 December 2015 05:36 PM   Total Posts: 133   [ # 1 ]

using Embedded bitmap instead (which is what I thought I might have to) I’ve gotten WhiteShading to work, but not phong.. phong just comes off as one colour (maybe from the texture map though)

   

Tempy111, Sr. Member
Posted: 22 December 2015 10:33 PM   Total Posts: 133   [ # 2 ]

damn confusing thing.. everything says this is right.. I’ve set up the light right, I’ve embedded the texture right.. but

var newMaterial:WhiteShadingBitmapMaterial = new WhiteShadingBitmapMaterial(Cast.bitmap(RabbitBitmap),{repeat:true}); 

works fine!

var newMaterial:PhongBitmapMaterial = new PhongBitmapMaterial(Cast.bitmap(RabbitBitmap),{repeat:true}); 

just takes one colour from the texture and spreads it over the model.. the only answer I can think is.. does the Phong shading NOT allow repeat?

I guess that’s the only thing.. checking the phongBitmapMaterial file does seam to show a lack of repeat.. so without fully understanding how it shades.. I guess that’s it.. tricky..

   

Tempy111, Sr. Member
Posted: 23 December 2015 12:23 PM   Total Posts: 133   [ # 3 ]

Carrying this on encase anyone else has problems this can help ^_^

basically, PhongBitmapMaterial will NOT allow the Repeat function to work at all. So what you need to do is to use a Composite material to add the phongtexture to a complete ‘repeated’ texture which is pretty simple.

unrelated, I’m noticing the Phongtexture isn’t looking much different from flat shading.. which is kinda odd but oh well..

   
   
‹‹ HoverCam3D movement

X

Away3D Forum

Member Login

Username

Password

Remember_me



X