Dynamically changing image in a Material ImageMap

Aug 26, 2010 at 8:03 PM

Is it possible to change an  image programmatically in  an Material ImageMap.

Something like this :

         

_mesh.Material.DiffuseMap = new WritableBitmap( source );

I want to update maps on 3d objects programmatically.

Thanks Sverrir

Balder is opening up a big window in Silverlight.

Coordinator
Aug 27, 2010 at 6:48 AM
You need to implement the IMap interface and provide the pixels. In a couple of days there will be support for drawing directly.
Aug 30, 2010 at 10:21 AM

I implemented the IMap interface and now I can do like this :

 

_mesh.Material.DiffuseMap = new DiffuseMap( new WritableBitmap( _someCanvas ) );

 

It works fine, you have to use the same size as the original image that was referenced in the ASE file.

Then you can draw on the canvas and update the map.

Is it possible to change the UVMap programmatically ?

Thanks Sverrir

 

Coordinator
Aug 30, 2010 at 6:33 PM

Great that you got it working. 

The UV coordinates are in the Geometry. On any Geometry there is a property called FullDetailLevel - inside it there is methods related to a concept called TextureCoordinates. Faces have a DiffuseA, DiffuseB and DiffuseC that index into the TextureCoordinates. So changing the texture coordinates and/or faces and their corresponding indexed coordinate you should be able to do all that. You can always regenerate the entire collection of TextureCoordinates.

Aug 31, 2010 at 11:22 PM

Hi, look forwards for a possible simple tutorial/sample illustrating how to update the material with new WriteableBMP

(when you finally release the Imap interface method)

Is there a need to lock and unlock the texture in Balder (as this is a typical process in Directx3D programming)

Thanks again.

 

Oct 18, 2010 at 9:58 PM

Can you provide a fuller example of how to update the DiffuseMap with a WriteableBitmap?

"You need to implement the IMap interface and provide the pixels. In a couple of days there will be support for drawing directly."

 

Many thanks.

Coordinator
Oct 19, 2010 at 4:59 PM

I'll see what I can do either this week or next. Sorry that it takes a while for me to get samples for this. Hope you're not losing hope. :)