Author Topic: Glowmaps  (Read 2750 times)

0 Members and 1 Guest are viewing this topic.

Offline Fry_Day

  • 28
Uh, I couldn't find any D3D glowmap rendering code, except Bobbau's commented code (as in, all encased in a comment) in d3d_tmapper_internal. If you have nothing to say, I'll move on to implement it with multitexturing. I'm implementing it assuming that color ops are identical to alpha ops, and that color arg of stages past the first one are always 'Current'.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I've already reimplemented it, but I've had problems comitting
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 Fry_Day

  • 28
Agh! So much more complex than the OpenGL implementation, since in OpenGL the TMUs are completely independant, yet they are not in Direct3D, which means I had to make a new FVF, and modify plenty of helper functions (render-state changing, mostly, but a bit about texture loading)

 

Offline Fry_Day

  • 28
Almost done...

On a side note, why does the 'reply' button have the image of the 'post new thread' button? It's confusing.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
you didn't need to make a new FVF!
all you needed to do was set some sexture stages,
in d3d_tcache_set
I set it to recersivly call itself to set the glow map to stage 1
this goes at the top
Code: [Select]
if(bitmap_id != GLOWMAP){
d3d_SetTexture(1, NULL);
d3d_SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
}
//turn off glowmapping right away, if it's needed turn it back on later

this is the bottom (modified from origonal)
Code: [Select]
// everything went ok
if(ret_val)
{
*u_scale = t->u_scale;
*v_scale = t->v_scale;

if(bitmap_id != GLOWMAP){
d3d_SetTexture(0, t->d3d8_thandle);
}else if(GLOWMAP > 0){
d3d_SetTexture(1, t->d3d8_thandle);
d3d_SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_ADD);
}
//glowmapping stuff-Bobboau

D3D_last_bitmap_id = t->bitmap_id;
D3D_last_bitmap_type = bitmap_type;
D3D_last_section_x = sx;
D3D_last_section_y = sy;

t->used_this_frame++;
}
// gah
else {
return 0;
    }

//glowmapping stuff-Bobboau
if(GLOWMAP > 0){
d3d_tcache_set(GLOWMAP, bitmap_type, u_scale, v_scale, fail_on_full, sx, sy, force);
}


this function needs to be modifyed as showen
Code: [Select]
// This function calls these render state one when the device is initialised and when the device is lost.
void d3d_set_initial_render_state()
{
d3d_SetRenderState(D3DRS_DITHERENABLE, TRUE );

d3d_SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
d3d_SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );

d3d_SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD );
d3d_SetRenderState(D3DRS_SPECULARENABLE, FALSE );

// Turn lighting off here, its on by default!
d3d_SetRenderState(D3DRS_LIGHTING , FALSE);

//new glowmapping code,yay!!!-Bobboau
d3d_SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_CURRENT);
d3d_SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_TEXTURE);

d3d_SetTexture(1, NULL);
d3d_SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_SELECTARG1);

d3d_SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 0);
}


other than that the code for loading the glow maps ect... has been done for ages
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 WMCoolmon

  • Purveyor of space crack
  • 213
Quote
On a side note, why does the 'reply' button have the image of the 'post new thread' button? It's confusing.

:lol: No one's noticed it, probably.
-C

 

Offline phreak

  • Gun Phreak
  • 211
  • -1
interesting.

does this new glowmap function use multitexturing?
Offically approved by Ebola Virus Man :wtf:
phreakscp - gtalk
phreak317#7583 - discord

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
(mine) basicly yes
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
sweet.

it should be lots faster now
Offically approved by Ebola Virus Man :wtf:
phreakscp - gtalk
phreak317#7583 - discord

 

Offline Fry_Day

  • 28
Edit: Oops. I was sure you were writing about gr_d3d_tmapper_internal for some reason. Never mind that :)
« Last Edit: May 01, 2003, 03:21:25 am by 791 »

 

Offline Fry_Day

  • 28
Well, Your solution is about as hard-coded as it gets, but whatever. I've been having continous problems of FS rendering  only the glowmap, so I'll concede :)

 

Offline Fry_Day

  • 28
Well, even your code renders only glowmaps for me. I'll do a clean build, and if the problem perseveres, I'll look into it.

Edit: Even with a clean CVS with just those modifications, it still renders only the glowmaps. cause: I have no idea
« Last Edit: May 01, 2003, 05:01:03 am by 791 »

 

Offline Fry_Day

  • 28
Edit: Never Mind
« Last Edit: May 01, 2003, 08:35:27 am by 791 »

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
the current CVS repository has absolutly no code for the glow mapping (ie the code for loading and storing the maps) so untill I get my code back in it's not going to work, and I likly won't have the time ti mess with it for another three weeks (school)
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 Fry_Day

  • 28
uh, shouldn't that be a bit problematic, with the OpenGL code currently running with glowmaps?

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
well the way it was set up if the glow map code is still in the OGL draw_poly function then it should just never run through the glow map code (as the global GLOWMAP is never changed from it's default value), however if the code for OGL was never changed then I find it odd that it would compile at all
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 Fry_Day

  • 28
The code for OGL glowmapping is really simple. In gr_ogl_tmapper_internal, it checks if GLOWMAP>0. If so, it activates the second texture unit, loads the glowmap for it, sets it up for an add-blend, and passes the same texture coordinates as for the regular texture-map. I find that a worse approach than to set up glow-mapping at texture-load, but it's really simple code.