- Home /
Using two fullscreen Graphics.DrawTexture images, overlapping?
I am using two textures, one for terrain, one for the sky, and I want the sky behind the terrain... and I googled this pretty hard before coming here, but I am finding little help in this department...
I tried having a regular unity standard skybox, but the graphics.drawtexture for the terrain seems to not show the skybox behind it (even though some pixels are 0 alpha...it is just black on those pixels? that bugged me, but ultimately I want two "pixelated" textures rather than a whole skybox, so dont worry about that)
I also tried two cameras, main with its script drawing "terrain" with transparent upper half, secondary with its script drawing "sky" texture2d, but changing depth makes no difference... the sky texture seems to always appear on top regardless of which had higher depth.
Is it possible to draw two seperate graphics.drawtexture's with one of them "on top of" the other graphics.drawtexture?
if not, I suppose it would be possible to combine the images, but would have to be constantly updated with terrain being broken up, so a comparison of two pixels arrays which then combine, after iterating through every pixel, every frame... it just sounds like bad news... two seperate textures are sorta what I require...
Im a bit confused. Are you doing this via code? I.e, are you using the Graphics.DrawTextures? Why not do this without code, directly using cameras and modifying the clear-colour and render-order?
well you can visit my forum topic here:
http://forum.unity3d.com/threads/198919-Destructible-Pixel-Terrain-Open-Source
and see the project this problem pertains to. I found a solution I think, but I have to test more to see if it will work - I had my texture settings messed up maybe, because setting format to RGBA 32 bit (rather than previous automatic truecolor) allows me to see a regular skybox in the back, so in that case I should be able to do the multiple camera method...maybe... havent had time to check this problem because I been so busy squashing other problems with this project haha
Answer by fherbst · Sep 08, 2013 at 08:08 AM
I would just create two camera-aligned quads with different textures.
I would prefer using two cameras. I dislike having stuff in my scene when they are only meant to be background...
I might end up doing something similar to this, see my comment above ^
I sort of found my solution - but not exactly like I expected to... I ended up drawing the terrain with the main camera and Graphics.DrawTexture, however the sky is drawn on another camera, as a GUITexture... but with the right settings on the image for DrawTexture, it does show transparency, and you can see the background behind... so I will accept your answer felix.
Your answer
Follow this Question
Related Questions
How do I blend a transparent texture with an opaque one? 2 Answers
Fading in/out SVGs without showing the half-transparent SVG-layers 1 Answer
Render part of object with alpha of other object 1 Answer
Unity 4.6 and Grabpass fails 1 Answer
How to make transparent only colliding part of object? 0 Answers