Jump to content
The Dark Mod Forums

Transparent AI


Destined

Recommended Posts

Hi guys,

 

I want some ghostly (but harmless) people in my WIP. Is it possible to take a normal AI-model and make it translucent? I did not find any spawnarg for that, but maybe I just missed it. I found "noshadow" which I would also apply, but no transparency...

Link to comment
Share on other sites

This would be a property of the materials applied to the AI model, not the model entity itself. I would guess most "ghostly" AI is achieved by using additive ("blend add") or alpha ("blend blend") material stages instead of regular lit textures.

Link to comment
Share on other sites

Yeah, you need to make a custom skin for the AI with transparent materials, then you can give them the skin via the skin spawnarg. If you can't find a good example of a template for a transparent material, let me know and I can paste one in here.

 

A word of warning though, some materials (including the standard skybox, and all decals) have draw order issues with transparent materials and will always draw on top of the AI even if they are behind the AI. You can get around this with even more custom materials (and not using decals in places where the AI will be) but it takes some more planning.

Edited by Moonbo

But you should walk having internal dignity. Be a wonderful person who can dance pleasantly to the rhythm of the universe.

-Sun Myung Moon

 

My work blog: gfleisher.blogspot.com

Link to comment
Share on other sites

You'd have to make that in the same way with a custom skin replacing all existing materials with the nodraw texture. Of course the AI still solid so the illusion won't be complete.

Edited by Moonbo

But you should walk having internal dignity. Be a wonderful person who can dance pleasantly to the rhythm of the universe.

-Sun Myung Moon

 

My work blog: gfleisher.blogspot.com

Link to comment
Share on other sites

AI/Undead/Spirits has two entries as of 2.03: ai_builder_guard_ghost, which is wholly invisible but casts shadows, and ai_revenant_spirit, which has a skin defined but I think is incomplete without the materials Biker cited. No ghost woman I can find; should she exist as an AI def, or just an alternative skin?

 

There's also a tdm_spectre skin (and an opaque black tdm_shade skin) for the Revenant defined in tdm_ai_undead.skin and tdm_ai_undead.mtr. The spectre materials use the translucent keyword and alphaTest 0.5 (but unlike the spirit skin, the spectre skin doesn't remove the opaque chains).

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

  • 4 months later...

So, after quite some time, I have finally found some time, to try to create some transparent AI. My plan for the moment is, to create a ghost, that is transparent and has no collision, that wanders around, ignoring the player. Just a spirit trapped in its old habits, that is used for atmosphere. I have the def- and material-files from the pointed out missions and have already succeeded in making most of a commoner transparent and ghostly. Sadly, I seem not to be able to do the same for his hands and head. So I have two questions:

Which def-file contains "atdm:ai_head_base", which I need to remove the teeth (or make them transparent, if that does not look silly. But for that I need to know, how they are called and presume that I can find that in the stated def-file)?

Which def-file contains the hands and where is the definition, which hands are attached for a model?

 

With this information, I should be able to finish the appearance and start on working on the behaviour. Also I should be able to transfer the steps so far on other commoners for variety. After that, the interesting part will be, to make ghosts that can harm the player (I have already seen that there are other threads, that discuss some problems with that, but wanted to finish the appearence befor delving into the topic some more) and still show "ghostly" behaviour.

  • Like 1
Link to comment
Share on other sites

If you open up the md5mesh file in a text editor, you'll be able to find the list of all textures used...you can just replace them with "textures/common/nodraw" if you want them to be invisible.

Link to comment
Share on other sites

  • 2 weeks later...

https://www.dropbox.com/s/ls7udqrd874l3a3/Ghost.jpg?dl=0

 

This is how my "commoner ghost" looks so far. He completely ignores the player, can not be hit with any weapons and has the regular "commoner" animations and sounds, which is what I intended, so you have a ghost, who just does, what he did, when he was alive.

 

But I have ncountered two problems (taht might be related):

1) I cannot get rid of the shadow. All materials have "noshadow" "noselfshadow" "nonsolid" and "translucent" and the entity has also "noshadow" "1" and "nonsolid" "1". What am I missing?

2) I cannot pass through the AI. Maybe this is related, because at some point I forgot the "nonsolid" and that is also where another "noshadow" is missing. I hope you guys can help me.

 

And another problem: I can't seem to post the picture. When I use the "image" button and insert the URL above, it apparently only uses part after the last slash, but does not show the picture...

