Jump to content
The Dark Mod Forums

Recommended Posts

Posted

Hello,

 

Is there an easy way to hide a func_emitter fx at a certain distance? Or better yet fade them in and out? Hide_distance doesn't seem to work.

I know locations will automatically disable fx and you can manually trigger func_emitters on and off. (but neither of those are practical in my case)

Posted
Hide_distance doesn't seem to work.

 

 

I know that wasn't working at some point during the 2.05 development cycle, but I thought someone fixed it along the way so that it did?

 

edit: I was remembering this, although maybe it doesn't do what I thought: http://bugs.thedarkmod.com/view.php?id=4372

Posted (edited)

Hmm I tried the LOD and it's still not hiding. Here are the spawnargs Im using.

// entity 1766
{
"classname" "func_emitter"
"name" "func_emitter_7"
"_color" "0.188 0.157 0.122"
"cycleTrigger" "0"
"model" "volta_fogSteamy_large.prt"
"origin" "-132 5601 -864"
"model_lod_1" "emtpy"
"hide_distance" "300"
"lod_1_distance" "300"
"dist_check_period" "1"
}
Edited by kingsal
Posted

lod_bias (poorly named attribute) is for making stuff invisible if your Object Detail slider is on the low side.

 

hide_distance or LOD are for changing detail or making things invisible based on your distance to the entity.

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...)

Posted

hmm, what about binding the func_emitter to another FS brush/patch that gets hidden at a certain distance..?

 

Hang on, I was able to hide rain patches using the port_dist & dist_check_period args... in some map I made a few years ago...

  • Like 1

bhm_banner.jpg

Posted

You can use distance based alpha-fading on particles whose materials have an alpha attribute:

 

http://wiki.thedarkmod.com/index.php?title=LOD

 

lod_fadein_range

lod_fadeout_range

 

http://wiki.thedarkmod.com/index.php?title=Alpha-fading

 

Limitations:

 

Unlit particles can fade to transparent using alpha keyword in the material.

Lit particles can selectively fade away parts of a material using alpha-test (see wiki above)

 

It may be possible to have lit materials fade to transparent using materials similar to the translucent ones here:

 

http://wiki.thedarkmod.com/index.php?title=Making_Semi-transparent_textures

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...)

Posted

Nbohr, I tried to test this following the wiki and I'm not getting any fading. What am I doing wrong here?

 

Plant_mesh_04 definitely has a shader with alpha. Does it need to be alpha blend and or test? How do I integrate the "alpha map growable" into my material?

entityDef fade_object
{
	"inherit"				"atdm:nature_base"
	"editor_displayFolder"	"test"

	"editor_color"			".4 0.8 0.1"
	"editor_usage"			"Don't use, base for all TDM LOD grass patches."

	"solid"					"0"
	"model"					"models/darkmod/nature/plant_mesh_04.lwo"


	// turn off shadows from this distance on
//	"lod_1_distance"		"250"
//	"model_lod_1"			""
//	"noshadows_lod_1"		"1"

	// hide it from this distance on (it is a small object, so can vanish fast)
	"hide_distance"			"1000"

	"lod_fadeout_range"		"600"

	// by default use more dense grass
}
Posted

The grow map acts as the alpha of the diffuse. Alpha-test uses a threshold to say "anything with less alpha than x is fully transparent, anything with more is fully opaque".

 

The cattails entity in the wiki uses this as well as some of our other vegetation:

 

http://wiki.thedarkmod.com/index.php?title=Alpha-fading

 

The difference here is that we are applying the material to a particle rather than a standard model but I'm pretty sure that the alpha scripting will

happen on any entity as long as the material and LOD settings are configured.

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...)

  • 1 year later...
Posted

I've been working on similar thing lately, and I couldn't get alpha fading to work either. Does anyone have any working example of this?

The Animated Grass demo

Posted

I checked its defs already, it uses several lod stages, not alpha fading. I was able to reproduce it, but I wonder how a fluid alpha fading solution would work.

Oh right

Do you follow the tutorial @NB posted above? Do you use the alphaTest material flag?

If so, attach the test map for me to look at

Posted (edited)

The courtyard in In The Black has a lamphaze that changes size with player distance: I hacked it together by piggybacking on the alpha-fading functionality. It's a func_static patch with the material named 'halo' in itb.mtr.

 

