Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Max-Bot · Jan 03, 2018 at 11:45 AM · webglvideotransparencyurlvideo streaming

Video Player WebGl Transparency problem - previous frames doesn't clear

I'm playing .webm video file with URL.

Video File: https://dynamicgamesdeveloper.github.io/Video/Bear.webm

Demo: https://dynamicgamesdeveloper.github.io/index.html

Tested Browser: Google Chrome

It should look: alt text

But looks like: alt text

First I tried to use other shader and even not transparent. Effect is the same, so I've decided problem is related to texture.

I've tried to clear renderTexture where it's going from VideoPlayer:

 void OnPreRender() //Or OnPostRender()
     {
         RenderTexture current = RenderTexture.active;
         RenderTexture.active = myRenderTexture;
         GL.Clear(true, true, Color.blue);
         RenderTexture.active = current;
     }

The same. It looks like it's encapsulated in Video Player. What to do?

bear1.png (12.1 kB)
bear2.png (42.0 kB)
Comment
Add comment · Show 11
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Radiys · Jan 03, 2018 at 03:47 PM 0
Share

please, attach source .webm file

avatar image Max-Bot Radiys · Jan 04, 2018 at 03:14 PM 0
Share

Hi Radiys Thanks for the reply. Here you go: https://dynamicgamesdeveloper.github.io/Video/Bear.webm And here the Demo: https://dynamicgamesdeveloper.github.io/index.html Tested Browser: Google Chrome

avatar image themolecule-unity · Apr 02, 2018 at 05:16 PM 0
Share

I'm seeing this same problem with webGL and alpha'd video did you ever find a solution?

avatar image Max-Bot themolecule-unity · Apr 05, 2018 at 11:23 AM 0
Share

No, you have to report it's to Unity. $$anonymous$$aybe they fix it in next releases.

avatar image coco830514 · Jun 05, 2018 at 10:04 AM 0
Share

Is your Camera Clear Flags Depth Only?

avatar image Max-Bot coco830514 · Jun 05, 2018 at 10:14 AM 0
Share

No. It is Skybox on first scene and Solid Color on second one.

avatar image coco830514 coco830514 · Jun 07, 2018 at 07:22 AM 0
Share

It works when I use just VideoClip on Android $$anonymous$$ode.

Is it just have this problem on WebGL?

Another way is use $$anonymous$$P4, with no alpha like this with shader on your RawImage.

$$anonymous$$p4 : alt text

Shader:

 Shader "Unlit/VideoAlpha"
 {
     Properties
     {
         _$$anonymous$$ainTex ("Texture", 2D) = "white" {}
     }
     SubShader
     {
         Tags { "Queue" = "Transparent" }
         LOD 100
         zwrite off
         blend srcalpha one$$anonymous$$ussrcalpha
 
         Pass
         {
             CGPROGRA$$anonymous$$
             #pragma vertex vert
             #pragma fragment frag
             // make fog work
             #pragma multi_compile_fog
             
             #include "UnityCG.cginc"
 
             struct appdata
             {
                 float4 vertex : POSITION;
                 float2 uv : TEXCOORD0;
             };
 
             struct v2f
             {
                 float2 uv : TEXCOORD0;
                 UNITY_FOG_COORDS(1)
                 float4 vertex : SV_POSITION;
             };
 
             sampler2D _$$anonymous$$ainTex;
             float4 _$$anonymous$$ainTex_ST;
             
             v2f vert (appdata v)
             {
                 v2f o;
                 o.vertex = UnityObjectToClipPos(v.vertex);
                 o.uv = TRANSFOR$$anonymous$$_TEX(v.uv, _$$anonymous$$ainTex);
                 UNITY_TRANSFER_FOG(o,o.vertex);
                 return o;
             }
             
             fixed4 frag (v2f i) : SV_Target
             {
                 // sample the texture
                 fixed4 col = tex2D(_$$anonymous$$ainTex, i.uv);
                 //fixed4 col = tex2D(_$$anonymous$$ainTex, half2(i.uv.x*0.5 , i.uv.y));
                 //fixed4 mask = tex2D(_$$anonymous$$ainTex, half2(0.5 + i.uv.x*0.5 , i.uv.y));
                 // apply fog
 
                 return  float4( col.rgb , 1 - step( col.r , 0));
             }
             ENDCG
         }
     }
 }


And it will looks like this:

alt text

qqqq.png (22.7 kB)
avatar image Max-Bot coco830514 · Jun 07, 2018 at 08:45 AM 0
Share

Thanks for the comment. It seems like Unity bug on Web GL. On Android Video Alpha works fine. You shader is cutout and drops black pixels, so it wont't work if background is some color ins$$anonymous$$d of black either with semi-transparency. It would be cool if Unity Video Transparency work on Web GL.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by OPfeifferBweez · Jan 29, 2019 at 10:38 AM

Same problem here. .webm with alpha channel in WebGL builds seem to give weird results. I noticed that in Firefox it plays correctly, when in Chrome the artifact you shown appear. Also on both navigators the video is way more pale/contrastless than the original. I found no concrete solution online, any help from the Unity dev would be greatly appreciated !

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image OPfeifferBweez · Jan 29, 2019 at 11:19 AM 0
Share

The best alternative that I found so far is to use chroma key (the shader they share in this thread is free and works like a charm) : https://forum.unity.com/threads/chroma-key-in-unity-5.359119/

About the washed out effect on the video, this is a known issue and is due to the linear color space : https://issuetracker.unity3d.com/issues/video-the-videoplayer-component-doesnt-color-correct-under-linear-color-space

Hope it will help a bit..

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

81 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Video don't play unity WebGL on URL 1 Answer

The byte stream type of the given URL is unsupported? 1 Answer

Unity WebGL video player on mobile 0 Answers

Videoplayer Component in WebGL with OAuth2 url. 0 Answers

WebGL play video using VideoPlayer and StreamingAssets 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges