0
\$\begingroup\$

The C# script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class clod : MonoBehaviour{

    [ExecuteInEditMode]
    public ComputeShader compushad;
    public RenderTexture rendtex;

    void start(){
        rendtex = new RenderTexture(256, 256, 24);
        rendtex.enableRandomWrite = true;
        rendtex.Create();

        compushad.SetTexture(0, "Result", rendtex);
        compushad.Dispatch(0, rendtex.width / 8, rendtex.height / 8, 1);
    }
}

The compute shader script:

#pragma kernel CSMain

RWTexture2D<float4> Result;

[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID){
    Result[id.xy] = float4(id.x & id.y, (id.x & 15)/15.0, (id.y & 15)/15.0, 0.0);
}

From a Youtube video that I saw: "After hitting the play button, the RenderTexture can be previewed from the inspector window." I can't access the RenderTexture in the inspector window.

\$\endgroup\$

0

You must log in to answer this question.

Browse other questions tagged .