Dynamic Textures in M3G Example

I’ve just added a new M3G (mobile 3D) example to my Killer Game Programming in Java site (http://fivedots.coe.psu.ac.th/~ad/jg/ concerned with dynamic textures.

A dynamic texture is one generated at run time, and can include transparent areas.

Comments are appreciated.

  • Andrew

Had a go with doing this a while back.

I found it was very slow on alot of the handsets out there, presumably because writing to texture memory isn’t as fast as main memory.

Incidentally,
depending on what you are using the technique for, you can avoid doing quite so much memory copying by doing an Image2D.set(…) to clear to transparent, bind a Graphics3D to the Image2D, and then perform the rendering with a parrellel projection and Sprite3D.

You can obviously do more funky stuff too - rendering a 3D scene to a texture for example. (for imposter rendering)

Abuse,

Thanks for the performance info, which I suspected but hadn’t been able to test myself.

At the end of the chapter, I mention that often you only need to generate the dynamic texture once. For example, when you need a user name label in the scene. For a once-off task, the overhead may be acceptable.

Your suggestion about 3D texture rendering is an interesting one. You should post an example MIDlet.

BTW, I’ve included your post as a “readers comment” at
http://fivedots.coe.psu.ac.th/~ad/jg/m3g6/readers.html. If you want to change it, please get in touch.

  • Andrew

Yep, I had to do this for our last project… but it was UGLY!
The problem was that 3d on mobiles is simply ugly and our customer wanted it to look nice.
I have posted some of my findings at benhuis site.

‘Dynamic’ Textures works quite well. I had to switch multiple textures out during rendering.
You can bypass the performance hit from switching them by rendering one set at a time.

The biggest problems I had was with transparent Sprites. IIRC I had to set it on the appearance level.
(I can recheck if needed)