Hello everyone, first I would like to say I am a hobbyist but have 5 years experience of c# and 1 years experience of Unity. Similar methods from my research include ‘decals’, ‘splat mapping’ and ‘texture mapping’.
I am trying to render an image onto a texture, in real-time, updated every frame (or so). In game terms, I am trying to “spray” decals onto the texture. There will be numerous amounts of them, so instantiating instances for each would not be best due to the large amount of memory that would require.
I have a SetPixel method working currently, but this is very slow and drops my computer to 15-20 fps with an empty scene, save for the texture I am rendering to.
I read Render Texture can be used in the same way, but can not for the life of me find a suitable tutorial.
I have no shader experience but am currently going through tutorials to try and learn.
Does anyone know of a tutorial or have an explanation for fast texture editing? The textures will not be larger than 1024X1024 I do not think. Ideally I’d like to interpose images onto a texture directly. Having a way so Save the textures is a must as well.
Funny enough, you’d probably have better results with 1000 decals than using SetPixels() =P That function works on the CPU, which is VERY slow for graphics. For everything graphics related, you want to use the graphics card.
That aside, you can use command buffers to plan reusable sequences of graphics command. You can also change the command buffer whenever the decals change. This will require some research; I can answer questions but it will take me far too long to explain command buffers from scratch.
An easier way would be to just use a camera with a renderTexture, and have that camera render the decals onto that texture by looking at them. Trust me… this is MUCH faster than SetPixels()
Thanks for the info! I’ve ben looking into command buffers. I still can’t find a tutorial for using Render Textures for anything other than a sort of “tv effect” which doesn’t go into any scripting with a Render Texture. Any links/snippets or information? Is it similar to a http://docs.unity3d.com/Manual/class-Projector.html?