Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

I got problem:3D RenderTexture cannot be set as active render target

Discussion in 'General Discussion' started by nzq, May 30, 2016.

  1. nzq

    nzq

    Joined:
    Oct 21, 2014
    Posts:
    4
    HI bud, I am engaged in dynamic GI work that obj not need set to static, when you encounter a problem, unity3d4.X no problem, in the 5.x unity3d on the problem:
    3D RenderTexture cannot be set as active render target
    UnityEngine.Graphics:SetRenderTarget(RenderTexture)
    dGI.GLOBAL_ILLUM:OnPostRender(Int32) (at Assets/dynamicGI 1/dGI/GLOBAL_ILLUM.cs:427)
    dGI.dynamicGI:method_6() (at Assets/dynamicGI 1/dGI/dynamicGI.cs:679)
     
  2. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Would like to see those methods. Also NEVER, EVER call your methods "method_<number>". Use descriptive names instead.
     
    Ryiah and kittik like this.
  3. nzq

    nzq

    Joined:
    Oct 21, 2014
    Posts:
    4
    ok thks for you replay the part code method below:

    public void OnPostRender(int int_2)
    {
    Vector3 vector4;
    Matrix4x4 projectionMatrix;
    Camera component;
    int num3;
    this.method_2(int_2);
    this.worldNormalBuffer[int_2][0] = this.colorVolume[int_2][this.int_0].colorBuffer;
    this.worldNormalBuffer[int_2][1] = this.normalVolume[int_2].colorBuffer;
    float num = Mathf.Tan((Camera.main.fieldOfView * 3.141593f) / 360f) * Camera.main.farClipPlane;
    float num2 = num * Camera.main.aspect;
    Vector3 vector = -Camera.main.transform.up;
    Vector3 right = Camera.main.transform.right;
    Vector3 vector3 = (Vector3) (Camera.main.transform.forward * Camera.main.farClipPlane);
    Vector3[] data = new Vector3[] { (vector3 - (vector * num)) - (right * num2), (vector3 - (vector * num)) + (right * num2), (vector3 + (vector * num)) - (right * num2), (vector3 + (vector * num)) + (right * num2) };
    this.computeBuffer_0.SetData(data);
    RenderTexture active = RenderTexture.active;
    Graphics.SetRenderTarget(this.colorVolume[int_2][this.int_0]); ----->got problem here!
    ....
     
  4. nzq

    nzq

    Joined:
    Oct 21, 2014
    Posts:
    4
    you said that number with methods because the code is c# decompile code so...
    other is that project this project Buddy not update this project any more.