Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Flatten an object via vertex shader?

Discussion in 'Shaders' started by Chipboard, Dec 2, 2023.

  1. Chipboard

    Chipboard

    Joined:
    Aug 26, 2017
    Posts:
    6
    Hello! I'm wondering if anybody knows a good way to flatten a 3D object towards the camera to make it look 2D. My plan is to interpolate between making a mesh look 2D and 3D by distance, but I first need to find how to make the object look 2D from any angle...
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,865
    Do you have an example of the look you want to go for?
    Maybe an Orthographic camera is all you need
     
  3. Chipboard

    Chipboard

    Joined:
    Aug 26, 2017
    Posts:
    6
    Unfortunately not, I want to be able to blend certain objects from looking 2D but in perspective view, as some objects will be closer and require perspective vision.

    Like, if I have a vaporwave sun as a sphere, but I want it to retain the vaporwave aesthetic at a distance - it needs to look 2D, but when you get up close it needs to be full 3D perspective.
     
  4. POOKSHANK

    POOKSHANK

    Joined:
    Feb 8, 2022
    Posts:
    145
    'Infinite' sky shader for Unity · Aras' website (aras-p.info)

    maybe you could try to use a shader like this and lerp (with step, not smoothly or it would definitely look weird) between default position and skybox-ified objects?

    another thing to come to mind is using the LOD system and a billboard impostor, though that would add a lot of work to your asset pipeline, plus overhead.

    just throwing ideas out, but it seems like a very interesting concept :)
     
    Chipboard likes this.