ywywdh / papervision3d

Automatically exported from code.google.com/p/papervision3d
0 stars 0 forks source link

Shaders not working with BitmapFileMaterial #188

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a BitmapFileMaterial with a FileLoadEvent.LOAD_COMPLETE listener
2. On load complete, create a ShadedMaterial with the bitmap file material
and a shader( FlatShader, CellShader,...)
3. Apply shaded material on a 3D model (ASE in my case)

What is the expected output? What do you see instead?

Expected: A shaded 3D object
Result: bitmap applied without the shader

What version of the product are you using? On what operating system?

PV3D 2.0 rev 894
Windows Vista

Please provide any additional information below.

I've seen this issue in several forums:
http://www.nabble.com/-PAPERVISION-3D----BitmapFileMaterial-and-ShaderMaterial-t
d15133834.html
http://pv3d.org/2008/11/21/waiting-for-a-image-to-load/
http://www.actionscript.org/forums/showthread.php3?t=172892

Original issue reported on code.google.com by PEZ...@gmail.com on 18 Apr 2009 at 5:21

GoogleCodeExporter commented 9 years ago
I had this problem too.  The trick is, you have to pass the BitmapFileMaterial 
into a
BitmapMaterial... For example: 

var bitmapFM:BitmapFileMaterial = new BitmapFileMaterial("url.png");
var material:BitmapMaterial = new BitmapMaterial(bitmapFM.bitmap, false);
var shader:PhongShader = new PhongShader(light, 0xffffff, 0x000000, 0, null, 
null);
var shadeMat:ShadedMaterial = new ShadedMaterial(material, shader, 0);
var sphereObj:Sphere = new Sphere(shadeMat, 300, 16, 16);

There is more detail on this here:
http://www.actionscript.org/forums/showthread.php3?t=172892

Original comment by wellpaid...@gmail.com on 16 Jul 2009 at 3:35