Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Custom Render Texture possibilities

Discussion in 'Shaders' started by SVKsuli, Jan 17, 2019.

  1. SVKsuli

    SVKsuli

    Joined:
    Mar 23, 2014
    Posts:
    63
    Hello, i decide to create new topic about this because i see that there is not many info or tutorials about it.

    What i want is change texture2D in runtime, make effect of destroyable terrain and fit PolygonCollider to it (It will look simmilar to Worms style). I want to do it with changing pixels because i want to have a lot of posiblities and efects but i dont want something like pixel perfect becuase i want to stay with normal full HD resolution and real physics.

    What i found is Custom Render Texture, But im not sure if i understand it right, can i use it to change texture pixels with Shader and save changes to texture that C# code can acess this changes and even polygon collider can fit to it?

    Only what i found is https://docs.unity3d.com/2017.3/Documentation/Manual/CustomRenderTextures.html where is really just a basic info and https://github.com/keijiro/RDSystem but this project is just confusing, it dont tell me whats happening there and how to use it.

    Thx for any help or advices.
     
  2. Mr_Admirals

    Mr_Admirals

    Joined:
    May 13, 2017
    Posts:
    86
    I don't quite understand what you're trying to do. I've dabbled a bit with Custom Render Textures, and I agree that the documentation isn't quite there.

    If you could elaborate more I might be able to help?
     
  3. SVKsuli

    SVKsuli

    Joined:
    Mar 23, 2014
    Posts:
    63
    I have 2D game, where terrain is Texture2D, and i need to do it damage like create holes and simmilar effects like in game Worms (better to check this game to understand). But i want to have normal physic with attached PolygonCollider to it that will update to changes... I do this with texture.SetPixel but doing it only with c# is so slow when you want to create hole like 300x300pixel or bigger. So i want to do this changes with Shader but bucause GPU and CPU are not synchronizated, i cant normally get changes from shader to c# code.