Jump to content
The Dark Mod Forums

Good splash fx in idtech4?


Springheel

Recommended Posts

I've been doing some experimenting, and I've made a few minor improvements, but I'm finding the biggest problem is that the splash stage and the ripple stage don't play well together. When they are both additive blends (which is the default), then they overlap each other into a white mess. When I try using a ripple that doesn't use an additive blend (like Arcturus') then the splashes show the square shape of the ripple particles underneath.

Link to comment
Share on other sites

Hmm, try replacing HeatHaze.vfp with HeatHazeWithMaskAndDepth.vfp looks like the old shader is grabbing foreground objects.

 

(Also needs the _currentDepth keyword)

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Maybe sort orders could disentangle it... maybe. I think I'd have to take a look at an example to work out whether they could be distangled that way. I don't understand the setup or how the bumpmap is combining with the standard heat haze water surface effect.

Link to comment
Share on other sites

Yes, the discoloration that Arcturus mentioned looks exactly like this problem:

 

http://forums.thedarkmod.com/topic/16887-sorting-water-and-fire/

 

Nested _currentRender looks like the solution again unless there's some way to make the material inherit stages from

the material behind it.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Sikkpin's fix:

 

 

 

 

 

 
RB_STD_DrawShaderPasses
Draw non-light dependent passes
=====================
*/
int RB_STD_DrawShaderPasses( drawSurf_t **drawSurfs, int numDrawSurfs ) {
int i;
// only obey skipAmbient if we are rendering a view
if ( backEnd.viewDef->viewEntitys && r_skipAmbient.GetBool() ) {
return numDrawSurfs;
}
RB_LogComment( "---------- RB_STD_DrawShaderPasses ----------\n" );
// if we are about to draw the first surface that needs
// the rendering in a texture, copy it over
if ( drawSurfs[0]->material->GetSort() >= SS_POST_PROCESS ) {
if ( r_skipPostProcess.GetBool() ) {
return 0;
}
// only dump if in a 3d view
// sikk - We are capturing the current render for each surface that needs it and post processes
// are capturing it manually
//if ( backEnd.viewDef->viewEntitys && tr.backEndRenderer == BE_ARB2 ) {
// globalImages->currentRenderImage->CopyFramebuffer( backEnd.viewDef->viewport.x1, backEnd.viewDef->viewport.y1,
// backEnd.viewDef->viewport.x2 - backEnd.viewDef->viewport.x1 + 1,
// backEnd.viewDef->viewport.y2 - backEnd.viewDef->viewport.y1 + 1, false );
//}
backEnd.currentRenderCopied = true;
}
GL_SelectTexture( 1 );
globalImages->BindNull();
GL_SelectTexture( 0 );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
RB_SetProgramEnvironment();
// we don't use RB_RenderDrawSurfListWithFunction()
// because we want to defer the matrix load because many
// surfaces won't draw any ambient passes
backEnd.currentSpace = NULL;
for ( i = 0; i < numDrawSurfs; i++ ) {
if ( drawSurfs[i]->material->SuppressInSubview() ) {
continue;
}
if ( backEnd.viewDef->isXraySubview && drawSurfs[i]->space->entityDef ) {
if ( drawSurfs[i]->space->entityDef->parms.xrayIndex != 2 ) {
continue;
}
}
// ---> sikk - Material needs _currentRender
// we need to draw the post process shaders after we have drawn the fog lights
//if ( drawSurfs[i]->material->GetSort() >= SS_POST_PROCESS && !backEnd.currentRenderCopied ) {
// break;
//}
// I'm assuming here that all materials with a sort order >= SS_POST_PROCESS
// is an actual post process and manually captures the current render
if ( drawSurfs[i]->material->NeedsCurrentRender() && drawSurfs[i]->material->GetSort() < SS_POST_PROCESS ) {
// only dump if in a 3d view
if ( backEnd.viewDef->viewEntitys && tr.backEndRenderer == BE_ARB2 ) {
globalImages->currentRenderImage->CopyFramebuffer( backEnd.viewDef->viewport.x1, backEnd.viewDef->viewport.y1,
backEnd.viewDef->viewport.x2 - backEnd.viewDef->viewport.x1 + 1,
backEnd.viewDef->viewport.y2 - backEnd.viewDef->viewport.y1 + 1, false );
}
}
// <--- sikk - Material needs _currentRender
 

 

 

 

https://github.com/RobertBeckebans/Sikkpin-Breadcrumps-src/blob/master/renderer/draw_common.cpp

 

I think he commented-out part of the fix because he wasn't sure about the final implementation at the time?

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

I made splash the same way:

 

 

Here are the files.

 

I don't understand the setup or how the bumpmap is combining with the standard heat haze water surface effect.

 

Check the zip file I attached. Material looks like this:

 

 

textures/particles/splash_1
{
        qer_editorimage textures/darkmod/sfx/deforms/splash_local.tga
        
        noshadows
        noselfshadow
        noimpact
        nonsolid
        translucent
        diffusemap    _black
    {    
        blend    specularmap
        map        textures/particles/splash_s
        alpha 0
    }
    {
        blend bumpmap
        map    textures/darkmod/sfx/deforms/splash_local.tga
    }
    {
        program         heatHaze.vfp
        vertexParm      0       time * 0 , time * 0 // scroll
        vertexParm      1       2 //magnitude
        fragmentMap     0       _currentRender
        fragmentMap     1       textures/darkmod/sfx/deforms/splash_local.tga
    }
}

 

 

  • Like 4

It's only a model...

Link to comment
Share on other sites

I wonder if it would be worth it to hard-code skin changes to the splash particles based on some entity attribute

for the water entity and put off fixing nested currentRender issues 'till "the future"... That way the splash material

would always match the water it was associated with. I guess the other workaround is to always use transparent water

and color it with fog or directly color the basin brushes rather than color the water itself.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Sikk's fix that you pasted above defers the current render capture to be done by his post-processing suite that sits outside the engine. I'm not sure he could have fixed transparent things being drawn in the wrong order, but each of his effects has the ability to do its own current render capture so he can at least say something like "particles always come after fog".

 

Draw order is ridiculously tough to solve for general cases without doing something inefficient and complicated like depth peeling, where you have one depth buffer for each overlapping transparent layer. We can tweak it for specific cases while putting off that general problem, as you say.

 

I was splashing about in the caves in NHAT1 last night to see what the existing effect looked like. It was lighting up my lightgem, I noticed. I guess that at least one of the ripple and/or splash mustn't be a particle then, since we stopped those being drawn during the lightgem passes in 2.03.

 

I too will try the new splash tonight. That water looks superb by the way!

  • Like 1
Link to comment
Share on other sites

Water uses 3 different surfaces:

a) semitransparent reflection

B) animated refraction (50 frames) that warps bottom of the river and the reflection; it also has specularmap with bumpmap

