- Home /
Getting billboards of 3d objects at runtime
Unity terrain system has one brilliant solution for performance - billboarding. When I use trees, even many thousands of them are automatically billboarded with correctly updated rotations when camera moves over terrain.
I was wondering if there is possible to access this kind of billboarding feature for any GameObjects which contains meshes, without baking/loading tons of textures?
Answer by Paulius-Liekis · Jan 28, 2015 at 08:49 PM
You can not access functionality from Terrain, unless you use your meshes as trees...
You can build similar system using RenderTextures and sprites which are aligned to camera in shader.
Never heard about RenderTextures, however, I am already using for a while my own 3dSprites system in uRTS. But my problem is that I am pre-baking textures for different rotation modes. When I am switching between these modes I see instant "jumps". The problem is also baking textures, as when I use more rotational levels of more models, number of textures is increasing dramatically. So I am looking forward how to fix this.
Can you tell a bit more about RenderTextures and if there is possible to get these textures on runtime, which would be reasonably fast to use without actually baking anything?
Check documentation of RenderTextures (warning: it's a Unity Pro feature). It allows you to render an object to a texture. And that's how tree system works in Unity - it creates a billboard of a tree at right angle every frame and then used that billboard-texture to render all trees.
Aren't there any other similar Unity Free alternatives to treat with this problem?
Pre-generate many textures from various angles. But as you said - you get a jumps or take a lot of memory.
So now as Unity 5 is free, I wondering about how TextureRenderer actually works. In documentation I didn't find out how to submit mesh into RenderTexture, where it would be rendered at given rotation? I also was unable to find any discussions and answers yet about this.
Your answer
Follow this Question
Related Questions
Creating a billboarding surface shader 1 Answer
Starfield and rendering 1 Answer
Problem with unity tree billboarding 0 Answers
Rotate only mesh (not whole GameObject) 4 Answers
Tree shadow problem / billboard trees 3 Answers