Log in or register to post comments

Issues: Particles, GUI, and some crashes...

December 22, 2010 - 6:36am #1

Ahoy mates. First thing is I'm having a TON of fun with this spiffy plug-in. Lovin' it. Alas i am having a few issues:

- Particles: They seem to work just fine at times, but sometimes it seems like the particle textures will stretch huge across the screen, and the camera backgrounds stops clearing the frames. Kind of an "echo" of every frame. Very weird, and trippy.

- GUI: When i use GUI Textures, the camera feed stops coming thru and it defaults to a white background. Could this be a problem with Alpha Blended textures?

- Misc Crashes: Gotta love em, no log, no error, just nuthin. Happens about 30% of the time, just as you get the marker into the frame to start AR. Weird.

Any thoughts?
Yar.
CapnJ

Re: Issues: Particles, GUI, and some crashes...

January 10, 2011 - 10:34am #6

Very cool, thanks for this. I did change the OpenGL a lil while back to 2.0, lovin it!

Thanks again,
CapnJ

Re: Issues: Particles, GUI, and some crashes...

January 5, 2011 - 7:30am #5

Sorry for the extra-late reply on this, but I have some better fixes for the particle bug.

The bug doesn't seem to appear when using OpenGL ES 2.0, so a quick fix is changing your project settings. Go to Edit > Project Settings > Player, choose the Android tab, and the Other Settings section. Set the Graphics Level to OpenGL ES 2.0 instead of 1.x.

Here's a nice clean fix for the bug in OpenGL ES 1.x, if you prefer. We need to bind a simple material just before the call to updateTracker in TrackerScript.cs. Create a private material, initialize it using the "Diffuse" shader, and bind it just before this call:

private Material clearMaterial;

IEnumerator Start()
{
    clearMaterial = new Material(Shader.Find("Diffuse"));
    
    ...
}

void LateUpdate()
{
    if (!m_IsInitialized)
        return;
    
    clearMaterial.SetPass(0);
    
    // Update tracker
    int foundTrackable = updateTracker(m_TrackablePtr, m_NumAvailableTrackables);
    
    // Invalidate OpenGL state
    GL.InvalidateState();
    
    ...
}

This is a fix for any shader-related bugs, and will probably be included in the next release.

- Kim

Re: Issues: Particles, GUI, and some crashes...

December 22, 2010 - 5:48pm #4

Avast, thank you so much for your quick response!

Some info:
- Unity3D 3.1.0f3
- QCAR extension version: I want to say i just downloaded and applied an update just the other day, but i'll update again just to be sure.
- Android Device: Motorola Droid 2 (I about lost it when i found out my testing device was supported by the new SDK. I'll have to say you got iOS kicked in the nuts with this extension.)
- I tried to look thru the log while attempting to crash it. Wouldn't ya figure, no crashes. Soooo...Thanks for all the fish.
-I'll give the script a look, but probably go with the latter. Cannon balls don't really explode with fire, more or less splintering.

Thanks again for the help mate. And keep me updated on this whole particle bug.

Yar,
CapnJ

Re: Issues: Particles, GUI, and some crashes...

December 22, 2010 - 2:37pm #3

Okay, the particle system bug seems to be coming from the default particle shader. If this is the last shader bound before the native code renders the video background, some aspect of the OpenGL state is broken. A quick fix is to add a GL.InvalidateState() call before rendering the video in native. Add the following to the late update method in TrackerScript.cs (in Assets/Qualcomm Augmented Reality/Scripts):

void LateUpdate()
{
    if (!m_IsInitialized)
        return;
    
    // Add this to clear the OpenGL state before rendering the video
    GL.InvalidateState();
    
    // Update tracker
    int foundTrackable = updateTracker(m_TrackablePtr, m_NumAvailableTrackables);
    
    // Invalidate OpenGL state
    GL.InvalidateState();
    
    ...
}

This could effect performance, however. A better approach might be binding a simpler material (e.g. one with a Diffuse shader) just before the updateTracker call. You could try rendering a dummy object for instance. I will look into this approach tomorrow.

- Kim

Re: Issues: Particles, GUI, and some crashes...

December 22, 2010 - 12:05pm #2

Ahoy!

First off, which version of the QCAR extension are you using? Beta 2 just came out last week, and is available here:

https://ar.qualcomm.com/qdevnet/sdk

I'm definitely seeing an issue with particles on my end as well, thanks for the bug report. I'll look into this today, and if a quick fix is possible I'll let you know.

I just tried adding a GUI Texture, the default one with the Unity logo. It seems to work fine, and the video background is still in place. Are you changing any of the default settings for your GUI Texture?

The random crashes are a bit disturbing, that shouldn't be happening. Are they hard crashes, where you have to reboot the device? Try checking the device log, I'd be curious to see if you're getting a "cpu pegged" message. You can either launch the DDMS Android tool or type "adb logcat" on a command line to see the log.

Finally, what device / Android OS version are you using?

- Kim

Log in or register to post comments