Rendertexture does not render terrain :(

I’m making a minimap for a game…
I created new camera, attached rendertexture to it and if I try to add the rendertexture to a gameobject then terrain and everything else shows perfectly but…
I want to have a 2D minimap, so I tried adding new GUI Texture into game and placed rendertexture in Texture position, but it only renders game objects, where as Terrain is invisible, it doesn’t show up :frowning:

Where is the problem?

Thank’s.

Do you need a map like on a road map or a gps? or do you want a realTime video clip from the top of the character’s head?
What about making a screenshot (cmd+shift+4) from inside the editor you then use as the texture of a plane you put under the terrain. Then simply change the layers of the object and the ones the main camera shows, so that in normal view, you can’t see the plane with the map on it, but it’s rendered by your map camera… :slight_smile:

Umm It’s more of a GPS lol, basically I added the camera much higher than the character and it will render the character from top, following it everywhere.
Simple minimap :stuck_out_tongue:

It works perfectly, just that the terrain isn’t being rendered :S

anyone…? :frowning:

Need to fix this really badly :confused:

Haven’t tried render textures yet but how about checking camera far clip and checking the alpha of the terrain on the resulting texture?

Another thought: have you put the terrain in its own layer? If so, make sure the camera’s culling mask is set to render this layer.

Hey,

I has this exact same issue but found a solution (or what I think was the solution). Inside you OnGUI function instead of using GUI.DrawTexture do a Graphics.DrawTexture(…). This will also allow you to apply a shader to the texture so you can make your mini map any shape.

Or simply use a second camera that you can place over your character. Then you’ll have to adjust position and resolution of this camera, I already took this for minimaps in my own levels. The camera’s output images should then show up at the border of the screen and render everything, included the terrain.
(Why do you want to use a render texture, if there are other very basic methods?)

:frowning:
I got same problem, I need show terrain in GUITextute to make the Car’s mirror.

Anyone help?

You might not need to use a GUITexture to make a car mirror. The Camera class has a rect variable that determines where on the screen the camera will render. You can set the mirror camera so that it renders to a small, mirror-shaped rectangle rather than the whole screen.

Hi all I’m experiencing the same problem.

I tried that but my terrain still won’t render.

My terrain is tagged as Default Layer, and my Minimap Camera is rendering Default (most other objects are Default also)

I want to use a camera and not a Screenshot because the camera show perspective, whats very very cool :slight_smile:

Thanks in advance.

I’ve just run into this problem. It looks as though the GUI/Text Shader doesn’t render terrain. I’d presume that’s the shader when one uses any GUI methods to draw a RenderTexture. The workarounds mentioned (Graphics.DrawTexture, using the view port rect) work, but I plan to file a bug report anyway.

Still not fixed in 3.5 … gah.

This is not a bug, as you must have configured something wrong. It renders perfectly for me,

Try using this code. Make sure to set the Material to Unlit/Texture, if you use the normal Diffuse, this will not work!!

using UnityEngine;
using System.Collections;

public class MinimapTest : MonoBehaviour
{

public Material aMaterial;
public Texture aTexture;
void OnGUI ()
{

Graphics.DrawTexture(new Rect(100,100, 128, 128),aTexture, aMaterial);

}
}

I previously had the same issue but this solved it for me.

Credit goes to Tabu at UnityAnswers for finding this.

Great one! [quote=“anon_72746843, post:15, topic: 398579, username:anon_72746843”]
Try using this code. Make sure to set the Material to Unlit/Texture, if you use the normal Diffuse, this will not work!!

using UnityEngine;
using System.Collections;

public class MinimapTest : MonoBehaviour
{

public Material aMaterial;
public Texture aTexture;
void OnGUI ()
{

Graphics.DrawTexture(new Rect(100,100, 128, 128),aTexture, aMaterial);

}
}

I previously had the same issue but this solved it for me.

Credit goes to Tabu at UnityAnswers for finding this.
[/quote]

I have found it! Go to the camera that renders the mini map. Then go rendering, and there is Opaque texture. Turn that on.