Author Topic: idea for trail rendering  (Read 14390 times)

0 Members and 1 Guest are viewing this topic.

Offline Carl

  • Render artist
  • 211
    • http://www.3dap.com/hlp/
idea for trail rendering (10% performance increase)
it does that in vanilla FS2.
"Gunnery control, fry that ****er!" - nuclear1

 

Offline Solatar

  • 211
idea for trail rendering (10% performance increase)
It crashes for me whenever I go to the tech room.

P4 1.8Ghz
1024mb RAM
ATI Radeon 9000 Pro 128mb
windows XP

 
idea for trail rendering (10% performance increase)
Those trails along with the other ones. Hmm good to be able to choose, although with 10% increase in FPS, I think we have a winner.
If you want to be ready for Wing Commander Saga: The Darkest Dawn, then download and play the prologue first.

Here,

http://www.wcsaga.com/downloads/files/download/releases-prologue-setup-exe.html

Then, while waiting for the Darkest dawn, Download Starshatter 4.02

http://www.starshattermods.com/infusions/pro_download_panel/download.php?did=214

You 'll understand why once you have.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
idea for trail rendering (10% performance increase)
Solatar
A) are you useing the -htl comand line option
B) what was the last build that worked for you

and becase I did a little experement that failed miserably I'm going to post the change to the trail rendering function so I can copy and paste it into a fresh copy

Code: [Select]

