Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

279
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda