Fogging problems

Started by Zyphuris55, June 12, 2012, 08:10:54 AM

Previous topic - Next topic

Zyphuris55

I was just able to try the new jar...and it worked-ish. The fogging problem is fixed, but now there is graphical issues.
When moving left/right (which only effects the camera), the objects would flicker/ spin around as if the rotation is being forgotten. The camera would be on the opposite side of the object, or very far away, or drawing the object very close.

I have a class which interfaces the camera class. It has a cameraLook (Object3D), cameraPlace (Object3D) and a root (Object3D, the previous 2 are childs of this). After the look/ place are put in place (using the TranslateMesh), the game interacts with the camera movement by using the parent node only....the rotation and distance between the place/look are never changed thereafter.

I'm going to be revering back to the previous jar, the 1.25 version. It's easier to have a lighting problem than the objects flying around wildly when trying to move around.

EgonOlsen

That's strange. The change that i did shouldn't have this consequence. Please try the new jar without your renderScene()-on-demand logic, i.e. always do a renderScene()/draw() in all cases and see if that helps.

Zyphuris55

No good either. I added the jar, cleaned the project, remove the limit so renderscene is on every frame, (enabled the fps counter), then tested the game. And it still has the visual glitches.

EgonOlsen

Ok...then i have screwed up something with other changes that i did. How can reproduce this? Is it possible by using the version that you sent to me? How do i move then? I only managed to spin these wheels around.

Zyphuris55

I haven't changed anything drastic since the version I sent you, so that copy should still work. The problem is visual in both the menu and gameplay. Drag left/right slowly and you'll be able to see the glitching better, but it works at any movement speed.

To go into the gameplay, have "Campaign" selected and hit "go". I'm working on the lag between menu/gameplay.

EgonOlsen

With the version on my phone (can't access the sources ATM), i can see some missing or shifted objects when moving left/right. Is that what you mean? Maybe you can make a screen shot of the glitch. I don't see anything like objects being rendered very large or something like that!?

Zyphuris55

I'm sending you an email with a zip of 4 pictures (it would make this post too long if I tinypic'd them and they are too big to upload as an attachment through here).
The pictures were taken within the movement of 50-100 pixels (camera x translation of 1 - 2f) , or within one movement action. The game would flicker between types of these instances throughout the movement.

EgonOlsen

Thanks. I think i've found a problem in a change that i did lately to save some memory. I'll try to fix this when i get back home.

EgonOlsen

... are you by any chance fiddling around with the camera or objects' positions in any thread other than the rendering thread? If you do so, don't do this, because jPCT and jPCT-AE aren't thread safe: http://www.jpct.net/wiki/index.php/Multithreading#Thread_safety

EgonOlsen

I've updated the jar with a version that should fix the problems that my last change introduced while still maintaining the benefits: http://jpct.de/download/beta/jpct_ae.jar

However, even when using the 1.25 jar, i'm getting the same render glitches with objects being moved while others are not and parts get clipped that should actually be visible. I haven't checked the game's code, but i really think that this is caused by fiddling around with the camera in parallel to the rendering thread, i.e. you are executing touch events directly when they happen without taking care of the rendering, which should at least be synchronized to this...or, the better solution IMHO, collect all events or their consequences and execute them in the rendering thread. This will also make the touch event handling more responsive.

Zyphuris55

Yes, the touch events are taken care of as soon as they happen...I thought this was normal.
I created the class which controls all of what should happen for that screen (render, movements, actions, etc.), then fed that class to the renderer, then sent the renderer and previous class to the touch surface.
In the touch surface, I have the actions directly interfacing with the screen class, as opposed to the "queueEvent(new Runnable()....".

I'll try working on it now so the events are in the render thread, maybe by using a queue and run all the events before rendering/ drawing of the objects is done.


....I'm confused of how you're getting the same rendering glitches in the 1.25. The only model glitches I see in that version is there there is sometimes cracks between 2 objects, which are subtitley noticeable.

EgonOlsen

Quote from: Zyphuris55 on June 15, 2012, 07:23:13 PM
....I'm confused of how you're getting the same rendering glitches in the 1.25. The only model glitches I see in that version is there there is sometimes cracks between 2 objects, which are subtitley noticeable.
I never experienced these kind of glitches that you got, not even with the faulty 1.26 version. But i do get these cracks and some missing objects quite often. This might depend on the speed of the device and if the cpu has one core or multiple. An easy way to do camera stuff in the render thread would be to use another camera in the touch event handling and synchronize on that instance in both threads. Then simply copy the data from that camera to the world's camera and you are done.

Zyphuris55

#27
I just finished the touch upgrade, so the actions take effect in the render thread only. Tested it with the 1.25, and there isn't any minor object disconnect like I saw previously. So I tried the beta you linked a few posts ago, and the game didn't have any glitches or fogging problem.

..so, it works :-). Thank you for your patience and help.


Edit: I re-enabled the line to render the scene only when needed (moving the objects and on the first frame), and the game still works. I get about 28 fps idle and 18 when moving around.