Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
Change pixels in RenderTexture

I am new to unity and have to use unity for a university research I am doing. For this I need to render a scene and use an external tool to modify render image data. This tool needs to read all pixels and generate a separate image based on the original data. So far following https://github.com/Unity-Technologies/NativeRenderingPlugin I was able to change a texture. However passing the render texture to the dll does nothing. Can someone please help.

This works:


 tex.filterMode = FilterMode.Point;

tex.Apply();


// Set texture onto our material

GetComponent<Renderer>().material.mainTexture = tex;

SetTextureFromUnity(tex.GetNativeTexturePtr(), tex.width, tex.height);

This does not work:

Camera camera = Camera.main;

var rt = RenderTexture.GetTemporary(Screen.width, Screen.height);

camera.targetTexture = rt;

camera.Render();

       

var currentRT = RenderTexture.active;

RenderTexture.active = camera.targetTexture;



camera.Render();

Texture2D image = new Texture2D(camera.targetTexture.width, camera.targetTexture.height);

image.ReadPixels(new Rect(0, 0, camera.targetTexture.width, camera.targetTexture.height), 0, 0);

image.Apply();



RenderTexture.active = currentRT;

camera.targetTexture = null;

SetTextureFromUnity(image.GetNativeTexturePtr(), image.width, image.height);

Any help is greatly appreciated. Stuck on this for a long time.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda