- Home /
RenderTexture without existing in the scene?
What I would like to do is have a deck of cards, probably simple quads, where the front is a RenderTexture and the back is a simple static texture.
I've watched this straight forward tutorial about Render Textures and think it's exactly what I'm after but I have one concern. The card game idea I'm pursuing will have hundreds of varieties of cards. Does that mean I need a section of my scene dedicated to each card? Would every card need it's own camera? I see this getting very hairy very fast. I'd have a table where the card game takes place but a huge field of cameras, their main content, and back drops out of view for each card that are not seen by the main camera and none of these cards would see each other.
What options do I have to keep this maintainable?
Are the render textures on the back of each card updating each frame? If not, there's certainly no need to use any more than one camera.
The backs will be static textures. It's the fronts I'm worried about. Yeah, the fronts would render every frame ideally.
Do you mean the front texture would change every frame?
Would there potentially be a time when the front of every single card is visible simultaneously?
The idea is still a work in progress but right now I can't imagine more than 20 or so card faces drawn per frame. I imagine I can toy around with quality parameters until my cards all draw smoothly.
I'm less worried about the performance than I am about maintaining all the cards as I add and remove them from the game. Right now my understanding is that each card would need it's own Camera, 3D Object (a rather simple model to actually see), and a 2D texture backdrop behind the model. Do all these components have to be in the same scene like when other games put resources "below the map" so they're available when they're needed? Or is there a better way to sandbox these components away from the main scene components?
They would need to be in the scene, yes, but that could be handled by doing something like putting all of the card "contents" on a layer of their own. Then, it doesn't matter exactly where they're physically located (so long as one card's camera isn't looking at the contents of another card by accident). Just set the camera(s) to only view that layer.
As for cards that aren't currently needed, you can disable gameObjects/cameras when they're not currently needed (if you don't need too huge of an active pool of them).
Then, further optimization can be done if you manually update the RenderTextures (rather than automatically creating them from a camera) by having a controller script for the cameras cycle through only a few per frame to update them at a lower framerate than the main gameplay.
Your answer
Follow this Question
Related Questions
Apply Render Texture To Camera Via JavaScript - Help 1 Answer
modify textures at runtime? 3 Answers
Graphics.Blit with an additive shader 1 Answer
Real time rendering in cubemap in image effect 1 Answer
RenderTexture stall 0 Answers