Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - robert

Pages: 1 [2] 3
Support / Re: Deform the shape
« on: October 21, 2012, 02:07:18 pm »
Hi, i'm newbie in jpct.
Is it possible to deform the shape of touched object?
What can I use to achieve this? I was looking for the solution, and I found the bones, but I'm not sure if it is necessary to this task.
I used hello world from wiki to display the object.

In Blender you can create the so called "shape keys". Then you can export as Ogre and load the shape keys with Bones.

Support / Re: Fake volumetric lights
« on: October 20, 2012, 01:28:00 pm »
It's simple additive blending...yes, you can do this.

Egon, with additive blending you use a black texture with no alpha, right ? Is there any reason I can't do this with alpha blending ? Note that I don't know much about OpenGL so sorry if this question sounds obvious.

Also, what is the correct way of altering the opacity of the texture every frame ?

Thank you!

Support / Re: Fake volumetric lights
« on: October 14, 2012, 01:25:03 pm »
No probs. If you want a glow effect as well you could experiment with a simple transparent plane centered near the front-center of the pumpkin with a 32bit (RGBA) texture that fades out from the middle. Beyond that you would need to use shaders, i.e. if you wanted a fancy glow extruding out of the pumpkin.

Hey K24A3, better than using a plane, I think I'm going to use 2 textures, the base one and one for the glow. Then I'll turn up and down the opacity of the glow texture. I got the idea from here:

What do you think ?

Support / Re: Fake volumetric lights
« on: October 11, 2012, 02:48:30 pm »
I must agree it was a battle learning even the basics of Blender.

jPCT doesn't support dual sided polygon textures (which is good in a way, keeps things simple) so you will need to solidify the object as mentioned. Rather than copy the outer texture co-ordinates to the inner faces, you would want to simply apply white to the inside to mimic the light volume. You do this by selecting all the inner faces and either apply a white material from the materials menu on the right, or hop into texture mode, load up your texture, select a portion of the texture that contains white, then wrap that portion to the polygons you have selected. It's not easy to do so I wont go into it in detail, but there are plenty of video guides on youtube that will get you started.

Thank you.

Support / Re: Fake volumetric lights
« on: October 11, 2012, 02:12:04 pm »
You wont need two pumpkins, 3D modelling programs like blender allow you to select all the vertices and extend them inwards, effectively creating a complete 3D object with both inner and outer walls. Once that is done, apply a white part of the texture to the inner faces.

OpenGL hardware typically have 8 hardware lights you can use. Refer to the "Light" class in jPCT, set it's position to the center of the pumpkin to light it up.

I have been using Blender for years occassionally, but I'm far from being an expert :) How do you apply a texture to both sides of a mesh using the UV editor ? When you unwrap a mesh it is unwrapped on one side only  ???

Support / Re: Fake volumetric lights
« on: October 11, 2012, 12:24:53 pm »
You could cheat and change the texture of the inside of that pumpkin, make the inside colors pure white so it appears lit up.

Additionally, you could separate the inside and outside of the 3D pumpkin object and setAdditionalLighting(200,200,200) to the inner Object3D. Or perhaps pop a small hardware Light in the center.

I will try your first method, but I'm afraid I'll need two pumpkins because as far as I know, a texture can't be mapped to both sides of a mesh. The downside of this method is that I won't get a "glow" effect.

About the second method... what do you mean a hardware Light ? a light done with fragment shaders ?

Support / Re: Fake volumetric lights
« on: October 11, 2012, 12:22:47 pm »
Something like a...missing image...?

I don't know what happened, the image was shown the first time I put it. Anyway, what I want to achieve is the lighting of the inside of a halloween pumpkin.

Support / Re: Fake volumetric lights
« on: October 11, 2012, 10:53:33 am »
Something more like

The lights on the car look more flat, I would like to use a conse instead of a plane, as explained here:

But to be honest, I don't even know if that is what I'm really looking for.... I want to achieve something like this:

Support / Fake volumetric lights
« on: October 11, 2012, 01:20:46 am »
Is this doable in JPCT-AE ?

Support / Re: Memory usage growing
« on: October 04, 2012, 12:31:35 pm »
If the memory finally gets freed by the garbage collector, i don't see the actual issue. It's up to VM how to manage the memory and as long as it isn't a real leak (which it doesn't seem to bo or otherwise, the memory won't be freed again), i don't see a problem with that behaviour. You might want to try to call MemoryHelper.compact() in onSurfaceChanged...maybe that helps.
Regarding dispose() are meant to call it, if a reference goes out of scope. If it never does, there's no need to call it. Personally, i would simply keep my World and Skybox and don't create new ones all the time, but that's up to you.