Edited by Destined
  • Like 2
Link to comment
Share on other sites

1. All ai have a shadow mesh. You have to set textures/common/shadow to no draw in your skin.

Link to comment
Share on other sites

Hm, I did actually forget to exchange the shadow mesh (I did change the material of the shadow, but it did not change). But it still doesn't work...

 

Here is what the skin file currently looks like:

 

 

 

skin spirits/spirit_leathergreaves
{
model models/md5/chars/townsfolk/commoner/tdm_townsfolk_commoner
model tdm_ai_townsfolk_commoner

rope_belt textures/common/nodraw

arms_legs tdm_spirit_commoner_tunic_brown
belt spirit_shoulder_cowl_green
shoulder_cowl spirit_shoulder_cowl_brown
tdm_commoner_tunic_light_tan_shadows textures/common/nodraw
tdm_commoner_tunic_light_tan tdm_spirit_commoner_tunic_brown
tdm_npc_hand tdm_npc_hand_spirit
textures/common/shadow textures/common/nodraw
}

skin spirits/spirit_head01
{
model models/md5/chars/heads/npcs/commoner_head01.md5mesh

new_average_jack_texture new_average_jack_texture_spirit
tdm_character_tongue textures/common/nodraw
tdm_teeth textures/common/nodraw
textures/common/shadow textures/common/nodraw
}

 

 

 

and this is how the rest of the def files look like:

 

materials

 

 

// spirit_commoner_leathergreaves

tdm_spirit_commoner_tunic_brown
{

nonsolid
noshadows
noselfshadow
translucent

{blend diffusemap
map models/md5/chars/townsfolk/commoner/tunic_local
rgb .2
}

bumpmap models/md5/chars/townsfolk/commoner/tunic_local
diffusemap models/md5/chars/townsfolk/commoner_tunic



{ if ( parm11 > 0 )
blend gl_dst_color, gl_one
map _white
rgb 0.40 * parm11
}
{ if ( parm11 > 0 )
blend add
map models/md5/chars/townsfolk/commoner_tunic
rgb 0.15 * parm11
}

// TDM Ambient Method Related
{
if (global5 == 1)
blend add
map models/md5/chars/townsfolk/commoner_tunic
scale 1, 1
red global2
green global3
blue global4
}
{
if (global5 == 2)
blend add
program ambientEnvironment.vfp
vertexParm 0 1, 1, 1, 1 // UV Scales for Diffuse and Bump
vertexParm 1 1, 1, 1, 1 // (X,Y) UV Scale for specular
vertexParm 2 global2, global3, global4, 1

fragmentMap 0 cubeMap env/gen1
fragmentMap 1 models/md5/chars/townsfolk/commoner/tunic_local // Bump
fragmentMap 2 models/md5/chars/townsfolk/commoner_tunic // Diffuse
fragmentMap 3 _black // Specular
} }


spirit_shoulder_cowl_green
{
nonsolid
noshadows
noselfshadow
translucent

{blend diffusemap
map models/md5/chars/townsfolk/commoner/shoulders_local
rgb .2
}


bumpmap models/md5/chars/townsfolk/commoner/shoulders_local
diffusemap models/md5/chars/townsfolk/shoulders_green




{
if ( parm11 > 0 )
blend gl_dst_color, gl_one
map _white
rgb 0.40 * parm11
}
{
if ( parm11 > 0 )
blend add
map models/md5/chars/townsfolk/shoulders_green
rgb 0.15 * parm11
}


}


spirit_shoulder_cowl_brown
{
nonsolid
noshadows
noselfshadow
translucent

{blend diffusemap
map models/md5/chars/townsfolk/commoner/shoulders_local
rgb .2
}

bumpmap models/md5/chars/townsfolk/commoner/shoulders_local

{blend diffusemap
map models/md5/chars/townsfolk/shoulders_green
color .9, .6, .6, 1 //color <redval>, <greenval>, <blueval>, <alphaval>
}

{
if ( parm11 > 0 )
blend gl_dst_color, gl_one
map _white
rgb 0.40 * parm11
}
{
if ( parm11 > 0 )
blend add
map models/md5/chars/townsfolk/shoulders_green
rgb 0.15 * parm11
}
}

