Exe w/ Animated Meshes, MuzzleFlash+Moving Guns,&Detail

Talk among developers, and propose and discuss general development planning/tackling/etc... feature in this forum.
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Exe w/ Animated Meshes, MuzzleFlash+Moving Guns,&Detail

Post by hellcatv »

Ace123 uploaded a binary with all the features people have been requesting...
http://vegastrike.sourceforge.net/users/ace123
so let me list them for you:
a) I have now enabled detail textures that fade in slowly as you get close...
the way to enable these is to make a mesh with the following tagline:

<Mesh texture="combine4.bmp" texture1="combinePPL.jpg" detailTexture="grid.png" scale="30">
<DetailPlane x=".02" y=".02" z="0"/>
<DetailPlane x="0" y=".02" z=".02"/>
<Points>
... ... ...
</Mesh>

So let me explain what this means
First of all--the detail textures are applied through multitexturing--so they no speed hit for cards with multiple pipelines (anything decent these days) The other thigns require passes because simply they cannot just add up--they need to multiply with each other--so the speed hit from detailTexture is limited and will be able to be turned off easily.
Secondly... the DetailPlane... what is this?
ok well given that I can't expect everyone to edit all the models and retexture them with insane detailed detail textures--we have to pick a formula to apply the texture on the model so that it will look decent. these numbers were the first numbers I tried on the star fortress-and lo and behold it looks snazzy...
let me go into a bit of detail about how these planes work :-)
first of all notice .02 ... that's how BIG the detail textures are... the smaller the number the bigger the detail texture and the earlier it will appear to the user. right now we're saying that the texture is 1/.02 or 50 units long. for a star fortress that's pretty small.
ok so why specify 2 and what are the x,y,z
well each detailtexture you wish to apply needs 2 DetailPlanes .
if you specify 4 then your starbase will have 2 layers of the detailTexture you chose.
the formula is.
the horizontal coordinate of the texture is determined by the first DetailPlane. It's the pointx*x+pointy*y+pointz*z where the point is the point of the polygon being textured
same for the vertical coordinate--but the second DetailPlane....
basically choose the magnification first...
then choose the most important plane of your ship...if your ship is a flying sauser with a huge xz plane then have your detail planes instead:
<DetailPlane x=".02" y="0" z=".02"/>
<DetailPlane x="0" y=".02" z=".02"/>
so that the xz plane is emphasized :-) make sense?
and change .02 to whatever you think the player will be seing when he/she's clsoe


the last two config variables you'll need to worry about are:
"graphics","detail_texture_blankout","3"
"graphics","detail_texture_full_color","1"
if you want the detail texture to stay at full intensity for longer make 1 a higher number
if you want it to black out faster make 3 a higher number :-)
these are in vegastrike.config :-)


Now we move to animated meshes...
this will sound similar to LODs because I use the same code :-) w00t

<Mesh ... ... >
.....
</Polygons>
<Logo>
...
</Logo>
<Material ...>
...
</Material>
<LOD meshfile="secondframe.xmesh" framespersecond="5" size="1"/>
<LOD meshfile="secondframe.xmesh" size="1"/>
<LOD meshfile="secondframe.xmesh" size="1"/>
<LOD meshfile="secondframe.xmesh" size="1"/>
<LOD meshfile="secondframe.xmesh" size="1"/>
</Mesh>


that maeans the animation will run at 5 fps...first using the first mesh then all the meshes listed inside it.

Ok so this is how detail textures and animated meshes work...what about muzzle flash? well that's just an animated mesh put on a gun...just make a file in meshes/weapons/laser.xmesh and meshes/weapons/laser_flare.xmesh
the flare will be your muzzle flare...you need to design that yourself.
first get the laser itself appearing...
unfortunately the meshes do need to be modified to have visible weapons
you need to make the weapons 1 unit long...
then modify the
<Mount size="....".. ... ... xyscale="5" zscale="10"/>
that will make the gun stick out 5 wide and 10 long :-) on your particular mount...each mount can have a different sized weapon.
the weapon will animate when it's being fired (use animation technique above) :-) not before not after.

