Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Fry_Day on April 30, 2003, 08:01:36 am
-
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'.
-
I've already reimplemented it, but I've had problems comitting
-
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)
-
Almost done...
On a side note, why does the 'reply' button have the image of the 'post new thread' button? It's confusing.
-
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
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)
// 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
// 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
-
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.
-
interesting.
does this new glowmap function use multitexturing?
-
(mine) basicly yes
-
sweet.
it should be lots faster now
-
Edit: Oops. I was sure you were writing about gr_d3d_tmapper_internal for some reason. Never mind that :)
-
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 :)
-
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
-
Edit: Never Mind
-
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)
-
uh, shouldn't that be a bit problematic, with the OpenGL code currently running with glowmaps?
-
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
-
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.