Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Projector problems, texture always fits to size what it projects on?

Discussion in 'Editor & General Support' started by invulse, Dec 3, 2010.

  1. invulse

    invulse

    Joined:
    Nov 29, 2010
    Posts:
    128
    So I am just trying to set up a simple selection graphic below a unit which is as green glowing ring. However when the projector touches the plane that it should be projecting on to, it always without fail stretches to fit the object its projecting on to. I did the 3dplatformer tutorial and even attempted to use the blob shadow projector from it, but I get the same result.

    Here is a screenshot : $Screen shot 2010-12-03 at 9.40.28 AM.png

    As you can see the green ring stretches to fit the plane even though you can see the projectors field of view should have it projecting to only a small square below the character. Also moving the projector or even rotating it has no effect, if any part of the projection touches the object it should be projecting on to I get this result. I have tested this on multiple meshes and unfortunately get the same result each time so I must be missing an important step in this process. Any ideas?:confused:
     
  2. invulse

    invulse

    Joined:
    Nov 29, 2010
    Posts:
    128
    Ok so I figured out that using normal shaders apparently does not work with projectors as you would expect they would. (This really should be documented somewhere as its not easily apparent). I found the source for a transparent texture shader on google then combined what I needed from the blob shadow shader in the test project and it works:

    Code (csharp):
    1. Shader "Transparent Texture" {
    2.    
    3. Properties {
    4.     _MainTex ("Texture (A = Transparency)", 2D) = "" {
    5.         TexGen ObjectLinear
    6.     }
    7. }
    8.  
    9. SubShader {
    10.     Tags {Queue = Transparent}
    11.     ZWrite Off
    12.     Blend SrcAlpha OneMinusSrcAlpha
    13.     Pass {
    14.         SetTexture[_MainTex] {
    15.             Matrix [_Projector]
    16.         }
    17.        
    18.     }
    19. }
    20.  
    21. }
    I know nothing about shaders at the moment so I really have no idea why this is required to make the projector function as expected :(
     
  3. TomPo

    TomPo

    Joined:
    Nov 30, 2013
    Posts:
    86
    Yeah, that's true.
    I have no idea why Projector has all these settings if they don't work.
    The size of the projected texture is just a size of a target object.
    So if you use Projector on the terrain the size of texture will be the size of the whole terrain.
    Extremely stupid and extremely sad that in 2021 this is still not fixed.