tdm_spirit_commoner_tunic_brown_shadows
{
nonsolid
noshadows
noselfshadow
translucent

{blend diffusemap
map models/md5/chars/townsfolk/commoner/tunic_local
rgb .2
}


bumpmap models/md5/chars/townsfolk/commoner/tunic_local
diffusemap models/md5/chars/townsfolk/commoner_tunic



{ if ( parm11 > 0 )
blend gl_dst_color, gl_one
map _white
rgb 0.40 * parm11
}
{ if ( parm11 > 0 )
blend add
map models/md5/chars/townsfolk/commoner_tunic
rgb 0.15 * parm11
}

// TDM Ambient Method Related
{
if (global5 == 1)
blend add
map models/md5/chars/townsfolk/commoner_tunic
scale 1, 1
red global2
green global3
blue global4
}
{
if (global5 == 2)
blend add
program ambientEnvironment.vfp
vertexParm 0 1, 1, 1, 1 // UV Scales for Diffuse and Bump
vertexParm 1 1, 1, 1, 1 // (X,Y) UV Scale for specular
vertexParm 2 global2, global3, global4, 1

fragmentMap 0 cubeMap env/gen1
fragmentMap 1 models/md5/chars/townsfolk/commoner/tunic_local // Bump
fragmentMap 2 models/md5/chars/townsfolk/commoner_tunic // Diffuse
fragmentMap 3 _black // Specular
} }



tdm_spirit_commoner_tunic_brown
{
nonsolid
noshadows
noselfshadow
translucent

{blend diffusemap
map models/md5/chars/townsfolk/commoner/tunic_local
rgb .2
}


bumpmap models/md5/chars/townsfolk/commoner/tunic_local
diffusemap models/md5/chars/townsfolk/commoner_tunic



{ if ( parm11 > 0 )
blend gl_dst_color, gl_one
map _white
rgb 0.40 * parm11
}
{ if ( parm11 > 0 )
blend add
map models/md5/chars/townsfolk/commoner_tunic
rgb 0.15 * parm11
}

// TDM Ambient Method Related
{
if (global5 == 1)
blend add
map models/md5/chars/townsfolk/commoner_tunic
scale 1, 1
red global2
green global3
blue global4
}
{
if (global5 == 2)
blend add
program ambientEnvironment.vfp
vertexParm 0 1, 1, 1, 1 // UV Scales for Diffuse and Bump
vertexParm 1 1, 1, 1, 1 // (X,Y) UV Scale for specular
vertexParm 2 global2, global3, global4, 1

fragmentMap 0 cubeMap env/gen1
fragmentMap 1 models/md5/chars/townsfolk/commoner/tunic_local // Bump
fragmentMap 2 models/md5/chars/townsfolk/commoner_tunic // Diffuse
fragmentMap 3 _black // Specular
} }

new_average_jack_texture_spirit
{

nonsolid
noshadows
noselfshadow
translucent

{blend diffusemap
map models/md5/chars/heads/average_jack_head_local
rgb .5
}

bumpmap models/md5/chars/heads/average_jack_head_local
diffusemap models/md5/chars/heads/average_jack_head

{
if ( parm11 > 0 )
blend gl_dst_color, gl_one
map _white
rgb 0.40 * parm11
}
{
if ( parm11 > 0 )
blend add
map models/md5/chars/heads/average_jack_head
rgb 0.15 * parm11
}

// TDM Ambient Method Related
{
if (global5 == 2)
blend add
map models/md5/chars/heads/average_jack_head
scale 1, 1
red global2
green global3
blue global4
}
}

tdm_npc_hand_spirit //the full-fingered, default hand, only as spirit
{
nonsolid
noshadows
noselfshadow
translucent

{blend diffusemap
map models/md5/chars/npc_hand_full_local
rgb .5
}


diffusemap models/md5/chars/npc_hand_full
bumpmap models/md5/chars/npc_hand_full_local

specularmap models/md5/chars/npc_hand_full_s.tga

{
if ( parm11 > 0 )
blend gl_dst_color, gl_one
map _white
rgb 0.40 * parm11
}
{
if ( parm11 > 0 )
blend add
map models/md5/chars/npc_hand_full
rgb 0.15 * parm11
}

// TDM Ambient Method Related
{
if (global5 == 1)
blend add
map models/md5/chars/npc_hand_full
scale 1, 1
red global2
green global3
blue global4
}

}

 

 

and def file (currently it has atdm:ai_townsfolk_commoner as base, but I think, I will copy the atdm:ai_townsfolk_commoner and make a atdm:ai_spirit_townsfolk_commoner, especially since there are currently a couple of spawnargs that are double defined, but that is, because it is still a WIP)

 

 

