How would you go about creating a custom renderer that renders buildings around you when you get a certain distance a way from them line by line as if they are being drawn in (a 5 second animation type thing). The buildings would collide with you and you might be able to go inside or interact with them. (they are game objects).
Is this possible? What would be the limitations and how would you go about doing it?
I think it would look amazing and would fit in with my sketchy, wireframe art theme but I am not sure how to implement it.
Thanks in advance,
exitcode
Edit:
This isn’t really a support thread, I just don’t know where to start. It is an idea and is not urgent, just wanted to know how you’d go about doing it out of interest. I think it would be a really interesting feature. If you don’t understand my bad description, please bare with me - its hard to describe…
Thats what I thought but I’m not sure how you would do it. An individual animation for every building would be very difficult because of the amount of lines there might be in a building - would you render them as animated sprites and then some how convert them into actual objects?
Sounds a little in-efficient. Can you animate game objects to that extent? I’d of thought there is a way though.
That’s really interesting indeed. Maybe you start with rendering in wireframe but with the closest polygons and in a few seconds you keep adding the adjacent ones. then once all are rendered, render a copy of the mesh that is transparent and fade it in while fading the wireframe option out. Something like that. Sounds hard
You mean like as you get closer to a building it gets sketched in? Like someone is drawing it.
You would write a custom cut-out vertex/frag shader, and you would animate the cut-off threshold over time. You would use the alpha channel of your textures and vertices to encode the order in which things are drawn in. The vertex shader would control a higher order of magnitude of how things are drawn in, and textures provide more detail (image a grayscale texture where intensity represents time at which that pixel is drawn in). You could use a whole RGBA texture to get more precision in how things are drawn in. Using a single texture channel might get a bit muddy particularly if you had lines crossing over each other–bilinear interpolation would tend to muck that up a bit.
As soon as you got in range, you would activate the building, and start the building’s drawing timer. Once the building was completely drawn, you may want to swap to a static material (there would be some extra overhead in the dynamic shader and you would want to switch to a fully opaque shader as quickly as possible).
It would be expensive on mobile because you will be alpha blending the entire building for the duration it’s fading in, but not necessarily prohibitively so. It would depending on how graphically demanding the rest of your scene was.
That’s how I would do it, if that made any sense. I think it would actually be pretty straight forward to implement. The tricky part would be getting the right source art textures to get a nice looking sketch-in effect.
You’d want to put the world coordinate calculation into the vertex shader, but, yes, that’s exactly what you could do. Very large building could fade it incrementally as you walked through them based on the distance to each vertex (which is smoothly interpolated for all the intervening pixels).
Wow, thats almost exactly what we were thinking but with lines rather than shards - it would also have a slightly lower render distance.
I don’t know how it was done - shaders seem the way to go but still looks a little complex, I guess I should learn everything there is to know about shaders :P.
You could do it with dissolve shaders and a texture representing the lines being drawn… where if you can store enough ‘steps’ of color you would get a lot of frames of animation. e.g. store animation frames in RGB values - as a 24-bit number, expand it back to an integer in the shader, then based on a threshold (which you pass in as a variable based on distance from the player) determines how many of the texture pixels get output solid versus transparent. You could possibly try my dissolve shader pack on the asset store, although it really only provides 256 ‘frames’ of animation.
You said you want to learn “everything there is to know about shaders”. This is a bad idea, you’ll never finish Clearly shaders are an important and fun thing to learn about, but set realistic goals.