jPCT-AE - a 3d engine for Android > Support

Help with setting image as background and 3d object on top

(1/3) > >>

idanh:
Hey,

I've just started with 3d but have some knowledge in Java.
My problem which I'm trying to solve (and hopefully you could help me) is:

1. Getting a picture from the library (this step is done, but) putting it as a background image - The problem here is that i'm trying to use the picture as texture - but this requires me to make it power of 2. Is it possible to just use the image as background?

2. Loading a 3d object (this step is done) and moving it around. Here, I can load the object but I dont get why I cant see it. when the origin is 0,0,0. Also, I need to rotate it by PI to rotate to the front. Is this a problem with the camera or the object it self? And also - Why is 0,0,0 or 0,50,0 does not seems to display anything? (my frame buffer is created in onSurfaceChanged(GL10 gl, int w, int h) and using w,h as params)

Hopefully you could see what i'm thinking/doing wrong here and give me some tips.
I've got some code done, but I cant overcome those problems.


Thank you!

EgonOlsen:
The beta version has a class to create NPOT textures: http://jpct.de/download/beta/jpct_ae.jar However, these have some limitations (which shouldn't matter when using them as backdrop only) and are not supported on all devices (however, current devices shouldn't have any problems with them). If you don't want to go that way, you have to scale your image to or embed it into a texture that is a power of 2 in width and height.

I'm not sure if i get the question about the object...if the object is at the origin and you are at the origin, you are inside the object. By default, back faces will be culled, so depending on the object, you might nothing or just some lonely polygons.

idanh:
EgonOlsen, Thanks for the reply!

About NPOT - Could you please point me on how to use NPOT textures feature? I think that's what I was looking for!

About the object - Thanks for the help. I think I got it. One thing I did not fully understand is why when I load the .obj it loads it where it is upside-down. Meaning - I need to rotate it by PI (180 degrees) to see the face of my object. Is this normal? Or i'm doing something wrong?

The point of the application is to put a 3d object onto a photo - then render it to a picture (which I have no idea how to do currently, as I need to render it to the raw image and should not crop it - or not crop it that much) so I'd love for an advice if possible.

Again, thank you for providing this useful information which I will use
Idan

KittenKoder:

--- Quote from: idanh on November 26, 2012, 02:45:31 pm ---EgonOlsen, Thanks for the reply!

About NPOT - Could you please point me on how to use NPOT textures feature? I think that's what I was looking for!

About the object - Thanks for the help. I think I got it. One thing I did not fully understand is why when I load the .obj it loads it where it is upside-down. Meaning - I need to rotate it by PI (180 degrees) to see the face of my object. Is this normal? Or i'm doing something wrong?

The point of the application is to put a 3d object onto a photo - then render it to a picture (which I have no idea how to do currently, as I need to render it to the raw image and should not crop it - or not crop it that much) so I'd love for an advice if possible.

Again, thank you for providing this useful information which I will use
Idan

--- End quote ---

The upside down object is likely because the modeling program you used has a different coordination system. I know Blender is a -Y up for exports to make them load-ready. You aren't doing anything wrong, it's just a nuance between different systems. You could flip the camera to, 180 on the z axis, to accommodate it.

EgonOlsen:
...or simply do something like


--- Code: ---obj.rotateX(...);
obj.rotateMesh();
obj.clearRotation();

--- End code ---

after loading the object. About NPOT textures, they are meant to be used as render targets. I.e. you create a npot texture with the size of the framebuffer, set it as render target, render you scene into it once, remove the render target again and use the resulting texture as blit source to fill the background. You might have to use a negative height when blitting to compensate for the fact that the resulting image in the texture will be upside-down.

Navigation

[0] Message Index

[#] Next page

Go to full version