happy-turtle / oit-unity

Order-independent Transparency Implementation in Unity with Per-Pixel Linked Lists
Apache License 2.0
181 stars 25 forks source link

some thing about screen adaption #13

Closed SnowWindSaveYou closed 9 months ago

SnowWindSaveYou commented 1 year ago

the current version is problemic when user change screen size, i think there is better to add the screen adaption functions, it is useful...

and also since i'm doing VR project, i think to add a VR mode also meanningful for some people... just add a checkbox to make buffer size times 8 (https://github.com/happy-turtle/oit-unity/issues/6)

happy-turtle commented 1 year ago

the current version is problemic when user change screen size, i think there is better to add the screen adaption functions, it is useful...

I agree, that would be useful. While working on #14 I often encounter crashes. Probably because the buffer size is not correct anymore. How would we detect such errors? Just in Update?

void Update() {
  if (bufferSize != screenSize)
  {
     // Recreate buffers
  }
}

and also since i'm doing VR project, i think to add a VR mode also meanningful for some people... just add a checkbox to make buffer size times 8 (https://github.com/happy-turtle/oit-unity/issues/6)

We can definitely add this. So you are just doing Screen.width * Screen.height * MAX_SORTED_PIXELS * 8 then? Unfortunately I don't have a VR device to test this. Still not sure why you have to multipy by 8. Does multiplication by 2 work?

SnowWindSaveYou commented 1 year ago

the current version is problemic when user change screen size, i think there is better to add the screen adaption functions, it is useful...

I agree, that would be useful. While working on I often encounter crashes. Probably because the buffer size is not correct anymore. How would we detect such errors? Just in Update?

void Update() {
  if (bufferSize != screenSize)
  {
     // Recreate buffers
  }
}

and also since i'm doing VR project, i think to add a VR mode also meanningful for some people... just add a checkbox to make buffer size times 8 (#6)

We can definitely add this. So you are just doing Screen.width * Screen.height * MAX_SORTED_PIXELS * 8 then? Unfortunately I don't have a VR device to test this. Still not sure why you have to multipy by 8. Does multiplication by 2 work?

i tried to check screen width and screen seperately and that works fine..

    private void OnGUI()
    {
        if (lastHeight != Screen.height || lastWidth != Screen.width)
        {
            orderIndependentTransparency.Reset();
            lastHeight = Screen.height;
            lastWidth = Screen.width;
            Debug.Log("Reset Screen");
        }
    }

about VR setting, i'm also no idea about this, i was just tried out this value after i realized the problem on VR just the buffer size fout ... maybe add it after i figure out what's reason for it

happy-turtle commented 1 year ago

I will try the screen adaptation! If it helps I will implement it. Maybe on #14

happy-turtle commented 1 year ago

Implemented screen adaptation in #14. Hopefully I can soon merge this.

happy-turtle commented 1 year ago

Merged #14, a simple check if the buffer size is still valid is now implemented