Jump to content

misc_model_ghoul


Tempust85

Recommended Posts

Posted

I don't see the shadows showing up at all for the misc_model_static or misc_model_ghoul.

 

RF_NOSHADOW prohibits shadow generation in engine (cg_shadows > 1 )

Posted

I've tried using centity renderfx rf_lighting_origin but it changed nothing. I'll try refent. I'm guessing the origin issue is why the misc static & ghoul aren't displaying stencil shadows in certain areas in a map when the player + NPCs do.

Posted

It's fixed. It works just as if it were an NPC or the player model. Now there's just finding a way to disable those shitty looking self shadows on the models. It has the standard shading + stencil shading.

Posted

I've tried using centity renderfx rf_lighting_origin but it changed nothing. I'll try refent. I'm guessing the origin issue is why the misc static & ghoul aren't displaying stencil shadows in certain areas in a map when the player + NPCs do.

Simply setting the flag doesn't do anything, you must actually supply the lightning origin information in the struct as well. :)

Tempust85 likes this
Posted

Are the poor shadows you're referring to the very aliased shadow cast on the ground by the left star-fighter? Or the backside of Kyle?

 

Is there anyway to run a Gaussian Blur and an AA filter on the aliased star-fighter shadow so it's not so blocky?

Posted

The shadows on the model, not the projected shadows on the ground. I'm sure there's ways to blur them, but I certainly wouldn't know how though if I were to take a guess it would be where it does the shadow edges. :P

Posted

Will the player be able to interact with a misc_model_ghoul (MMG)? I mean... suppose you use this to spawn (can you spawn an MMG?) a dead corpse (to replace the dead NPC at the moment its corpse disappears...)

 

Then passing NPC's see static corpse and go into alert mode? Or player could walk up to static corpse and be prompted to "Pick up corpse" so you have to hide the body-- which would trigger a new anim to play on MMg corpse being carried etc.

  • 1 year later...
Posted

Necro time!

 

New features:

 

- render radius

- rootbone

LOOP - Loop the animation. Default - play once.

"model" - arbitrary .glm file to load
"modelscale" - "x" uniform scale
"modelscale_vec" - "x y z" scale model in each axis
"renderRadius" - default "120" model render radius
"rootbone" - default "model_root" animation root bone
"startframe" - default "0". animation start frame
"endframe" - default "0". animation end frame
"skin" default "models/players/kyle/model_default.skin" - skin file to load. must include path.

- The frames between the "startframe" & "endframe" will play.
- Use "renderRadius" for models larger than a player if you notice them disappearing when moving the camera.
- Use "rootbone" if wanting to change the root bone that the animation will play from. 

Now whenever I have 3x Kyles animating in a very small basic test map, my FPS dips from 60 to 49 unless I look away. Something I've missed or done wrong perhaps...... @@Xycaleth @@ensiform @@eezstreet

 

Would I need to precache it?

void SP_misc_model_ghoul( gentity_t *ent )
{
#if 1
	ent->s.modelindex = G_ModelIndex( ent->model );
	gi.G2API_InitGhoul2Model(ent->ghoul2, ent->model, ent->s.modelindex, NULL_HANDLE, NULL_HANDLE, 0, 0);

	//DT EDIT: misc_model_ghoul edits - START
	//ent->s.radius = 50;

	if (ent->playerModel >= 0)
	{
		ent->rootBone = gi.G2API_GetBoneIndex(&ent->ghoul2[ent->playerModel], "model_root", qtrue);
	}

	G_SpawnInt("renderRadius", "120", &ent->s.radius);
	//DT EDIT: misc_model_ghoul edits - END

	G_SetOrigin( ent, ent->s.origin );
	G_SetAngles( ent, ent->s.angles );

	qboolean bHasScale = G_SpawnVector( "modelscale_vec", "1 1 1", ent->s.modelScale );
	if ( !bHasScale ) {
		float temp;
		G_SpawnFloat( "modelscale", "0", &temp );
		if ( temp != 0.0f ) {
			ent->s.modelScale[0] = ent->s.modelScale[1] = ent->s.modelScale[2] = temp;
			bHasScale = qtrue;
		}
	}
	if ( bHasScale ) {
		//scale the x axis of the bbox up.
		ent->maxs[0] *= ent->s.modelScale[0];
		ent->mins[0] *= ent->s.modelScale[0];

		//scale the y axis of the bbox up.
		ent->maxs[1] *= ent->s.modelScale[1];
		ent->mins[1] *= ent->s.modelScale[1];

		//scale the z axis of the bbox up and adjust origin accordingly
		ent->maxs[2] *= ent->s.modelScale[2];
		float oldMins2 = ent->mins[2];
		ent->mins[2] *= ent->s.modelScale[2];
		ent->s.origin[2] += (oldMins2 - ent->mins[2]);
	}

	//DT EDIT: misc_model_ghoul edits - START
	G_SpawnInt("startframe", "0", &ent->startFrame);
	G_SpawnInt("endframe", "0", &ent->endFrame);

	char	*root_boneName;//[MAX_QPATH];
	G_SpawnString("rootbone", "model_root", &root_boneName);
	gi.G2API_SetBoneAnim(&ent->ghoul2[0], root_boneName, ent->startFrame, ent->endFrame, BONE_ANIM_OVERRIDE_LOOP, 1.0f + Q_flrand(-1.0f, 1.0f) * 0.1f, 0, -1, -1);

	ent->endFrame = 0; // don't allow it to do anything with the animation function in G_main

	char	*skinName;//[MAX_QPATH];
	int skin = gi.RE_RegisterSkin(skinName);

	G_SpawnString("skin", "models/players/kyle/model_default.skin", &skinName);

	gi.G2API_SetSkin(&ent->ghoul2[ent->playerModel], G_SkinIndex(skinName), skin);

	//DT EDIT: misc_model_ghoul edits - END

	gi.linkentity (ent);
#else
Posted

Had a look at other ghoul2 stuff and came across this:

gi.G2API_PrecacheGhoul2Model(Model);

So I just added it to the end of misc_model_ghoul and the FPS appears to be staying at 60 now. I wonder if this is was the issue all along or not, so I'd like some feedback.

Archangel35757 likes this
Posted

If the frame rates are consistent now, I'd say you fixed it! Great work! :winkthumb:

 

You should submit it as a pull request back to OpenJK (...of course you'll need to apply your fixes to a recent version of OpenJK). Then the other coders will have to look at it-- to approve it.

Tempust85 likes this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...