Search Unity

Help|Reflection

Discussion in 'Scripting' started by KillerScript, Nov 2, 2010.

  1. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    hey everybody,
    i tryedto make a Reflection but it's not looking good...
    how can i make a pretty Reflection?
    TNX for the help.
     
  2. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
  3. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
  4. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    Don't know. I used the exact same thing in an earlier test project at work and it behaved just fine. Perhaps you did not follow the instructions properly in the "Usage" section. Also take heed of the note on that page:
     
  5. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    I doesn't antherstand...
    can you explane me that yourself?
    TNX ;).
     
  6. ivkoni

    ivkoni

    Joined:
    Jan 26, 2009
    Posts:
    978
    if you are trying to make a mirror (not a reflective surface), you can use a second camera that is set up to depth only and is inverted. You will also have to mask the area of the mirror using the depth mask shader from the wiki. I don't think there is another way to mask area, which is a shame...
     
  7. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    I doesn't antherstand...
    can you explane me that yourself?
    TNX .
     
  8. ivkoni

    ivkoni

    Joined:
    Jan 26, 2009
    Posts:
    978
    which part?
    You have a main camera through which you view the world.
    You add a second camera that will render your mirror.
    -if you have pro, then you can render the second camera to texture. This texture is assigned to the plane which is your mirror.
    (you can see a simple example of this in this game: Rubik'sCube
    -if you don't have pro, then you set the mirror camera to depth only (it's a camera setting) with a depth higher than the main camera.
    you use the depth mask shader from the wiki to mask the areas that are not your mirror.
    DepthMask
    in either case you invert the output of the mirror camera by using the script from the wiki. InvertCamera
    if your main camera is moving, then you need to move the mirror camera as well, relevant to your main camera. (the mirror camera uses a reflected psotion around the mirror of the main camera). This is done in LateUpdate()
     
  9. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    no,
    i told it to FizixMan i need his help because i doesn't waht to do that with camera...
    TNX anyway dude ;).
     
  10. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    I'm not sure, but I think you may need Unity Pro to use that script (otherwise you'd follow ivkoni's instructions)

    Beyond that, be sure to follow the instructions properly in the "Usage" section. Also take heed of the note on that page:
     
  11. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    i doesn't understand that.
    can you explane me better of thet?
    TNX.
     
  12. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    Every object has its own coordinate system (direction that it's pointing). In whatever direction that object considers "up" (as opposed to "forward", or "left") is where the reflection occurs along.
     
  13. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    so what i need to do if i want to see myself when i go to window of car?
     
  14. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    Use Unity Pro.
    Make sure the window object's "up" direction is pointing out from the window.
    Follow all the instructions on that mirror script page.
     
  15. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    but i have unity3d and i used the pro version and the pro version it's just for 30 days and i done the 30 days.
    and i doesn't want to buy it...
    i need " Crack" or something else???
     
  16. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    I'm seriously considering the possibility that you're just trolling us now. (asking for a crack on the official forums?)

    ivkoni suggested a complex workaround if you do not have pro. Beyond that, you gotta buy the pro version.
     
  17. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    oh i doesn't know tha very sorry!!!
    and i not trolling!
    but i saw my friend do that (a good Reflection)...
    without pro version...
     
  18. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    Ask your friend.
     
  19. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    ha i ask him dude but he doesn't realy want to tell me how he do that... :(.
    (Because i'm here)...
     
  20. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    Now why would he not want to tell you... :rolleyes:
     
  21. KillerScript

    KillerScript

    Joined:
    Aug 20, 2010
    Posts:
    368
    I realy doesn't know!
    realy!
    but he sayed that he want that "Reflection" for himself! :(.
     
  22. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    Guess you're SOTL then. Get Unity Pro or hack at ivkoni's solution (which is pretty ingenious), or better yet, just accept it, leave it and focus on completing the rest of the aspects of your game.
     
  23. ivkoni

    ivkoni

    Joined:
    Jan 26, 2009
    Posts:
    978
    it's pretty ingenious indeed. Only that it is not my solution, but I'd take the praise for it anyway, being the egocentric, arrogant human that I am :)
    I forgot to mention, but you may also need to use oblique frustum clipping (if there are going to be objects between the mirror camera and the mirror plane). You can see an example of this technique somewhere in the water script if I remember correctly.

    It would be easier to be-friend your friend a little more, maybe he will tell you how he did it.
     
  24. Kalabuka

    Kalabuka

    Joined:
    Nov 12, 2012
    Posts:
    3
    Thank you for your posts for mirror reflection, I'm wondering can I put it to a non-plane object like semi-sphere? Basically get the texture from reflection camera, then to put on the sphere object with the texture? Not a clear clue