hecomi / uDesktopDuplication

Desktop Duplication API implementation for Unity (only for Windows 8/10)
http://tips.hecomi.com/entry/2016/12/04/125641
MIT License
563 stars 97 forks source link

Issue with generating MIP levels Gray Screen. #47

Closed BlueSkyDefender closed 3 years ago

BlueSkyDefender commented 3 years ago

https://github.com/hecomi/uDesktopDuplication/blob/ab8671fb84c387984655fd2422741912a56aebf2/Assets/uDesktopDuplication/Scripts/Monitor.cs#L338

Hello My Name is Jose Negrete, and I am writing you About an issue I have with this line and if you can help me solve it.

I changed the last bool value to true and I get a gray screen. Is there anyway to generate MIPs Map Levels from this texture?

The reason I am asking is because. I would like a low res output from the main screen so I can use the mips to create a blur effect for ambiance. Like this background. vorp3de_ambience

Things to note I made some changes here. https://github.com/hecomi/uDesktopDuplication/blob/master/Assets/uDesktopDuplication/Shaders/uDD_Params.cginc#L4

On line 4 I removed this and replaced it with.

Texture2D _MainTex; SamplerState my_point_clamp_sampler; SamplerState sampler_MainTex;

So that I have access to a Point Texture.

and in uDD_Common I changed the textures here with.

This works: One for Point _MainTex.Sample(my_point_clamp_sampler, uddRotateUV(uv)); One for an normal output. _MainTex.Sample(sampler_MainTex, uddRotateUV(uv));

This Don't work: I also wanted to add. But, as I said above I get a Gray screen it also seems to only update where the mouse moves. _MainTex.SampleLevel(sampler_MainTex, uddRotateUV(uv), MIP_Level );

Any help on this will be appreciated.. Thank you for your super cool package.

I also tried to do this trick to Generate Mips. Where you generate mip levels in unity from a texture with 0 mip levels. But, I failed because I don't know what I am doing. https://answers.unity.com/questions/10292/how-do-i-generate-mipmaps-at-runtime.html

One Last thing if this is not possible. Since due to my limited experience with this. Is it possible to produce a single lower res texture without mips? This would work too. If so I would like some help with this if you can. Since I have a hard time understanding how to do this.

PS: I can send you my unity app if you want to see what I did.