Hard Light Productions Forums

Modding, Mission Design, and Coding => The Scripting Workshop => Topic started by: Nighteyes on February 20, 2012, 10:45:10 am

Title: Script request: Lens flares
Post by: Nighteyes on February 20, 2012, 10:45:10 am
well I always thought this is impossible but apparently a script that generates lens flares is possible, here is a request I made to M!M, he can't work on this but maybe someone else wants to give this a try?

Nighteyes:
Hi there :)
you guessed it, I have another script request, this time its LENS FLARES
I don't know if its even possible, but can a script create a lens flare at a specific point, say a ships engine, it will need to fade and grow in size according to the ships speed, and also act as a lens flare, meaning rendering on top of everything unless something is obscuring it(like how suns work)
let me know what you think, this can also be great for weapon impacts as well as capships explosions

M!M:
Hello Nighteyes,
Theoretically it would be possible but it would be very ineffective as you have to do a ray check for every ship and every ship engine meaning that you would need to do n * m (n: number of objects, m: number of thrusters) which will decrease FPS to an unplayable point. A better way would be to determine the position of the thruster on the screen, read the z-Value and compare it to the z-Value of the point. That way you have pixel-exact occlusion checking without the overhead of a ray check for every object out there and the flares would render on top of the other ships because you would do this after rendering all other objects. A problem would be that you could only check a thruster which is on the screen so a flare would just disappear when the center of the thruster isn't on the screen anymore.
Sadly, I won't be able to work on this as I'm pretty occupied with RL currently and I rarely find enough time to do something for FreeSpace.

Regards,
m!m

*to my knowledge this is how lens flares work no? only show up when on screen? I'm not sure if its a real problem...
Title: Re: Script request: Lens flares
Post by: m!m on February 20, 2012, 10:55:32 am
It would actually be better to have this as a feature request for the SCP as a script doesn't have the ability to get the z-Value of a given pixel and it isn't able to hook into the rendering pipeline at the point where this would be necessary but these features could be added quite easily. The cause why it would be better to have this as a code solution is that the performance of the operations would be better and the lens flare drawing could take advantage of things like geometry batching to improve performance.
Title: Re: Script request: Lens flares
Post by: mjn.mixael on February 21, 2012, 07:20:30 am
It's been requested a few times, but each time it's been ignored because people don't want FSO to become a JJ Abrams production...
Title: Re: Script request: Lens flares
Post by: Nighteyes on February 21, 2012, 09:24:42 am
lens flares can be done in a way that won't overdo the effect, think Mass Effect for reference.
I think the problem is people think of lens flares as something huge with all the small flares all along the screen, what I'm talking about is only the effect itslef, rendering ontop of everything else and causing a nice color bleed, modders can choose to overdo it or not.

@mjn.mixael: I assume you'r in favor of such a script? you seem to have quite a liking to lens flares :)
Title: Re: Script request: Lens flares
Post by: pecenipicek on February 21, 2012, 11:52:32 am
lens flares can be done in a way that won't overdo the effect, think Mass Effect for reference.
have you played ME2?!? that **** be flarey like hell.
Quote
I think the problem is people think of lens flares as something huge with all the small flares all along the screen, what I'm talking about is only the effect itslef, rendering ontop of everything else and causing a nice color bleed, modders can choose to overdo it or not.
if i remember correctly, nexus 2 preview had ****in lovely lens flares on the thrusters.
Title: Re: Script request: Lens flares
Post by: mjn.mixael on February 21, 2012, 05:06:19 pm
Yes, I am very, very much in favor of getting a more controlled lens flare system. Whether script or code doesn't really matter.. (Would prefer code). I was super annoyed at this thread. (http://www.hard-light.net/forums/index.php?topic=78100.msg1545274#msg1545274)