- Home /
Problem with Image Effect shader for Virtual Reality
Hey guys,
Been trying to implement hologram effect into my VR game. My solution is pretty straightforward: camera that mimics movement of players camera captures stuff into Render Texture -> Render texture is passed to Image Effect shader -> Image effect writes on top of Main Texture (player's view).
For render texture resolution I'm using 1080x1200 (resolution for one eye for HTC Vive).
Here's the result (GIF): http://imgur.com/a/2jGwq
The grayscale overlay (Image Effect) is displaced for both the right and left eyes. Here's an example from frame debugger (I photoshoped images together, I'm using multi-pass rendering stereo rendering, so the images are being rendered one after another, not in a single pass):
Here's a basic fragment method I'm using:
fixed4 frag (v2f i, UNITY_VPOS_TYPE screenPos : VPOS) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
float4 holoCol = tex2D(_HoloTex, i.uv);
float brightness = (0.2126*holoCol.r + 0.7152*holoCol.g + 0.0722*holoCol.b);
return lerp(col, float4(brightness, brightness, brightness, 1), 0.5);
}
Any help is highly appreciated! Cheers!
Your answer
Follow this Question
Related Questions
Can a shader add transparency to scene borders? (VR UI) 0 Answers
Is it possible to create a scrolling texture as an image effect (shader)? 2 Answers
Modifying the depth buffer of an image effect? 0 Answers
URP Blit Render Feature not rendering in Single Pass Instanced VR 0 Answers
Edge Detection script [Legacy Image Effect] - NOT working on mobile (iOS, Android) 0 Answers