c) animated diffusemap (also 50 frames), semitransparent, using blend blend method, gives a little bit of colour on top

It's only a model...

Link to comment
Share on other sites

Do we use that water shader in TDM? That water looks so much more convincing than most of our bare heat-haze shaders. I'm about to fire up your example map and take a closer look. You have real specular, reflecting the lights. Do we have any built-in shaders that do that?

Link to comment
Share on other sites

I did not commit it, but of course you can use it freely. People seem to be worry real time reflections will slow down the game too much. But that can be replaced with cubemap. I think it's still better than nothing. My setup is pretty complex with 3 different shaders. But even a single animated refractive shader with 50 frames will look better than the stock clear water with a scrolling normalmap, in my opinion.

  • Like 1

It's only a model...

Link to comment
Share on other sites

I think the lod system also supports skin changes, so that the water texture used (real reflection or cubemap) could be controled via the lod settings. And yeah, awesome work on the fx :)

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

It's an awful lot better than nothing! I haven't got as far as loading the map yet, but I've read the material file and compared it with the video. You have a pair of 3d textures for diffuse map, and normal map, split into 2d textures that are cycled through in the material file. I guess our interaction shaders didn't let you achieve that effect using a proper 3d texture.

 

Hmm why doesn't the _black diffusemap in the second texture "animated_water_refraction" make the water black and opaque? You've done something here I didn't realise was possible -- transparent light interactions. I'm wondering now why the heathaze effect doesn't wipe out the specular stages. If the specular is drawn before heat haze and the other PP effects kick in, which I assume it is, the specular stage should have wiped out the background river bottom. If drawn after, the heat haze should have wiped out the specular.

 

I'll stop blathering in the thread now and go take a proper look at the scene being drawn in my debugger :)

Link to comment
Share on other sites

It's basically a looped animation I created in Blender with ocean modifier. Here's a related thread. I thought about packing all the images into one file, but since the frames are 512 x 512 px and there's so many of them it would be a one gigantic image file. I don't think _black diffusemap actually makes any difference.

It's only a model...

Link to comment
Share on other sites

I'm having trouble getting it to work... I merged the two file drops above, added a suitable darkmod.txt, dmapped, and launched. I get the reflection and the splashes and the ripples, but not the lovely specular. No console errors, so presumably no missing files. When I step through the draws in the debugger, I see the ripples and the splashes catch the nearby torchlight, and the slight gloss of the diffusemap on the water, but no broad specular reflection of the torches.

 

Even without that working, you've still given me something to study. Stuff is being drawn on the surface of the water during light interactions even though the scene depth in the depth buffer is well below the water surface. They're not "screen-door" transparencies either. Translucent interactions are more flexible than I thought.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 5 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...