Author Topic: Fogging problems  (Read 6934 times)

Offline Zyphuris55

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Fogging problems
« Reply #15 on: June 15, 2012, 09:11:54 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Fogging problems
« Reply #16 on: June 15, 2012, 09:29:43 am »
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.

Offline Zyphuris55

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Fogging problems
« Reply #17 on: June 15, 2012, 09:35:58 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Fogging problems
« Reply #18 on: June 15, 2012, 09:38:01 am »
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.

Offline Zyphuris55

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Fogging problems
« Reply #19 on: June 15, 2012, 09:43:30 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Fogging problems
« Reply #20 on: June 15, 2012, 09:53:25 am »
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!?

Offline Zyphuris55

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Fogging problems
« Reply #21 on: June 15, 2012, 10:41:51 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Fogging problems
« Reply #22 on: June 15, 2012, 10:56:35 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Fogging problems
« Reply #23 on: June 15, 2012, 02:23:25 pm »
... 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Fogging problems
« Reply #24 on: June 15, 2012, 06:04:13 pm »
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.

Offline Zyphuris55

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Fogging problems
« Reply #25 on: June 15, 2012, 07:23:13 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Fogging problems
« Reply #26 on: June 15, 2012, 08:01:32 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.

Offline Zyphuris55

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Fogging problems
« Reply #27 on: June 16, 2012, 03:08:24 am »
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.
« Last Edit: June 16, 2012, 03:19:51 am by Zyphuris55 »