Search Unity

Directly draw a cubemap RenderTexture

Discussion in 'Scripting' started by SunnyChow, Feb 6, 2015.

  1. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    I can draw what i want in normal RenderTexture with GL API. But I can't draw well in cubemap RenderTexture. Is there any example about drawing things on RenderTexture. I don't want to create a camera to do that.
     
    Ben-BearFish likes this.
  2. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @SunnyChow Any luck with finding a solution for this?
     
  3. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I'd like to know how to use the render texture/gl api haha... I'll have to Google some for that. Hmm.

    Anyway I'm also wondering what you found out about this, if anything.
     
  4. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    In function Graphics.SetRenderTarget(), you can select cubemap face.
     
  5. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I'll have to experiment with that.
     
  6. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @SunnyChow I'm semi-confused to how the cubemap face overload for Graphics.SetRenderTarget() would work. Let's say I have a cubemap for a skybox and a rendertexture. How does Graphics.SetRenderTarget() know what cubemap to modify using the RenderTexture?
     
  7. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    I don't understand. RendererTexture can set as cubemap, which means one RenderTexture storing 6 side of texture. And then you use it for skybox. Did you read the API documentation?(http://docs.unity3d.com/ScriptReference/Graphics.SetRenderTarget.html)
     
  8. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @SunnyChow I was trying to use a cubemap as a skybox. Then I was trying to set a rendertexture to each side of the cubemap skybox. But I don't understand how to do this with Unity exactly. I thought using Graphics.SetRenderTarget would work, but it looks like I'm doing something wrong.
     
    Last edited: May 26, 2015
  9. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I tried that, but it always Blit on the X+ side. The documentation claims the Cubemap setting in SetRenderTarget only affect Get/SetPixel(). Anyway to render to a Cubemap faces?