now the one problem with animations is that LODs and Animations are mutually exclusive--but this is the one way I could accomplish both without slowing the whole (unanimated) engine down :-)

so I hope you enjoy--no one seems to use lods anyway
Last edited by hellcatv on Wed Sep 17, 2003 1:18 am, edited 1 time in total.
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

"graphics","detail_texture_blankout","3"
"graphics","detail_texture_full_color","1"
where is this supposed to go in the config?
peteyg
Elite
Elite
Posts: 1465
Joined: Thu Jan 02, 2003 12:01 pm
Location: Seattle, WA
Contact:

Post by peteyg »

in the regular graphics section.
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

d'oh! should have known that :wink:
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

this isnt working for me, its just crashing VS whenver i try to start it...

my VS config looks like
...
<section name="graphics">
<section name="mesh">
<var name="testvar" value="-4"/>
</section>
<var name="detail_texture_blankout" value="3"/>
<var name="detail_texture_full_color" value="1"/>
<var name="shield_texture" value="shield.bmp"/>
<var name="reflectivity" value=".8"/>
<var name="pan_on_auto" value="false"/>
...
any ideas?
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

it was my bad
I mixed up the width and height when computing mipmaps
so any texture that was passed in would have the wrong data read! whoops!


ace123 updated the exe
download it again after this post :-) it should work dandy
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

Editing the values in the config file seems to do nothing for me. Also, it appears as if the detail textures are always renered and dont fade out.

BTW, what kind of blending are you using? or do the textures have to be partially transparent? It seems like much to white is on screen.
peteyg
Elite
Elite
Posts: 1465
Joined: Thu Jan 02, 2003 12:01 pm
Location: Seattle, WA
Contact:

Post by peteyg »

Dan told me that it's a blend=ONE ONE deal, so more black = more transparency. I had to make the detail textures that came from your package MUCH MUCH MUCH darker before they started to look any good.
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

ok, thats good to hear. can you host the new ones by chance?
peteyg
Elite
Elite
Posts: 1465
Joined: Thu Jan 02, 2003 12:01 pm
Location: Seattle, WA
Contact:

Post by peteyg »

dude!

well, if you REALLY need me to darken all those detail maps for you, I probably could.
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

Somehow i feel like i've just been insulted :?

mainly i was thinking about other people who would want to download the detail textures though.
peteyg
Elite
Elite
Posts: 1465
Joined: Thu Jan 02, 2003 12:01 pm
Location: Seattle, WA
Contact:

Post by peteyg »

dude!! (note: this 'dude!' translates as follows: "Please sir, do not overreact to my good-natured jibe. I value you too much as a person to be so insensitive as to needlessly insult you.")

Anyways, I did it. They may not be all dark enough... but they're going to be a LOT better this way.

http://students.washington.edu/peteyg/b ... l_dark.zip
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

hellcat, would it be possible to make it so that the lighter colors became transparant instead of the darker colors?
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

A new binary has been uploaded with fixes for animated meshes.

Use

Code: Select all

   <LOD ... ... size="X" framespersecond="15" />
   <LOD ... ... size="X" />
...
...
   <LOD ... ... size="X" />
</Mesh>
to take advantage of this new feature.

Also you can make animations get triggered (like transforming) by assigning a key (maybe capital-G) to "ToggleAnimation"
and adding a
NumAnimationStages="X"
attribute in <Description ... /> tag in the unit file.
The X is the number of stages, and it will evenly divide up the animations in the mesh into X parts)

Now you can make something like in spaceballs, where it turns from a big huge long capship into a maid with a vacuum cleaner.
dandandaman
Artisan
Artisan
Posts: 1270
Joined: Fri Jan 03, 2003 3:27 am
Location: Perth, Western Australia
Contact:

Post by dandandaman »

ace123 wrote:A new binary has been uploaded with fixes for animated meshes.

Use

Code: Select all

   <LOD ... ... size="X" framespersecond="15" />
   <LOD ... ... size="X" />
