Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

280
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!