entityDef atdm:ai_spirit_townsfolk_male
{
"inherit" "atdm:ai_townsfolk_commoner"
"editor_displayFolder" "AI/Monsters/Undead/Spirits"
"editor_usage" "A male ghost. Ignores player; only for ambient purpose"
"nonsolid" "1"
"def_head" "atdm:ai_head01_spirit_commoner"
"skin" "spirits/spirit_leathergreaves"
"bleed" "0"
"stepvol_run" "0"
"stepvol_walk" "0"
"af_push_moveables" "0"
"bleed" "0"
"chanceNoticeWeapon" "0"
"chanceNoticeSuspiciousItem" "0"
"chanceNoticePerson" "0"
"chanceNoticeMonster" "0"
"chanceNoticeUndead" "0"
"chanceNoticeBlood" "0"
"chanceNoticeLight" "0"
"chanceNoticeMissingItem" "0"
"chanceNoticeBrokenItem" "0"
"chanceNoticeDoor" "0"
"chanceNoticePickedPocket" "0"
"canLightTorches" "0"
"canOperateSwitchLights" "0"
"canOperateDoors" "0"
"canOperateElevators" "0"
"fov" "0"
"is_civilian" "0"
"noshadow" "1"
"alert_aud_thresh" "1000"
"nonsolid_on_ragdoll" "1"
}

 

Link to comment
Share on other sites

Not sure why that doesn't work. Have you tried just putting a noshadows spawnarg on the AI entity?

Link to comment
Share on other sites

Yes, I have (see the third spoiler, third to last line). Maybe I should try to create the before stated independent entity "atdm:ai_spirit_townsfolk_commoner". It might be, that the double defined spawnargs make problems.

 

Any suggestions about the other problem? Does the model have a collision entity, that has to be removed or something similar? As I said, I suspect, that these two problems are connected: If I cannot pass through the model, the light cannot either?

Link to comment
Share on other sites

The problems aren't likely to be connected.

 

All AI have multiple collision boxes for different things--melee detection, missile detection and pathfinding. I'm not 100% sure how to turn them all off, or what would happen if you did (what keeps an AI from falling through the floor if they are completely nonsolid?).

Link to comment
Share on other sites

My plan was, to make phantoms, that move around and behave as if they were still alive (hence the townsfolk_commoner as a base), i.e. not realising, that they are dead. At the same time they should not interact with the player at all, but are completely for show. And that would be better, if the player could walk through them. I also thought about randomly turning them completely invisible (as some kind of flickering in and out of existence), which would be a nice effect, but for that I would first need to get rid of the shadows and collision.

 

The next step I thought of was, to make spirit enemies, that actually notice and attack the player. Not sure, how I will let them behave. In the other threads ranged fighters were the most popular, so I would have gone in that direction, but I am not sure, if they also should be nonsolid (in which case they would be invulnerable) or what other properties they should have. But at first, I wanted to finish these oblivious spirits, without shadows and without collision.

 

@Springheel: Where in the def-files can I find the collision boxes? If I know, where to find them, I can test what happens, when I turn them off. As for not falling through the floor: Maybe it is sufficient to keep the collision box of the shoes and delete the rest (then the player would bounce a little while walking though the ghost, but I could live with that; or maybe they can be made so flat, that you wouldn't even notice). As I said, it would have to be tested, but for that I would need to know, where they are defined.

Link to comment
Share on other sites

@Springheel: Where in the def-files can I find the collision boxes?

 

 

I don't remember, I'm afraid. This might have some clues: http://wiki.thedarkmod.com/index.php?title=An_AI_consists_of_6_Models

Link to comment
Share on other sites

Ah, thanks! I have also found, how to completely turn off the collision models, but, of course, then the AAs crashes, because the AI could possibly go anywhere (and maybe falls through the floor). Via "g_showcollisionmodels" "1", I can at least see the models and so can tell, if I achieve anything by changing various parameters. I will see this evening, if I can create an external collision model file and apply it to the AI. It is described for moveables, but maybe I cann also apply it to AI. I still haven't found, where the clipmodel for the AI is defined, though. So I don't even know, which of the described methods is used... But if I understood correctly, a new defined method overwrites any other methods, so lets hopw for the best...

Edited by Destined
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.
      · 7 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...