17 Mar 2019

Making of Lepus Minor

Lepus Minor is a demoscene production that I created with 3 of my friends and entered it to the Demo competition of Instanssi 2019. You can watch the demo from Youtube or download it through Pouet.net and run it on your Windows machine.

I took many screenshots while I was programming the demo and the renderer and thought I would make a Making of post and here it is :D

The development of the renderer started already in 2018 when I started going through the excellent Learn OpenGL tutorial and adjusted the material for my own purposes. During that I made an Imgur album of rendering bloopers which you can see here.


And now about Lepus Minor proper


The first idea was that in the demo the camera would follow a glowing crystal bunny through a forest so that the bunny would disappear and then reappear further away, leading the viewer to a hilltop, where the Monolith would appear and display the greetings and credits.

While the demo progressed, the bunny and Monolith stayed but practically everything else changed and it became a homage to the movies 2001 A Space Odyssey and Contact.

First order of business was to create the opening scene with a mountain range under a night sky. I needed the sky to rotate and first idea was to create a sphere of stars, that would then be rotated.

The mountains were created with a fractal algorithm, that I found thanks to Skrolli-magazine.

The first implementation had a bug where the stars would get smaller higher up, but that was because I took a certain dot product after setting the distance.

Next I needed text to show the greetings and credits. I did a simple bytemap-font rendering system where a letter was translated to texture coordinates and each letter was drawn with a quad. That was simple enough and I found a simple pixel font generation program to help with that.


Next was water for the ice planet. Originally it was intended to be moving and to have waves, so I made a displacement map and a shader that would adjust vertices according to that and that worked too eventually and I had a kind of Minimum Viable Product (MVP) put together on 5.1.2019.



Then I also wanted the water to reflect the stars above and for that to work I needed the sky to be a cubemap instead of a sphere made of stars. I had lots of trouble making the skybox work, because for that the texture coordinates work differently than the rest of OpenGL for some historical reason. But with patient debugging and using the Konata test image, it started to work. At this point I started thinking that the konata.png was a kind of a lucky charm, because setting it on things made them work <3 This image was taken on 16.1.2019.



The reflection from water proved more difficult. Or rather, reflection was easy, but combining it with a rotating skybox and waves was not.
I eventually found out that it would not work without proper normal maps, which would need cotangents and all that stuff for which I did not have time to get into. So I scrapped the waves and decided that the sea would be frozen instead and the planet would be very blue and cold.

Next big thing was the bunny and the space warp sequence. I wanted to give the impression that the constellation would light up the bunny model from inside. Just flipping the normals for the light calculation would have worked but I wanted actual refraction. And for that I needed a touch of raytracing. Luckily I had been doing it for a school assignment years ago so I thought it would be simple to add.
Turned out I did not remember things that well, but luckily I found Raytracing in one weekend which helped to get the formula right. And lo, the light was born. In the end I decided to combine the Phong lighting and the ray tracing, because it made the bunny look more like frosted or scratched crystal.




It was a beautiful moment when it started working.


Last part was the Ice Planet. I made a blue planet for the skybox using just a gradient in Gimp and generated a second mountain range and placed that so that peaks would be above the water level. And it looked fine.


The above image was taken on 15.2.2019 so there was still about a month until Instanssi. The rest of the time I mostly spent on tweaking colors, code and syncing everything together using Rocket. Ijoro made a beautiful skybox to replace the placeholder I had done.

I made a quick sketch of the bunny and Ninzo made a 3D model from that. Then I just had to reposition the lights. There was no graphical editor but atleast I had had the wisdom to make the demo load values from a config file and being able to reload the values while running saved so much time.


Last thing I did was to add support for controlling the lights at Instanssi using UDP-packets. I had never done that before, but C# made it easy. Or should I say too easy, because I did not realize that not finding the effect server at adress "valot.party" would prevent the demo from running :I

Windytan was making music while all this was going on. Their computer would not run the demo, because Mac OS does not support OpenGL or something. But I took a video and they timed the music to that. Here you can see the work in progress versions of the demo with music, first one is from 8.2.2019

And the second from 27.2.2019

Finally the demo was ready during the event when Windytan sent me the final edition of the music. It was a really magical feeling seeing it all come together and again seeing it on the big screen. I was super nervous and I was trembling all over. I haven't gotten such a feeling from any other creative endeavour I have undertaken so I think I'll continue to make demos <3

(And after the party I fixed the host not found -bug and added Naudio library to get Ogg Vorbis playback, but that broke linux compatibility. I quess like other art, demos are never really ready.)





No comments:

Post a Comment