On Habré there are very few articles devoted to non-game applications of Unity3D. We decided to correct this annoying situation and talk about how we did (and continue to do) an online apartment planner (yes, another!) With rendering high-quality images on the server side and integration with Oculus Rift .
According to our estimates, the material is typed in a dozen articles, so we will tell you a little about the project itself, and you choose which topic to cover in more detail.
Disclaimer: all images in the article are either screenshots from the browser, or automatically generated on the server, and have no pre or post processing. ')
How have we been doing for many years
Long backstory for the curious
From TurnTool to Unity3D
We have been engaged in 3D interactive for a long time, until 2006 using Flash and TurnTool . For example, back in 2006, we hand-picked an apartment with an interactive for the St. Petersburg shopping center “Great” (it still works, but only in IE). For that time - the coolest thing, with a folding sofa and changing textures.
After TurnTool, we started to torture VirTools , where we developed online races: first on trucks, and then on track cars. The critical limitation of technology was the complete absence of the server part, which had to be written independently.
Unity3D game
Therefore, finally, in 2009, we started developing Unity3D, then still version 2.0, and after a while we finally switched to it and completely transferred our online race, TurboDrive, to the new engine.
The game had different tracks, coloring cars, handling collisions and falling off bumper bumps. It still works as a VKontakte application (run strictly on http, not https!), But it does not develop anymore. About TurboDrive you can add a separate epic story of cones, files and discoveries.
The story showed that the final transition to Unity3D was the right decision: TurnTool and VirTools died altogether, Flash lost the market as a tool for 3D interactivity.
From racing to online layouts
Working on client projects, in 2010 we made the first interactive walk around the apartment on Unity3D for the Swedish developer NCC. In it you can wander around the apartment, look at the real view from the window and change the finishing options.
The project turned out to be successful, and we decided to put all the existing experience and experience (as well as a part of the agency’s profit) into the creation of an online tool for apartment planning and interior design. So it appeared ...
Planoplan
In the two years since 2011, we have created an online apartment planner . And not “just a scheduler”, but the first scheduler on Unity3D with rendering high-quality images on the server side.
For ordinary private users, it works on the freemium model - you can register and use it for free.
It has all the appropriate functionality such as the arrangement of walls, hanging textures and placement of furniture - we will not talk about this. We will touch only some of the "chips" that were made possible thanks to Unity3D (and restrictions too, so be it).
The quality of the image in the browser
Due to the fact that Unity is sharpened for high-performance 3D graphics, we get excellent picture quality in the browser without losing speed. Also made possible realistic lighting on fairly productive computers.
If earlier in the triangle “speed - quality - the possibility of free viewing angles” one could at best choose any two points, then in “Planoplan” one can choose all three.
For example, translucent curtains are visible. The whole room is reflected in the chrome leg of the chair. There is an opportunity to have many accessories that enliven the interior: books, knick-knacks, oranges. On the same computer, the Unity3D application runs much faster than Flash or HTML5 solutions with the same picture quality. And it gives a much higher picture quality than Flash solutions with the same speed.
The video below shows the picture quality (better to watch in HD, fullscreen, with the setting “Scaling is Off”).
How other schedulers look in a browser
Apartama.Unity3D, fast, low quality, 8 viewing angles with a walk.
AutoDesk Homestyler.Flash, slow, medium quality, 8 viewing angles without a walk.
FloorPlanner.Flash, slow, medium quality, free without a walk.
Outline3D.Own plug-in, slowly, poorly, freely with a walk.
Planner5D.HTML5, medium fast, medium quality, free with a walk.
Realaxy.Flash, slow, super, free with a walk.
Interactive elements
Exactly for the same reason (Unity is sharpened for productive 3D graphics) we could make the fire burn in the fireplace, the radio rustled, and the clock showed the current time. Sofas are laid out, the doors open and close ... In general, a wide field for gamification of interior design.
Screenshot from the browser, the fires of the fireplace give a live "playing" lighting.
Quick math
In Planoplan bent walls, figured openings in walls, procedural generation of meshes are possible for creating contour objects in rooms (multilevel ceilings, figured baseboards, podiums, beams), the intersections of baseboards, walls and door frames are correctly calculated.
Correct intersections of all surfaces.
An example of a procedurally generated ceiling plinth with a complex profile.
The position of the sun on the celestial sphere (and as a result, the lighting of the apartment with daylight) can also be calculated automatically directly in the browser, depending on the given coordinates of the apartment and the current time of day.
Server rendering
So far, this functionality is only in AutoDesk. We made a bunch of “Unity Web Player → Custom Server → Unity Standalone → Render Server”, and now by clicking anywhere on the button you can get a high-quality picture. In fact, most novice and medium-sized designers no longer need the services of 3D graphics specialists.
And a bunch of examples of pictures from our regular users
To test the limitations of the technology, we rendered an image of 15 360 × 8 640 pixels (the image below is clickable, leading to Yandex.Disk with a JPG of 10 MB). God knows that from the point of view of the interior, but it is clear that the whole kitchen is reflected in the kettle that has grown into the countertop.
Cross-platform and mobile devices
Unlike Flash-planners, Planoplan works wherever a plugin is placed in the browser. That is, on Windows and MacOS. On Linux, only the standalone build is currently running.
In addition, we can quickly and easily make from ready-made projects created online, assemblies for mobile devices on both iOS and Android (in the video below - from 04:00 ). This allows you to add an interactive demonstration of layouts and interiors in mobile applications with the same picture quality and speed.
The virtual reality
The developers of Unity3D are people worthy of a monument in life and real estate in Hawaii. They very quickly began to give the ability to display images in 3D. At first it was a 3D monitor with glasses. It was cool, but not super cool.
This is not the photographer's hands are shaking, this is included 3D-mode using NVidia 3D Vision.
And then he appeared - the helmet Oculus Rift (in the video below - from 00:30 ). With his help, we can immerse a person in the space of his future apartment (if he buys an apartment) or interior (if he uses the services of an interior designer, buys furniture or decoration materials).
The technology blows the roof to us and 98.5% of visitors to our stands at trade shows. The remaining 1.5% are boring, which do not like the grain and low resolution.
By the way, anyone can see it with their own eyes on November 18–22 at the Expocenter at the Mebel'2013 exhibition and on November 30 - December 1 in Sokolniki at the CG Event .
Restrictions
There is no complete happiness in life, of course. And the Unity3D technology, besides ample opportunities, gives only a few drops of tar. Here is a complete list of what we could not win in a year and a half of development.
Limit of memory in the 32-bit version for Windows and the fall of the 64-bit assembly. Now developers are actively working on this and promise to fix it soon, we keep in touch with them.
For mobile devices and for Linux, separate assemblies are needed, this magnificence does not work in the browser yet. It remains only to believe in developers, but so far there have been no promises to change this situation.
Oculus Rift cannot be screwed to the web version, because it does not allow connecting third-party libraries. We believe that the guys from Unity and Oculus somehow agree.
And much more
In the process of work, we had to go a long way, and on the walls next to some developers we can see dents from the head. Vote what you would be interested in asking our Unity veterans first.
Upd: By the way, one of the Planoplan development fathers appeared in the comments, FoxUmkov - respects and questions can be addressed to him directly.