PDA

View Full Version : Smart/Automatic blur interpolation scritp...


loocas
08-23-2004, 04:26 AM
Hi there guys, I'm here again with a plea, again :)

but, I'm a very rook programmer and this is a bit too much for me, but I really need a script, which would intelligently, and mainly automaticly, interpolate two bitmaps between each other, here's what I need,

those who played DOOM III will know immediately: I need to create a spotlight, in an animation, and I will use a projection map to simulate the nice spotlight edges and stuff, but as long as it is in the animation, I can't use area shadows to calculate blurriness of the projector map based on the distance of a surface it hits. So, I was thinking of creating a script, that would interpolate two bitmaps (one nicely sharp/crisp and the other, guess, blurred a lot) based on the distance of the surface it lits, or based on attenuation distances, for example when the surface is close to NEAR atten. it renders nicely crisp projector map of the light, when it's close or farther from FAR atten. it renders, obviously, the blurry p. map of the light. Now, it would be pretty simple to do this effect for a still image, I'd just use whatever is visible etc... and for a simple animation, which doesn't need to look very realistic, it wouldn't be a problem, I'd just use a one projector map, and that'd be it. But I want the spotlight to look very realistic, including the blurriness. So, if anyone knows about an already existing script/utility whatever, let me please know, or if it doesn't exist yet, give me some hints/tips to be able to write the script, I'm a really bad programmer, so, go easy on me pls. :thumbsup:

And most of all, I need this script to work with finalRender stage-1 sp2b! so the more universal it will be, the better.

Thanks and cheers...

Arnage
08-23-2004, 10:35 PM
Either i don't completly understand your question or it's quite easy without scripting. Is this the effect you're looking for? (I got inspired so i made this little test animation)

http://www.student.io.tudelft.nl/io1178512/spotlight.avi

If that is what you're trying to achieve then it can be done really simple by using multiple spotlights and attenuation. for example: give the sharp spot far attenuation values of 50 and 100 and the blurred one near attenuation values of 50 and 100. To make the transition extra smooth i'd recommend using three spots though, with one extra spot in between the sharp and blurred ones that is less blurry and has both far and near attenuation on.

This should work with all rendering systems and works with fR for sure (the above animation is rendered in it :))

If you want i can post the .max file for this test scene.

loocas
08-24-2004, 02:48 AM
To Arnage: Hey mate, thanks for posting your tip! Quite cool solution! And, yeah, you've got it right what I want, but, I'd like to achieve such effect with only one spot/direct light. Now, I've been toying with various things in mat editor etc... and there's a feature that lets you blur the image you have loaded. So, I was thinking of creating an expression, which would blur the single image based on distance from the light. So, if the wall, or whatever, was 50 units far from the spot, it'd blur the image, lets say, by 20%, if it was farther, it'd blur it more and vice versa... So, does anyone know how such an expression formula should look like? Well, if it's possible ofcourse.

If not, then I'll go for the multi-light solution...

Thanks again Arnage, it's really helpful and working solution :thumbsup: :bounce: :applause:

Arnage
08-24-2004, 11:14 PM
Interesting idea but how do you plan to make that work with a spot that hits an object 50 units away and the wall befind it that's 100 units away. The blur value for the texture can't be used on a per pixel basis, right? So if you would calculate the distance in one place and that place moves from the object to the wall behind it it would 'pop' to a different blur value which would be quite wierd.

It might be possible some way with a script but i think it would be quite complicated to get it working right. (And I don't have a clue how to make such a script :rolleyes: )

Just wondering why would you want it to be just one light? Linking them together makes animating them not a problem and sure, multiple lights is a bit slower then one, but a blurring script will probably slow the rendering down too...

loocas
08-25-2004, 03:09 AM
Well, yeah, you're probably right mate.... I just wanted to have it as one light only = less complicated setup + less lights obviously :) And maybe there's no other way of doing it except for the cheat you showed me yesterday. So, I'll probably go for the "cheat" :thumbsup: so, thanks again a lot mate and cheers...

The script idea was this: I wanted to write/get a script, that calculates a distance between the light source and the surfaces it lits or, simpler scenario, it takes the distance from the light source and the FAR END ATTEN. gizmo and calculates the blurriness based on that, so it'd work as a sorta volume light, so the light cone has a virtual volume in which the projection map is blurred based on the variables above etc... well... it has to be possible, but I see it's a bit too difficult, so I'll go for the set of spotlights. So yeah, thanks again!!

CGTalk Moderation
01-19-2006, 01:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.