Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: DaBrain on January 09, 2011, 03:18:06 am

Title: Expose existing functionality
Post by: DaBrain on January 09, 2011, 03:18:06 am
I noticed FSO uses two very useful features, but doesn't allow developers to take advantage of them.
Both are used for 3d shockwaves.

The first one is the animated scaling of meshes and the second one is a fade-out effect.


3d shockwaves can be very efficient effects. If I use a simple sphere mesh with a static, tiling texture, it uses very little memory and thanks to the mentioned features it can still look fine.

Many simple effects could be done this way and I would prefer it over the expensive frame animations we currently use.

Title: Re: Expose existing functionality
Post by: Bobboau on January 09, 2011, 03:31:22 am
in what way is this not now exposed?
Title: Re: Expose existing functionality
Post by: DaBrain on January 09, 2011, 03:48:38 am
Well, lets say I want it for the glow particles in the "flashy deaths" script, or really just for any other effect. How do I do that?
Title: Re: Expose existing functionality
Post by: Nighteyes on January 09, 2011, 01:59:21 pm
all I can say is don't get you'r hopes up about this "feature", there was a time where I was doing extensive testing with different mesh types, and the engine can't handle shockwaves with "complex" meshs, what I tested was 2 things:
1. I took the normal shockwave mesh(a cylinder) and duplicated it a few times(i think it was 6), and rotated them to be on the same axis but so it will form a sphere of sort, this didn't work at all, the shockwave didn't render.
2. I took 3 planes, put them in a X shape, this method worked but produced a few strange effects, such as looping animations, not scaling properly, rendering only when it wanted to and such.

so all in all, I'm surprised the 3D shockwaves work as well as they do, but for sure something in the code there isn't working properly.
Title: Re: Expose existing functionality
Post by: Nighteyes on January 09, 2011, 02:02:06 pm
Well, lets say I want it for the glow particles in the "flashy deaths" script, or really just for any other effect. How do I do that?

and to answer this question, if you want to test stuff, you won't be able to do it through the flashy deaths script, but you can test it on weapons, just add a shockwave to a weapon, or even just test it on capships when they die, and adjust the pof of the 3d shockwave(pof file itself as well as glow texture/animation).
Title: Re: Expose existing functionality
Post by: Dragon on January 09, 2011, 05:10:30 pm
Somewhere, there was a spherical shockwave model, which did worked.
I recall that it was said to look ugly, but if somebody still has it, could he post it?
I'd like to check it out.
Title: Re: Expose existing functionality
Post by: pecenipicek on January 09, 2011, 08:42:20 pm
i believe it was galemp testing it and the reason it was ugly was the fact that it didnt have any apparent "volume" to it. One of the things neccesary for any truly voluminous effects was the use of shaders. Nowadays, its possibly doable, but i wouldnt count on it.



(this was around the time that 3D shockwaves first appeared and there were massive ragefests on visual preference from various people. basically the great 2D vs 3D shockwave debate)
Title: Re: Expose existing functionality
Post by: Bobboau on January 10, 2011, 12:30:04 pm
when 3d shockwaves were first invented I had a sphere model used for testing it, that was the aforementioned spherical shock wave model.
Title: Re: Expose existing functionality
Post by: Dragon on January 10, 2011, 05:35:15 pm
Could you post this, along with some shockwave texture?
I'd like to see how does it looks now.
Title: Re: Expose existing functionality
Post by: DaBrain on January 15, 2011, 06:05:12 pm
Looks like this went a bit off-topic.

I'm not talking about new shockwave effects. I just want to be able to use the two mentioned features for other effects.

FS2 and FSO(-based games) use frames for almost all effects, while modern games only use them in some special cases.


If you can time it right the scaling and fade-out can be pretty efficient techniques.

Haegemonia is a good example. They use frame animations for the smaller exposions, but only single frames for the bigger ones and scale them up and fade them out.
They often cover it up with big flares, which work the same way.

http://www.youtube.com/watch?v=wQhrYm6UB5w#t=3m05s
Title: Re: Expose existing functionality
Post by: Tomo on January 16, 2011, 04:47:13 am
I'd say that you should probably wait for the new materials system - I think The_E is working on that.

That is intended to allow you to use any shader you like on any item you can currently apply a discrete texture to, with custom data (eg size scalers) that can be set by to Lua, so you can have a shader that scales an arbitrary mesh according to values set by Lua.

Vertex shaders can do very fast transformation of geometry. (Not collideable of course, but doesn't sound like you need that.)
Title: Re: Expose existing functionality
Post by: DaBrain on January 16, 2011, 03:38:23 pm
Right, I know about the material system, but I recall asking The E about scaling via vertex shader and afaik he said "no".

Of course you can use the mapping coordinates for a scaling effect, but that's not easy to use and your mesh/particle needs to be at 100% of the size all the time... (-> fillrate)
Title: Re: Expose existing functionality
Post by: Zacam on January 16, 2011, 10:24:41 pm

Geometry Transformation via Vertex is possible. Caveat: You're not going to see any SM (Shader Model) 2.0 cards doing it.

And if a developer can't test a feature or a function, they're not going to create towards it, so I think in this "no" means "It might be on the list, but not in the current iteration as it is being worked on as somebody else will have to do it".

I could be wrong though.
Title: Re: Expose existing functionality
Post by: Tomo on January 17, 2011, 02:28:14 pm
Not quite, Zacam.

SM2 cards are able to handle a simple scaled transform - after all, the basic vertex shader is doing a transform into screen space anyway, and it's only a slight variant of that.
If the deformation of the entire model can be described by a small number of values, eg "scale vertex position in model space X by some_value, then transform to screen space", then that is fine.

However, more complex transformations eg using (animated?) textures to define the deformation may well require newer cards, which not everyone has access to.

So it depends what you want to do.
Blowing up a mesh like a balloon in any combination of model X, Y and/or Z is pretty easy, as this can be described by a single variable and a constant transformation matrix.
- Multiply one by the other, transform (effect), transform (screen).

More complex stuff on the other hand - you'll hit the limits of older cards pretty quickly.