...
...
   <LOD ... ... size="X" />
</Mesh>
to take advantage of this new feature.

Also you can make animations get triggered (like transforming) by assigning a key (maybe capital-G) to "ToggleAnimation"
and adding a
NumAnimationStages="X"
attribute in <Description ... /> tag in the unit file.
The X is the number of stages, and it will evenly divide up the animations in the mesh into X parts)

Now you can make something like in spaceballs, where it turns from a big huge long capship into a maid with a vacuum cleaner.
cool.......is it possible to have both lods and animations though? I would imagine that you could simply do it by saying that "if the framespersecond variable is present, then it's an animation..but if it isn't present, then treat the meshes as LODs"

I think that would allow us to have both? unless it's a deeper internal thing of VS which would need changing to allow both :-/

Dan.a
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

we were only equipped to have either LODs or Animations
cus then each frame would need LODs and you'd have n^2 meshes...

so no it's not possible

basically limit animation to when you need it...not some trivial thing you use on every huge honkin mesh out there to make it wiggle a bit...

it's very deep inside VS...and to keep LODs for each frame would require tons of memory and a different organization.... in the future it may be possible but not recommended.
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
etheral walker
Elite
Elite
Posts: 1516
Joined: Sat May 10, 2003 5:26 pm
Location: into the depths

Post by etheral walker »

ok then, but is there a way to trigger an animation? some of my vorlon ships really needs to deploy themselves. I found a way but putting the animated parts as a weapon, but if I swith to another weapon the mesh come back in its first position.
I see dead polygons....
pincushionman
ISO Party Member
ISO Party Member
Posts: 467
Joined: Mon Jan 13, 2003 9:55 pm
Location: Big, flat Kansas
Contact:

Post by pincushionman »

Anims are per-mesh, correct? So If I just cut off the part that needs animating and make it a separate mesh, I could LOD-ize the rest of the ship?

-pincushionman
Conquer space!
-pincushionman

---------------------------------------

Kansas really is flatter than a pancake!
http://www.improbable.com/airchives/pap ... ansas.html
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

Mr. Horn, I say again, would it be possible to make it so that lighter colors in the detail texture are faded and darker ones are not? otherwise the detail textures i provided will not work right in VS.
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

if you can tell me a blend mode that will do that...I'm really not sure I know of one that will add lighter and subtract darker.... but maybe it exists on video card...sure I could do it with pixel shaders but that's totally overkill and would quarter framerates wahahaa for those cards that support it...

I'll look around a bit... to see if detail textures can subtract...but I just don't know a blendmode that'll do it ....

as for pincushion man ...sure that's correct! it's per mesh--per material...just divide up the ship into the animated parts and the unanimated parts---like guns and rest of ship (guns are handled separately as well anyway)

As for making it have modes... look at ace123's post you can set the number of stopping points are the <Description NumAnimationStages=""/>
then bind a key to
ToggleAnimation
and voilla--you can transform into modes
I'll make the AI do it randomly if you wish :-)
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

jdoom (using doomsday engine) uses the Opengl extension ARB_texture_env_combine.

The rest of my post can be found here: http://vegastrike.sourceforge.net/forum ... =9567#9567 since it has very big images in it.
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

you know what...I found this out myself before you mentioned it :-)

GL_ADD_SIGNED, baby! it works like a charm!
may take some hacking to get a windows build up since windows has ungodly old GL.h files...but I'll get it up before the day is out so you all can have fun
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

and fun i shall have :)
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

same place, different day :-)
http://vegastrike.sourceforge.net/users/ace123

ok so a detail texture of all 128/256 (50% gray) will add NOTHING to your ship.
darker will subtract...lighter will add :-)

happy?

can you give me some detail texture for the new rlaan and aera?
thanks
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
Jadel
Merchant
Merchant
Posts: 59
Joined: Tue Jun 24, 2003 2:19 pm
Location: South Australia

Post by Jadel »

kewl :wink:

Are animations interpolated or only in distinct steps?

edit: I are good speeler.
Post Reply