I think there was some kind of counterintuitive quirk in the way the LOD distance settings gave rise to the alpha value changes, but I've forgotten the details. Something like needing to set a hide distance even though I didn't want hiding, and finding the differences between hide/normal/fadeout/fadein ranges behaved unexpectedly. You can see I made hide and normal distances huge so they'd never take effect, and fadein range tiny, and I think there's a reason lod_fadeout_range == lod_1_distance but I've forgotten quite what happened when it wasn't:

"dist_check_period" "0.01"
"hide_distance" "30000000"
"lod_1_distance" "512"
"lod_fadein_range" "1"
"lod_fadeout_range" "512"
"lod_normal_distance" "30000000"
Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Posted

I wouldn't expect translucent ones to work; apparently translucency is 'screen door' and doesn't involve alpha. As for alphatest ones, is the alphatest in the material set to shaderparm3 rather than an explicit value?

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Posted (edited)

Sorry if this is not really about TDM but i'm trying to do the same thing on my custom fhdoom engine and not having any success, I can't even make the Doom 3 burn away effect to work on my case, what it does is make the object instantly invisible, I blame that on my lack on knowledge on the subject of material shading.

 

This is the burn away material stage (modified slightly from Doom 3) but it doesn't do what i expected...

{	// blend away effect
		if	(parm7 > 0)	// only when dead
		// make a burned away alpha test for the normal skin
		blend	gl_zero, gl_one			// don't draw anything
		
		map textures/nature/red_strange_plant_blend.tga	// replace this with a monster-specific texture
		alphaTest 0.05 + 1.5 * (time - parm7)
	}    

Also how can you access the alpha value from the c++ code?

 

I know about

 

SetShaderParm(Flag, value);

 

But this only changes values based on the materials "parmx" material key

 

what i want is to access the value defined in front of the key "alphaTest" keyword;

 

I came up with the code below but the most impart part, getting the alpha value and changing it, is something that i don't know how to do.

renderEntity_t	*renderEnt;
idRenderModel	*renderModel;
const modelSurface_t	*surf;
const idMaterial	*shader;
const shaderStage_t     *sstage;
f32 alphaTest = 0;

renderEnt = GetRenderEntity();
renderModel = renderEnt->hModel;

if (renderModel == NULL) return;

for (int i = 0; i < renderModel->NumSurfaces(); ++i) {
    surf = renderModel->Surface(i);

    if (surf == NULL) continue;

    shader = surf->shader;

    if (shader == NULL) continue;

    for (int i = 0; i < shader->GetNumStages(); ++i) {
	sstage = shader->GetStage(i);
	
        if (sstage->hasAlphaTest) {

            // get current alpha test value
            
            // new alpha test value

	   break;
	}
	continue;
}

the sstage has the following member variable "sstage->alphaTestRegister" but instead of getting the 0.5 value of the alphaTest key i get the value 22.

 

What are stage registers and how I retrive the real alpha value? Can anyone help me?

Edited by HMart
Posted

Nope, it's the base 0.5 value.

In that case 'alphatest parm3' might work. All LOD fading seems to do is modify parm3 according to distance, so what that does depends on how your material is set up, which is why I was able to use it for scaling. (And yes, it would be nice if the wiki said so.)

 

@HMart I don't know about the code, but doesn't D3 control burnaway partly through scripting?

float burnDelay = getFloatKey( "burnaway" );
	if ( burnDelay != 0 ) {
		preBurn();
		sys.wait( burnDelay );
		burn();
		startSound( "snd_burn", SND_CHANNEL_BODY, false );
	}

(From ai_monster_base.script)

  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

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

    • JackFarmer

      "The Year of the Rat." 
      😄

      Al Stewart must be proud of you!
      Happy testing!
      @MirceaKitsune
      · 1 reply
    • datiswous

      I posted about it before, but I think the default tdm logo video looks outdated. For a (i.m.o.) better looking version, you can download the pk4 attached to this post and plonk it in your tdm root folder. Every mission that starts with the tdm logo then starts with the better looking one. Try for example mission COS1 Pearls and Swine.
      tdm_logo_video.pk4
      · 2 replies
    • JackFarmer

      Kill the bots! (see the "Who is online" bar)
      · 3 replies
    • STiFU

      I finished DOOM - The Dark Ages the other day. It is a decent shooter, but not as great as its predecessors, especially because of the soundtrack.
      · 5 replies
    • JackFarmer

      What do you know about a 40 degree day?
      @demagogue
      · 4 replies
×
×
  • Create New...