Search Unity

prerendered backgrounds

Discussion in 'General Graphics' started by Voodin, Jun 4, 2020.

  1. Voodin

    Voodin

    Joined:
    Apr 19, 2018
    Posts:
    48
    My coding speed is quite sporadic, so I'm finally returning from another break of programming. While my speed will be hampered by my college courses, I do intend on completing at least one of the ideas I've had from my previous threads. I'm currently making progress making prerendered backgrounds in Unity. I've discovered a program called fSpy that allows one to create depth data from an image in import that into blender. Though the sheer amount of buttons, sliders and macros in blender makes it very hard to get acclimated with, I've learned enough to make basic collision and then i can import that as an obj into unity and do the rest from there.

    The current process is as follows:

    1. Import photo to fSpy and align the perspective guides, save project.
    2. import project into blender
    3. create at least a ground platform, export as OBJ
    4. import into unity, immediately unpack prefab
    5. the camera named fSpy will be used as the "room camera"
    6. import photo from step1 into unity
    7. use the photo on a quad parallel to the "room camera"
    8. create a new layer known as "background," this will be the layer the quads render on
    9. make a child camera of the room camera that is orthographic
    10. make the parent room cam's depth to 1, set its clear flag to depth only, set its culling mask to everything but background
    11. set the child room cam's depth to 0, and set its culling mask to background only
    12. use this depth masking shader to mask all collision.
    The current issue right now is making the dimensions of the cameras match the image, so i will have to standardize the image dimension ratio. I also plan on implementing camera panning similar to this video.

    I hope anyone else wishing to make a prerendered bg game got some ideas from what I have so far, and I hope anyone who's already succeeded has any tips to offer me. Thanks for reading.
     
  2. mouurusai

    mouurusai

    Joined:
    Dec 2, 2011
    Posts:
    350
    You can use a projector, but it's will led to some restrictions.
    Or you may create your own projector: calculate VP matrix in script then push in in shader, anything else should be just like a projector.
    With projection tecniqe you can use lowpolly proxy objects as projection recciver, character occluder and shadow recciver.