Author Topic: transparency problem  (Read 6863 times)

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
transparency problem
« on: May 30, 2011, 02:18:46 pm »
Hi,

I'm getting a transparency issue where objects calling setTransparency() have a strange see-through effect (see current beta of Run! on the Android Market) against each other. This effect can be seen when a road path is under a tree top (both objects using transparency).
Am I using it wrong?

cheers

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: transparency problem
« Reply #1 on: May 30, 2011, 05:53:14 pm »
Most likely a sorting issue. Transparent objects need to be rendered in the correct order to be displayed correctly. This sorting is per object and it can't be correct in all cases. If, like in your case, some objects like the roads are always behind all other transparent objects, you can tweak this sorting by applying an offset. The method in Object3D is called setSortOffset or similar.

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: transparency problem
« Reply #2 on: May 30, 2011, 09:17:23 pm »
Ok, fiddling with setSortOffset() seems to do the trick (not completely sure because the issue wouldn't always show up, but the tests look alright). thanks!

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: transparency problem
« Reply #3 on: June 01, 2011, 11:53:58 pm »
turns out me playing with the setsortoffset didn't fix the transparency problem :S
the ground layer is added first to the world, then the trees... in any case, the issue shows up randomly...
any hints/details on how that method actually works (values I should set)?
in my last attempt, I set -2000 (negative values getting closer to the camera) for the trees and 0 for the ground layer
I'm ready for a new release with a few nice details and fixes, but would like to include this... and, while I thought of having opaque leaves, I would still have the same problem with future features.
on a side note, I'm using png's with alpha channel...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: transparency problem
« Reply #4 on: June 01, 2011, 11:55:20 pm »
Try to leave the trees alone and offset the ground only by 100.000 or something.

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: transparency problem
« Reply #5 on: June 02, 2011, 02:12:42 am »
done, haven't seen the issue again so far so... new release out!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: transparency problem
« Reply #6 on: June 02, 2011, 10:49:29 am »
This version somehow hangs after dying....the only way to exit it, is to kill it.

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: transparency problem
« Reply #7 on: June 06, 2011, 11:55:22 pm »
I wasn't dealing very well with the screen capture process... should be better now (new release published)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: transparency problem
« Reply #8 on: June 07, 2011, 01:07:38 pm »
Works fine now. What this game really needs is a mini-map IMHO. I usually have no Client where i am and where i'm supposed to go....

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: transparency problem
« Reply #9 on: June 07, 2011, 02:46:17 pm »
I thought of it at an early stage of development (adding an arrow for direction) but ditched the idea because this way, having to search around and finding the spot while avoiding the monsters is part of the challenge... it would be too straightforward and easy otherwise. Does this 'lost' factor make it dull, tedious or boring?
if it is, I might think of something less obvious and for the easier difficulty levels...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: transparency problem
« Reply #10 on: June 07, 2011, 03:54:11 pm »
It makes me feel "lost". I've no idea if i'm on the right track or not because there's no feedback and finally, i get caught by the zombies while stumbling around. The main character says stuff like "she's in the cottage" or "maybe in the car" or something like that...so i expect him to have at least a vague idea where these places are. The game should reflect this somehow....

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: transparency problem
« Reply #11 on: June 08, 2011, 12:17:28 am »
ok, I have made a quick release including directions (N, SE, W, etc.), a bit vague but should be a good balance between lost and too easy search...
and I think I am done with the main development. Unless there are bugs reported or other suggestions I will now focus on adding levels for a full release!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: transparency problem
« Reply #12 on: June 08, 2011, 12:36:53 am »
Yes, that's better. I was able to complete the first level...but then, i got this:

Code: [Select]
06-08 00:35:37.808: ERROR/AndroidRuntime(21203): java.lang.NullPointerException
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.loxai.run.RunActivity.onTouch(RunActivity.java:416)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.View.dispatchTouchEvent(View.java:3881)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2194)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.os.Looper.loop(Looper.java:130)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.app.ActivityThread.main(ActivityThread.java:3683)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at java.lang.reflect.Method.invokeNative(Native Method)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at java.lang.reflect.Method.invoke(Method.java:507)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at dalvik.system.NativeStart.main(Native Method)


Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: transparency problem
« Reply #13 on: June 08, 2011, 01:43:32 am »
thanks for the stack trace, should be fixed for next release (I don't want to update just for one bug, should get a few more ;)). In the meantime, it should work as long as you don't touch the screen between level success and next level loading (that's the only way I got it).