20
\$\begingroup\$

I'm making a game in unity and I'm building a fence in blender but I want it to be as low poly as possible. My original design was too high poly so I thought, what if I could simply use a cube with some cleverly arranged textures. Like so:

enter image description here

enter image description here

You can see the edges are all looking good but the inside sections are not, i.e there's nothing there... so does anyone know if it's possible to fake those faces that would make it look as though it were a complete mesh. Here's what I'm tring to achieve:

enter image description here

\$\endgroup\$
  • 7
    \$\begingroup\$ I count 52 vertices on that fence. That's not that many. \$\endgroup\$ – Pharap Jan 15 '16 at 10:08
  • 1
    \$\begingroup\$ @Pharap But keep in mind what happens when you place thousands of copies of this mesh at your level border. \$\endgroup\$ – Philipp Jan 15 '16 at 11:41
  • 5
    \$\begingroup\$ @Philipp If Unity is using Vertex Buffer Objects and similar optimisation techniques correctly that shouldn't be an issue. You could always just use a billboard sprite with alpha if you're that worried. Or better yet, render a billboard sprite at a distance and render the proper mesh when the player gets close enough. And I sincerely doubt you'll get thousands of fences being drawin to screen at once. Even if there are 9000+ fences placed in the world, I suspect a large amount of those will be culled. Have you actually benchmarked or are you just making assumptions about performance? \$\endgroup\$ – Pharap Jan 15 '16 at 11:49
  • 6
    \$\begingroup\$ Are you developing for mobile or for PC/console? At least on modern (5 years old or younger) GPUs, the 52 vertices model is probably cheaper than doing some alpha blending/alpha masking. It depends on that many factors (screen coverage, GPU, pixel shader or rasterization bottleneck, etc.), but using alpha masks always results in overdraw. You should probably benchmark that before optimizing. \$\endgroup\$ – Tobias B Jan 15 '16 at 15:25
  • 2
    \$\begingroup\$ One instance where you might not want to do this, however, might be if you needed to ignore collision detection in those gaps, such as if you've tried shooting through gaps in certain objects (in some first person shooters) and a "bullet-hole"(decal) appeared on the "empty space"(model). \$\endgroup\$ – DoubleDouble Jan 15 '16 at 19:46
26
\$\begingroup\$

If I understand correctly what you want to achieve, you are looking for the concept of "imposters". These are precisely 2D representations of 3D objects, used to decrease the geometric complexity of rendering the 3D environment.

You can think of them pretty much as pictures of the 3D objects that are used as textures of 2D objects. The canonical reference for those is probably the chapter 21 of the book GPU Gems 3, called "True Impostors". It's publicly available here. Another important reference is the chapter 5.7 of the book Game Programming Gems v.2, called "Imposters: Adding Clutter”, in Game Programming Gems 2, Tom Forsyth".

And they can evenly be generated on the fly, to deal with small changes in view-angle or with run-time generated content. Take a look at the great Gamasutra article on the topic, called "Dynamic 2D Imposters: A Simple, Efficient DirectX 9 Implementation". A further development of the concept has appeared at "Billboard Clouds for Extreme Model Simplification".

For a gentle great explanation of the concept, see this blog entry: http://blog.wolfire.com/2010/10/Imposters

Lastly, as you are using Unity, I've heard of a plugin that automatizes such process. It is called Real Imposters LOD System.

UPDATE: for the sake of completion, I thought of adding two things that I remembered of recently. First is: there is a great GDC video where SimCity's art director explains how they have made (heavy) use of imposters to achieve top-notch graphical achievements of that game: "GDC - Building SimCity: Art in the Service of Simulation".. Second, for those interested in Unreal Engine, it has a built-in feature to implement imposters, as can be seen in docs

\$\endgroup\$
  • \$\begingroup\$ So if I make the fence model, the full one and use the Real Imposters LOD System, that would work you think? \$\endgroup\$ – mr-matt Jan 15 '16 at 6:54
  • 5
    \$\begingroup\$ @MatthewInglis I can't tell you exactly about the plugin: it's been a while since I don't use Unity so I can't check. But in principle, yes, it should create a 2D sprite version of your 3D fully detailed object. You would have to play around with the configurations, though. If you plan on buying the plugin, consider reading first the docs (drive.google.com/file/d/0B3GMQtflbloSeHhvUGJmcjluX3M/view) and contacting the author with specific questions you might have on their product beforehand. \$\endgroup\$ – MAnd Jan 15 '16 at 8:01
0
\$\begingroup\$

If you don't need any interaction thought the fence, I mean, by the gaps, I would use a simple transparent rectangle with a texture printed.

\$\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.