- Home /
Set RenderQueue for Terrain
Hi there
I try to influence how the terrain is drawn. Actually I try to make a transparent hole in the Terrain. Unfortunately I can not change the RenderQueue, the console gives me an "No 'Renderer' attached to the 'Terrain' game object" error.
Therefore I can not influence the rendering order for the terrain.
Is there any workaround to do that?
Answer by Owen-Reynolds · Jan 03, 2012 at 05:22 PM
The built-in Unity Terrain doesn't use transparency. Sure, you can select a png and paint with it, but the hard-coded drawing routines don't look at alpha. Even if you could get it in the transparent queue, the terrain would still be drawn solid. You can modify the shaders to use alpha, but the built-in paint tool won't know that, and won't work right.
I look at it this way. Most game engines have everything built-in and that's just the way it is. In Unity, only Terrain is still that way. That seems fair to me, since efficient terrain rendering is such a complex area.
For the hole, do you want it to also not have collision? Like making a cut-out for a cave mesh? Because collisions are a whole other area. Best is to built the "terrain" out of your own meshes.
Thank you very much Sir, for this nice explanation.
Collisions I could turn of by placing a collider accordingly, and upon entering it turn off the collision for the layer.
As you supposed, I personally believe too that the probably best solution is to make additional meshes and add them on top of the terrain if holes are necessary.
I wanted to know if there is a way around that, but your question gives me a good argumented answer to say: No, there isn't. (Just in case my boss comes up with that topic again.)
Answer by Venryx · May 13, 2013 at 08:37 PM
You can set the shader's RenderQueue (to get the same effect) by writing a replacement shader.
For creating terrain holes, though, I've put together a Unity plugin that does just that: Terrain Hole System
Description: "This Unity extension lets you make holes in your terrain that characters and other objects can go through."
More information can be found on the forum thread.