www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Tale on April 26, 2010, 03:39:46 am

Title: 3D Image Display
Post by: Tale on April 26, 2010, 03:39:46 am
Is there a way to use JPCT to display a 2D image in 3D space?

My thought is to draw 2D images on a z-axis (or technically the y-axis in 3D), to give a 3D perspective but to stick to using 2D graphics.  I have just started experimenting with this using the Primitive planes, but applying a texture is causing too much aliasing (right term?).  Can I somehow keep off the Textures and just have the plane draw an image or can I reduce the amount of distortion caused when applying a texture?  I want to stick with the computer's basic software renderer as I want the finished product to be very out-of-the-box to use and low memory requirements.  (Unless I am wrong on both accounts being best done with the default renderer)

Thanks for any help you can give!
Tale
Title: Re: 3D Image Display
Post by: EgonOlsen on April 26, 2010, 07:41:03 am
What kind of distortions do you mean exactly? Do you have a screen shot to illustrate the issue?
Title: Re: 3D Image Display
Post by: Tale on April 26, 2010, 04:43:15 pm
I have a screenshot, but since I was unsure as to how to upload it here, I emailed it to you.  The picture drawn with Graphics2D in the upper-left, the JPCT plane with the texture is in the lower-right.  I may be being picky, but I need to get the picture to at least 800x640 (which means much more distortion than what is shown at the current size pictured).  Is there a way to upload the image at a size larger than 256x256 and draw it at that larger size without distortion?

Thanks,
Tale
Title: Re: 3D Image Display
Post by: EgonOlsen on April 26, 2010, 07:57:18 pm
I got the screen shot, but it's really hard to tell anything from it, because jpg compression destroyed most of the details. Anyway, you can of course use resolutions for the texture image larger than 256*256. You just have to make sure that width and height are a power of 2 or otherwise, it will be scaled down to 256*256. You can use Java2D's image scaling to rescale your image accordingly. Try 512*512 or even 1024*1024 (might be a bit too much) to see if that helps. In addition, and if performance permits it, you can use oversampling to get better image quality. You can set this when creating the FrameBuffer. If your target hardware has multiple cores, you can enable multi threading for the software renderer in Config (Config.useMultipleThreads=true) to compensate for the performance loss of oversampling.