Steam or fog drawing effect: Unity or Other?

Hello, I’m creating an iphone game that uses an effect similar to the steam drawing effect in iSteam (or ifog,etc). I hadn’t been considering Unity iphone to be honest, but with 1.5 I’m thinking… maybe. Based on peoples’ experiences, would this be possible? In Basic or would we need Advanced? Or should I be looking at something else entirely… I’m more comfortable with Unity, so if it was feasible, I’d like to try to make it happen. I’m not interested in the blow-to-fog effect, just the drawing.

I think this should be fairly easy in Unity. The Texture2D class has methods to alter a texture at runtime. You would probably start with a plane covered with a semi-transparent steam texture. You could then get the finger strokes and fully erase the texture in places where the finger passes.

I’m with you up until this part, but can’t quite determine how I would erase pixels. Do I (can I) set the pixel transparency? Do I need to mask the pixels? Or is there a way just to delete them?

on the iPhone changing Texture content in realtime is more or less unusable- the performance hit is way to big …

Is this the case with the updates to the Advanced version as well?

seems like a fun little project. It should be possible in Unity. I would use a GUITexture and set it to be loaded into memory using the “Enable GET/SetPixel” in the asset import settings.

I bet it would run fine.

It’s a hardware issue, nothing to do with Unity.

You’d need a 512x512 texture for full-screen 1:1 pixel mapping, which doesn’t run fine on many desktops, never mind the iPhone, where using the term “slideshow” would be pretty much literal.

–Eric

Well, it can’t be a hardware issue-- I’ve seen versions of fog and steam drawing for the iPhone made in a number of things, including, gasp, Flash. But I get what you’re saying-- essentially, the way you’d have to do this in Unity would cause a deal-breaking slowdown.

It is a hardware issue…putting a bitmap on the screen is quite a bit different than uploading a texture to the GPU every frame, which is slow because of, you know, the hardware. :slight_smile: If there was sufficient bandwidth in that department, then it would be quite feasible in Unity, but there isn’t.

–Eric

What about using a whole bunch of super tiny textures instead? I’m thinking a pixel-by-pixel overlay. You’d take a big hit on the load time, but would reduce the real-time texture swapping…

Actually I did think of that; the big problem there is that you then have so many draw calls, you’re back into slideshow territory again. If you went with a grid of 32x32 textures, you’ve got 15x10 objects = no go. And pixel-by-pixel = 153,600 objects…I think the device would implode. :wink:

So unfortunately, Unity isn’t really suited for apps like this.

–Eric

How about a trail renderer using this kind of material? You render the background with a camera with a depth lower than the steam layer. The shader “cuts away” whatever is rendered by the camera on top.

I’ve actually never used a trail renderer, so it’s just conjecture on my part. But if that’s not the answer, you could at least build a strip of triangles.

I have not tried it with a 512x512 grid but i have done it with a 100x100 grid…
firstly i think the texture painting method is the correct way and i think it could be done on the iphone.
regardless… another idea would be to make a piece of geo with a grid… or maybe 25 - 100x100 grids… 5x5 to make up the 512 instead of one giant one. then you could change the vertex color at that location which would have the same effect of painting pixels.

I am doing something like this right now and it works in real time on my smaller grid. I have a grid which i am changing the location of verts and the vertex color in realtime on the iphone. the biggest problem with this method is that the host ram is chewed up and it causes a garbage collection every 5 seconds or so. because the GC is so often you dont notice it while playing but it is taking about 5ms of my perf because of that.

worth a try if you cant get the texture method to work out.

if perf is bad but runable you could always let the perf be bad but record the history of the persons finger movement so that it finishes at its own pace even though the person is done sooner.

Yeah, perhaps what I could do is just get the finger path, and put it in some sort of mask once each gesture is done (say, when they stop), rather than in real time. Now the only question is how that works with the game idea overall…

What about this idea?

Have two planes. One with the background image, the other with the steamed image.

Morph the mesh of the steamed image, where the users fingers touch, so that part of the mesh is pushed/moved behind (below) the background image plane.

I’m having a hard time explaining it, so I created this image to illustrate the idea…

207103--7632--$idea_365.png

Worth an experiment, I think…