Sign in to follow this  
Ey-Lord

Burning a texture .

Recommended Posts

Hello everyone ;) I'l thinking of something i wanna do , and i really cant find a smooth way to do it , ill try to explain you that ( with my baaaad english lol ) . I got a background ( non-moving 1024*1024 quad / texture ) . It represent ~ a photo, an old one . I wanna be able to let it burn in reel time . -> At some moment, a flame would appear on the screen, and i wana be able to let the flame burn my texture ., First, it would just do a small hole in the texture, the edge would start to burn a bit . Then the burning will continue , untill the texture is completely gone . While its burning, i wana draw some somke , maybe some lightning due to the fire , and some small *hot* peice a paper ( the texture is an old photo ) flying around . I want something that look reel :) If you got any advice, any link or something, i need mostly anything that could help me to achieve that. Thx

Share this post


Link to post
Share on other sites
Have you thought about using perlin noise, like one would use to create clouds, but instead, using them to create burned areas?

Share this post


Link to post
Share on other sites
I don't have _the_ solution.

But unless you really need it in real time, i.e. while playing / moving around, you could pre-render it in say Maya (Learning Edition is free), 3D Studio Max (GMax is free), Blender (free), or some other modelling tool. They're alot more powerful when it comes to stuff like this, especially with their keyframe'able animations. Then just show the video in your game (or whatever it is).

If it does need to be real-time, like in-game while you're playing, then you could still make the "burning foto" thing in a modelling tool - export it to either a movie file like .avi or animationmap texture. Then render the movie (NeHe has a tutorial on this) on a quad, showing the picture "burning up". Then with your game particle engine you can add smoke and "pieces of paper".

Hope this helps :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Seriema
you could pre-render it in say Maya (Learning Edition is free)


Not unless you feel like providing free advertisement to Alias ;)
Last time I checked, personal learning edition was free, but watermarked all images (and possibly only exports to its own format).

Share this post


Link to post
Share on other sites
Wouldn't it be easier to change the actual texture data? By this, I mean where the photo is meant to be burnt through, make it completely transparent, and the edges around the burns should be completely black, fading into a brown, then into the actual photo colour... Or you could just use a second texture, and modify that, and use a fragment program to modify the outcome, that way the original texture remains intact. ;)

Share this post


Link to post
Share on other sites
First of all, thxs to everyone one for your help .

I should have told you before that i'm working in 2D ONLY ( glortho ) .

-> Daishi : I heard of it before, but i dont really know what it is ... ill check that before answering you :)

-> Seriema : I've not tried yet any 3D editor (mainly because i work in 2D ... ) but i may consider this ( if what i wanna do isnt to hard to achieve for a "noobie" ) .
Tou also mentionned "particles" ; i havent use that before ; i dont know if it works well in 2D, but its definitly something ill check .thx

-> Gorax , ive been told the same thing , using an alpha mask or something may be an option ( im not familliar with "mask" at all ... ill also look after this ) .

Share this post


Link to post
Share on other sites
Particles are great for 2D, and are often used in 2D games to simulate fire and smoke. Definitely learn about those if you haven't seen them before.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ey-Lord
I got a background ( non-moving 1024*1024 quad / texture ) .

It represent ~ a photo, an old one .

I wanna be able to let it burn in reel time .

Just print the photo, light a match and get a camera ready. SCNR ;)

Share this post


Link to post
Share on other sites
lol @ Fred304 .
Anyway , i think ill try for the omoent to build a particle engine .. seems quite exiting ;)
wish me luck guys ;)

Share this post


Link to post
Share on other sites
I just started my Particles engine .
I read some source of another 2D particle engiine ; i found something weird , the speed vector is just calculated once for each particle , if im right, it means that every particles are going along a strait ligne, isnt it ?

I dont know, maybe its common, and the fact that u got XXXX particles on the screen at the same time helps to hide the straight lines ....
what do u think ? is that normal ?

Share this post


Link to post
Share on other sites
It's OK to use the speed once. If you want something like rain =P

I would recommend setting a starting speed. Then have a constant float for "damping" (simulating air friction) and a constant float for gravity.

newSpeed = currentSpeed*damping + gravity*timeSinceLastUpdate;

I prefer to call timeSinceLastUpdate for deltaTime...

The next step would be to get a linear transition of arbitrary values. It's really easy to make and can be used for colors etc.

This should give you some ideas to start of with.

edit: Forgot to mention the example values. Damping should be between 0 and 1, where you invert what you want. I.e. 0 is full damping and 1 is no damping. timeSinceLastUpdate should be from 0 and up, counting in seconds. currentSpeed and gravity are both vectors signifiying a direction with a length (non-normalized). I.e. speed = directionVector * speedScalar

Share this post


Link to post
Share on other sites
ok, here's my two cents. and i wouldn't expect phenominal performance on this effect. have a 2D array represnting the alpha values and the RGB values of the photo texture.

Step 1: Initialize

for the first frame, randomly set a few spots on the array to 0, place in a texture and draw.

Step 2:

for each consecutive frame, loop through the array. if an element has a neighbor with a 0 alpha, set it to 0 as well. this will cause wholes in the texture to grow. btw: only check elements in one direction, this makes the wholes spread upward if you do it down on a 2D array.

Step 3: Adding the burn marks.
Loop through the array again. If a neighboring element has a value of 0.0, set RGB quad to red. This will cause red rings to form around the wholes and with some coaxing will appear like a cigarette burn affect.

ok, this is totally pulled out of my ass, let me know if you do it.


Share this post


Link to post
Share on other sites
just a quick note, i was thinking direction not speed...but i wrote speed T_T, i agree with your speed method, i was more worried about the fixed direction .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this