Hi Egon,

After some more testing, it seems the PreferenceActivity text corruption does not only affect my wallpaper. I've tried other wallpapers and if you change the orientation a few times, some text in the PreferenceActivity will be missing.

Regarding the memory usage, it seems you are right, there are no leaks. The issue with the preferences confused me...

Thank you for your support.

Support / Re: Memory usage growing
« on: October 03, 2012, 01:33:37 am »
Try to load the textures via an InputStream (for example: res.openRawResource(R.raw.texture)) instead and see if that helps.

What's the relation between memory usage and the text on the Activity?

Unfotunately, it makes no difference if I load the textures via an Inputstream :(

Here ( you have a short video (01:30) that shows the increase in memory usage. Everytime you see the data changes is because I've rotated the phone... Also, you can see that in the end, when the memory usage reaches 27MB it goes back down to 17/18MB...

I don't know what the relation is between the missing text in PreferenceActivity and the memory usage, maybe it has nothing to do, but the text corruption always happens after a few orientation changes, never at the beginning...

Also, I would like to know if it is really necessary to call dispose() on the World and SkyBox objects (I know you call it on the Framebuffer).

Thank you!

Support / Re: Memory usage growing
« on: October 03, 2012, 12:07:08 am »
How are you loading your textures? If you load them as Bitmap or Drawable, Android will cache them. Does this increasing memory consumption reaches a limit or does it increase until you get an OutOfMemoryError?

You might want to profile you app (if it's actually possible to profile a wallpaper properly with the means that Eclipse and the Android plugin provide...) to see where the memory goes. Personally, i'm not aware of any existing memory leaks in the engine.

Hi Egon,

I'm loading the textures like this:

Code: [Select]
TextureManager tm = TextureManager.getInstance();
String name = "light_" + mLightTex;
int id = res.getIdentifier(name, "drawable", mContext.getPackageName());
if (tm.containsTexture("light")) {
tm.unloadTexture(mFrameBuffer, tm.getTexture("light"));
tm.replaceTexture("light", new Texture(res.getDrawable(id), true));
} else {
tm.addTexture("light", new Texture(res.getDrawable(id), true));

And this is what I do to release resources onSurfaceDestroyed():

Code: [Select]
if (mFrameBuffer != null) {
    mFrameBuffer = null;
if (mSkyBox != null) {
  mSkyBox = null;
if (mWorld != null) {
    mWorld = null;

It seems the memory consumption keeps increasing, but does not make the program crash. The problem is that the text on the PreferenceActivity of my Wallpaper gets corrupted after a while.

Support / Memory usage growing
« on: October 02, 2012, 06:59:28 pm »
Hi there,

In my wallpaper, the user can choose what mesh (Object3D loaded from .obj)  to use in the preferences, and what skybox textures to use for the background. I'm changing both things in onSurfaceChanged() and it seems the memory usage grows up every time the wallpaper is restarted (with an orientation change for example).

I'm calling the dispose() method of the Framebuffer, World, and SkyBox (don't know if other classes also have this method) classes when the surface is destroyed. Also, when I replaceTexture() I previously call unloadTexture(), but all theses things don't keep the memory usage from growing. I've even tried to call the flush() method of the TextureManager class when the surface is destroyed, but again, the memory usage keeps growing. Forcing the garbage collector to run doesn't free up any memory, so I think the memory is referenced somewhere, but not in my code, because I null all the references onSurfaceDestroyed()....

What else should I do ?

Thank you!

Feedback / Re: Learn 3D Concepts! Tutorials!
« on: October 02, 2012, 06:34:10 pm »
The link is dead: "410 - Website No Longer Exists"

Support / Re: Screen orientation and camera
« on: September 28, 2012, 12:29:26 am »
That's actually the exact same thing that jPCT-AE does except that jPCT-AE assumes that fov means the field of view in x-direction while this code assumes that fov defines the field of view in y-direction. Personally, i find this highly unintuitive, because nobody defines his field of view in up/down-direction. Anyway, you can get behaviour by setting the fov values for x and y explicitly. To do this, you can do something like:

Code: [Select]
Camera cam = world.getCamera();
float fov=1.25f;
if (w > h) {
cam.setYFOV(fov * ((float)h / (float)w));
} else {
cam.setFOV(fov * ((float)w / (float)h));

Hope this helps.

Thank you very much Egon ! :)

Pages: 1 [2] 3