void trail_render( trail * trailp )
{
TIMERBAR_PUSH(6);
gr_set_lighting(false,false);//this shouldn't need to be here but it does need to be here, WHY!!!!!!!?-Bobboau
trail_info *ti;

if ( trailp->tail == trailp->head ) return;

ti = &trailp->info;

vector topv, botv, *fvec, last_pos, tmp_fvec;
vertex  top, bot;

int sections[NUM_TRAIL_SECTIONS];
int num_sections = 0;

int n = trailp->tail;

// if this trail is on the player ship, and he's in any padlock view except rear view, don't draw
if((Player_ship != NULL) && trail_is_on_ship(trailp - Trails, Player_ship) && (Viewer_mode & (VM_PADLOCK_UP | VM_PADLOCK_LEFT | VM_PADLOCK_RIGHT)) ){
return;
}

do {
n--;
if ( n < 0 ) n = NUM_TRAIL_SECTIONS-1;


if ( trailp->val[n] > 1.0f ) {
break;
}

sections[num_sections++] = n;

} while ( n != trailp->head );

int i;

vertex *vlist[MAX_TRAIL_POLYS];
vertex v_list[MAX_TRAIL_POLYS];
int nv = 0;

for (i=0; i {

if(nv>MAX_TRAIL_POLYS-3)Error( LOCATION, "too many verts in trail render\n" );

n = sections[i];

float w;
ubyte l;

w = trailp->val[n]*(ti->w_end - ti->w_start) + ti->w_start;
l = (ubyte)fl2i((trailp->val[n]*(ti->a_end - ti->a_start) + ti->a_start)*255.0f);

vector pos;

pos = trailp->pos[n];

if ( i == 0 ) {
//fvec =
//&objp->orient.fvec;
if ( num_sections > 1 ) {

vm_vec_sub(&tmp_fvec, &pos, &trailp->pos[sections[i+1]] );
vm_vec_normalize_safe(&tmp_fvec);
fvec = &tmp_fvec;

} else {
fvec = &tmp_fvec;
fvec->xyz.x = 0.0f;
fvec->xyz.y = 0.0f;
fvec->xyz.z = 1.0f;
}
} else {
vm_vec_sub(&tmp_fvec, &last_pos, &pos );
vm_vec_normalize_safe(&tmp_fvec);
fvec = &tmp_fvec;
}

trail_calc_facing_pts( &topv, &botv, fvec, &pos, w );

if(!Cmdline_nohtl){
g3_transfer_vertex( &top, &topv );
g3_transfer_vertex( &bot, &botv );
}else{
g3_rotate_vertex( &top, &topv );
g3_rotate_vertex( &bot, &botv );
}
top.a = bot.a = l;

if ( i > 0 ) {

if ( i == num_sections-1 ) {
// Last one...
vector centerv;
vm_vec_avg( ¢erv, &topv, &botv );
if(!Cmdline_nohtl){
g3_transfer_vertex( &v_list[nv+2], ¢erv );
}else{
g3_rotate_vertex( &v_list[nv+2], ¢erv );
}
v_list[nv].a = l;

vlist[nv] = &v_list[nv];
vlist[nv]->u = float(i);  vlist[nv]->v = 1.0f;
vlist[nv]->r=vlist[nv]->g=vlist[nv]->b=l; vlist[nv]->spec_r=vlist[nv]->spec_g=vlist[nv]->spec_b=0;;
nv++;
vlist[nv] = &v_list[nv];
vlist[nv]->u = float(i);  vlist[nv]->v = 0.0f;
vlist[nv]->r=vlist[nv]->g=vlist[nv]->b=l; vlist[nv]->spec_r=vlist[nv]->spec_g=vlist[nv]->spec_b=0;
nv++;
vlist[nv] = &v_list[nv];
vlist[nv]->u = float(i+1);  vlist[nv]->v = 0.5f;
vlist[nv]->r=vlist[nv]->g=vlist[nv]->b=0; vlist[nv]->spec_r=vlist[nv]->spec_g=vlist[nv]->spec_b=0;
nv++;



} else {

vlist[nv] = &v_list[nv];
vlist[nv]->u = float(i);  vlist[nv]->v = 1.0f;
vlist[nv]->r=vlist[nv]->g=vlist[nv]->b=l; vlist[nv]->spec_r=vlist[nv]->spec_g=vlist[nv]->spec_b=0;
nv++;
vlist[nv] = &v_list[nv];
vlist[nv]->u = float(i);  vlist[nv]->v = 0.0f;
vlist[nv]->r=vlist[nv]->g=vlist[nv]->b=l; vlist[nv]->spec_r=vlist[nv]->spec_g=vlist[nv]->spec_b=0;
nv++;

}
}


last_pos = pos;
v_list[nv] = top;
v_list[nv+1] = bot;
}
if(!nv)return;
if(nv<3)Error( LOCATION, "too few verts in trail render\n" );
if(nv>MAX_TRAIL_POLYS-1)Error( LOCATION, "too many verts in trail render\n" );

gr_set_bitmap(ti->bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
if ( D3D_enabled || OGL_inited ) {
if(Cmdline_nohtl)g3_draw_poly( nv, vlist, TMAP_FLAG_TEXTURED|TMAP_FLAG_ALPHA|TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB | TMAP_FLAG_TRISTRIP );
else g3_draw_poly( nv, vlist, TMAP_FLAG_TEXTURED|TMAP_FLAG_ALPHA|TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB | TMAP_HTL_3D_UNLIT | TMAP_FLAG_TRISTRIP );
} else {
if(Cmdline_nohtl)g3_draw_poly( nv, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_TRISTRIP);
else g3_draw_poly( nv, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_TRISTRIP);
}
TIMERBAR_POP();
}
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
idea for trail rendering (10% performance increase)
Quote
Originally posted by Bobboau
GREAT GHOST OF DOOKIE!! :eek2: :eek: :eek2:
 


lmao, made me chuckle :D

Anyway, looks good, but are the trails supposed to look any different than just drawing closer to the player?
And how is the performance increased (what things are cut out, inserted, etc?)?

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
idea for trail rendering (10% performance increase)
they should look exactly the same, but just render a lot faster, rather than rendering one segment of the trail at a time the whole lot gets sent off in one go, not only that but the pacage they are sent off in is one of the most efecent ways to store polygon data so even there it is getting a boost.

rather than a bunch of trifans
Code: [Select]

 __   __   __
|\ | |\ | |\ |
|_\| |_\| |_\|

it is end out as a tri strip
Code: [Select]

 _________
|\ |\ |\ |
|_\|_\|_\|


as you can see not only are fewer calls made to draw primitive but less is sent with the first one requireing 12 verts and the tristrip version requireing a mear 8, and the diference only gets bigger with larger trails

you wouldn't beleve the number of times I had to edit that to get my ACII art to look right,
and that line was from invader Zim, see thread in gen discus
« Last Edit: November 02, 2003, 10:30:24 pm by 57 »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
idea for trail rendering (10% performance increase)
just notised, it doesn't seem to work outside HT&L, it should work hmm
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline IPAndrews

  • Disgruntled Customer
  • 212
  • This site stole my work
idea for trail rendering (10% performance increase)
Any work to squeeze extra FPS out of the engine by making it slicker and more efficient is worthwhile work. So thanks for your continued effort in this respect Bobboau. Unfortunately I have to report that I've this latest work has resulted in an infinite performance decrease on my system.

The first version of the executable to incorperate HT&L was playable and quite a bit smoother. At least on the rare occasions the system wasn't swapping out due to the huge memory requirements. This latest version however, reliably crashes to desktop as soon as a model is rendered. ie: tech room or mission start. RIP FSOpen. Someone play the death march.
Be warned: This site's admins stole 100s of hours of my work. They will do it to you.

 

Offline Lightspeed

  • Light Years Ahead
  • 212
idea for trail rendering (10% performance increase)
Quote
Originally posted by Bobboau
Lightspeed

ok, multi-player is still WIP and not my responsibility, you shouldn't use it if the master game server isn't on, wich it isn't

can you give me a screen shot of these ghosts, maybe tell me when they seem to show up if you can find a paturn

the locking is probly due to the game loading things, this is a problem that FS has alays had

the thing that renders bitmaps in this build is sort of a hack, it's going to be replaced with something beter and faster eventualy

I think I know why it's crashing


Kakis

that's weird,

and could you get a better pic of that traill bug like up close in high resolution


the ghosts are what kakis posted (the nebula pic) At the end of the trail a fine line points away to some random direction, making funny effects with nebula trails and missiles trails (missile trails will look okay, except for the little line though, whereas nebula trails create that funny effect posted earlier). Note that this doesnt happen always, but sometimes. The locking up did not happen in the last build running without HT&L, so it's gotta be something HT&L specific.
Modern man is the missing link between ape and human being.

 

Offline Lightspeed

  • Light Years Ahead
  • 212
idea for trail rendering (10% performance increase)
oh, and pleeaassee could you slam in an ambient light command line in the next build? :D
Modern man is the missing link between ape and human being.

 

Offline Setekh

  • Jar of Clay
  • 215
    • Hard Light Productions
idea for trail rendering (10% performance increase)
Quote
Originally posted by IPAndrews
The first version of the executable to incorperate HT&L was playable and quite a bit smoother. At least on the rare occasions the system wasn't swapping out due to the huge memory requirements. This latest version however, reliably crashes to desktop as soon as a model is rendered. ie: tech room or mission start. RIP FSOpen. Someone play the death march.


Same report here. Been able to run all the previous SCP builds, just this one that splutters and dies as soon as a model is on-screen.

P3-500, 384MB SDRAM
GF4 MX420, 64MB
- Eddie Kent Woo, Setekh, Steak (of Steaks), AWACS. Seriously, just pick one.
HARD LIGHT PRODUCTIONS, now V3.0. Bringing Modders Together since January 2001.
THE HARD LIGHT ARRAY. Always makes you say wow.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
idea for trail rendering (10% performance increase)
you all are usieing the -thl comand line right?
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline phreak

  • Gun Phreak
  • 211
  • -1
idea for trail rendering (10% performance increase)
i didn't get this yet for opengl non-tnl.  i think there may be some underlying bugs in the setup code

i still need to flesh out a bug or two for tnl stuff.  mainly ships don't rotate in the techroom but the turrets do.  it looks odd.
Offically approved by Ebola Virus Man :wtf:
phreakscp - gtalk
phreak317#7583 - discord

 

Offline Lightspeed

  • Light Years Ahead
  • 212
idea for trail rendering (10% performance increase)
Quote
Originally posted by Bobboau
you all are usieing the -thl comand line right?


-using htl: works fine, except for some minor bugs i stated earlier

-not using htl: crashes when i try entering the tech room (havent tried to actually play a mission, but my guess is that it would crash too)
Modern man is the missing link between ape and human being.

 
idea for trail rendering (10% performance increase)
I tested it and D3D8 seems to run quite nice. I am still impressed by this project though I only test it for some days now :)

I cannot see the jump node but this is a known bug. The framerate is really smooth and mostly I am at around 100fps.

TnL doesn't work with opengl yet I guess?

 

Offline phreak

  • Gun Phreak
  • 211
  • -1
idea for trail rendering (10% performance increase)
its probably not working in bob's trail build.  i have a semi-working version right now.  i just probably squashed another bug in the internal so it should at least be playable  (which is all that im hoping for at this point :D)
Offically approved by Ebola Virus Man :wtf:
phreakscp - gtalk
phreak317#7583 - discord

 

Offline Lightspeed

  • Light Years Ahead
  • 212
idea for trail rendering (10% performance increase)
uhm, i just found out the updated zip crashes me in-game too :(

i'll test some more


-edit-

as it seems it depends on the mission whether it crahes or not.

"A Monster in the Mist" crashes me after 2 seconds in-mission.

I thought that maybe full nebula is screwed but any other nebula mission seems to work fine (i tried it with "the Mystery of the Trinity")

... odd :wtf:

-edit2-

after some more testing i can say its not the fault of HT&L or the new build. I have also tried with the older 32 bit build and get the same crash (only in that specific mission, as it seems)

any idea as to why that mission crashes? anyone had any similar problems? O.o

this is what the errorlog says:

FS2_OPEN caused an Access Violation in module
FS2_OPEN.EXE at 0177:004bfb8e.
Exception handler called in Freespace 2 Main Thread.
Error occurred at 11/3/2003 19:23:20.
C:\GAMES\FREESPACE2\FS2_OPEN.EXE, run by Lightspeed.
1 processor(s), type 586.
511 MBytes physical memory.
Read from location ffffffff caused an access violation.

:(
« Last Edit: November 03, 2003, 12:47:58 pm by 1317 »
Modern man is the missing link between ape and human being.

 

Offline Kakis

  • 24
idea for trail rendering (10% performance increase)
Odd, it worked for me.

Ah...well actually I was going to jump out and was just pressing tab to get away from the shatanas and pressed alt+j to jump...which switched task to this browser window...damn windows hotkeys...:hopping:

When I got back the game had kind of frozen, the nebula effect kept floating but the game stood still...pretty cool actually. :nod:

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
idea for trail rendering (10% performance increase)
Quote
Originally posted by Kakis
When I got back the game had kind of frozen, the nebula effect kept floating but the game stood still...pretty cool actually. :nod:


That reminds me. If I ALT-Tab out of FS2 when I come back the resume/quit box is completely missing.

It's not a big problem but I mention it cause it may be symptomatic of something else :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Lightspeed

  • Light Years Ahead
  • 212
idea for trail rendering (10% performance increase)
Quote
Originally posted by Lightspeed
-edit2-

after some more testing i can say its not the fault of HT&L or the new build. I have also tried with the older 32 bit build and get the same crash (only in that specific mission, as it seems)

any idea as to why that mission crashes? anyone had any similar problems? O.o

this is what the errorlog says:

FS2_OPEN caused an Access Violation in module
FS2_OPEN.EXE at 0177:004bfb8e.
Exception handler called in Freespace 2 Main Thread.
Error occurred at 11/3/2003 19:23:20.
C:\GAMES\FREESPACE2\FS2_OPEN.EXE, run by Lightspeed.
1 processor(s), type 586.
511 MBytes physical memory.
Read from location ffffffff caused an access violation.

:(


The buggiest part about FS2 is my own stupidity. After messing around trying to find out what the hell was wrong with the mission i realized I had a missing file somewhere. Put it back in and the thing works fine :doubt:

:lol:
Modern man is the missing link between ape and human being.