I’d like to be able to find the current game screen resolution without using camera.width / camera.height. Is this possible? “screen.resolutions” returns -all- the resolutions the display is capable of, right? I just want to know if I can find the current resolution without having to have a camera set to full screen?
Secondly, my scene has 2 cameras that do not fill the screen. How do I fill the background with a tiled graphic? Is this possible?
Only by a trivial amount, assuming you’re not rendering the tiled background with a bunch of pixel lights or something. That would have been my answer too…can’t think of a better way offhand.
My brain is pretty fried right about now so excuse me if this is a stupid question:
I can use a GUItexture with that background camera and leave the camera’s view otherwise empty, right? Then I can design a simple graphic that doesn’t look too crappy if it’s scaled out of proportion. Hmmm… I’ve got to think about that more…
Yeppers. I’m not sure that’s the best solution, though…your graphic will have to be really high-res or else it’ll look bitmapped, which is sort of a waste of VRAM. Whereas you can just use a small texture on a plane and tile that as much as you want. You don’t have to use lighting or anything, so I’d suggest throwing a texture on a 2-triangle plane. The speed difference between that and a GUITexture must be very small or nonexistant.
You could actually keep the proportions the same with a bit of scripting (which I use to keep my scaled GUITextures looking the same on both 4:3 and 16:9 displays). But if you go with a tiled texture, you don’t have to worry about it.
Thanks Eric. Good points about stretching a GUItexture vs. a 2 poly plane. In fact your suggestion gives mes a couple cool ideas…
Yup, I’ve been playing with probably the same bits of code you’re talking about. 3 out of 4 windows in this game I really want to keep at exactly the same aspect ratio no matter what screen it’s displayed on. I could just force the user to use a pre-set number of screen resolutions, but I’d rather see if I can do it this way instead. Plus the coding practice is good for me
I may be somewhat lame at shader writing, but I don’t think it gets much simpler or faster than that. I used this shader a while ago for something else, and when I tested it out of curiosity just now I got about 1,000 fps with a totally blank scene, and the same fps with the screen filled using that shader. So I don’t think you have to worry about any slow-down…the overhead for everything else must totally dwarf drawing a couple of polygons that way.
Thanks Eric. Finally got the aspect ratio code to work the way I wanted it to. Now no matter what the screen res is or the aspect ratio, the windows all maintain the same aspect ratio so my guis won’t have any distortion.
Now that I got that working, my image effects "stack won’t work. Argh… Don’t know what I did, but I have 3 effects stacked on a camera and the effect is awesome. Suddenly now it stopped working, as if to punish me or something. I guess I need to learn how to write or re-write shaders now, maybe combine all three into one effect.
That’s it for me until tomorrow. Thanks again for your help!!!