- Home /
Dynamically changing part of a texture v2
After my massive success at getting my question answered really well really quickly - I have another, related question (original post for context - http://answers.unity3d.com/questions/283845/dynamically-changing-part-of-a-texture.html#answer-283848). In that question I asked if I could put a static colour (in that case, purple) over another, and have it work like a torch - getting closer decreases the size, and further away increases it.
I now have a far more ambitious idea. How can I use this torch to show something completely different to the background it is on? - not like putting a colour over the top of it, but rather a different scene.
I'll try to explain with a terrible image.
http://img826.imageshack.us/img826/8356/badexample.jpg - The wall acts as the 'normal' view, and the circle is where the beam of the torch touches the wall - where it touches displays another image (in this case the party scene inside).
I have the wall as the background/normal image. Flash it with the 'magic torch' and it suddenly shows a completely different image 'underneath', in the exact shape of the where the torch 'touches' the wall. Bigger further away, and smaller closer up. It also needs to work with different angles and all that jazz.
I eventually want to do this with objects too, changing them on 'torch' hit but atm, I'm contented with showing a different image underneath.
Thanks in advance, you lovely, lovely people. Sorry for being rubbish -Ollie
P.S Sorry for the terrible picture, again.
Answer by ScroodgeM · Jul 14, 2012 at 11:20 AM
simply u can draw a background (partyscene) first (below), and then draw a wall second (at front). to make a wall transparent you can use shader like this
shader with transparent lit area
use a simple light to make wall transparent in area and size you need, under the transparent (lighted) wall you'll see another picture.
perfectly to use shader with image replacement depending on lights 8) but this shader you need find or write.
Your answer
Follow this Question
Related Questions
Dynamically Changing the texture of an object 1 Answer
Dynamically changing _part_ of a texture 2 Answers
Character Interface Change (Help) 0 Answers
Dynamic Material & Textures 1 Answer
Dynamically loading textures to avoid memory problems 1 Answer