8
\$\begingroup\$

I am trying to learn the most performant way to make an imposter in Unity manually - not using pre-fabricated solutions.

My first guess is that it should be achieved by using RenderTexture and a second camera and then taking different "snapshots" of different angles of the objec. If there are better alternatives in terms of performance (even if more difficult to implement), I would love to hear about.

In case that is the only path, then I have learned how to render from a camera to a texture via script, but I still couldn't figure it out how do the following, which is what I need to do first: how to render-to-texture a specific object without the background of the camera (i.e. with rest of texture being transparent) in a performant manner?

Pointers, suggestions or at least link recommendation will be great.

Thanks in advance.

\$\endgroup\$
  • \$\begingroup\$ Please narrow your post to a single question. You can create 2 different question posts for your two questions. \$\endgroup\$ – Alexandre Vaillancourt May 4 '16 at 13:17
  • \$\begingroup\$ @AlexandreVaillancourt No problem! I did so. Let me know if it still needs further improvement \$\endgroup\$ – AndraSol May 4 '16 at 15:08
  • \$\begingroup\$ You also can't ask for 'links' as answers that provide only links are not considered good answer for this site, otherwise, your question is okay :) \$\endgroup\$ – Alexandre Vaillancourt May 4 '16 at 15:11
  • \$\begingroup\$ @AlexandreVaillancourt Thanks! But I guess then good link recommendations could come via comment, am I correct? \$\endgroup\$ – AndraSol May 4 '16 at 15:24
  • \$\begingroup\$ Something like that, yes. An answer can be well written and have links to more details. An answer that contains only links will be removed. Comments are not subject to these rules. \$\endgroup\$ – Alexandre Vaillancourt May 4 '16 at 15:26
3
\$\begingroup\$

There are a variety of different imposter techniques.

Level of detail is probably the easiest to achieve, but has two main drawbacks. The noticeable 'pop' effect when you swap between low and high resolution models, solved by gradual transitions between LODs. The second problem is that it's MUCH more work for the artist to generate LODs for every single model. There's a GDC talk which about an automated way to generate LODS - "Automated Level of Detail Generation for HALO: REACH"

A simpler technique would be billboarding, where you use only a flat polygon, instead of a low resolution mesh. This polygon faces the camera, and is textured from a render of your model. This method requires having multiple different views of your object, much like how the enemies in doom. You could prerender all your views to a texture atlas. Modern games use this approach, like Far Cry 3 https://www.youtube.com/watch?v=9P3EI17kHaI

You could also have several different static billboards, and combine them like in this unity package https://forum.unity3d.com/threads/abi-automatic-3d-billboard-imposters-released.204579/

But the best way (which I think you want) is dynamically rendering your billboards, like in this gamasutra article. http://www.gamasutra.com/view/feature/130911/dynamic_2d_imposters_a_simple_.php This was first done by Jurrassic Park: Trespasser in 1998, so it's not a new technique. Check out the code review here http://fabiensanglard.net/trespasser/index.php Scroll down to the section on wavelets to see their imposters.

Except the standard LOD approach, your first step would probably to find a render texture tutorial. The orientation of the renderTexture camera must be the same as your main camera, but cropped around the gameObject for efficency. You will need to isolate the gameObject(s) you want to render with a culling mask. And set the camera's clear flags so that you get a transparent background. Then render an imposter billboard in place of the original object.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.