Jump to content

Quick misc_portal_surface question


Go to solution Solved by Szico VII,

Recommended Posts

Posted

Hey guys!

 

Been derping around in GTK recently, and I've been trying to create a cool "security room" where the player can browse various camera feeds from the entire facility. Pretty neat. Then, I thought it could be cool for, instead of the player pressing a button and using a misc_camera to view the scene, the camera viewpoints to be displayed on the wall (as a 'texture') so I could have like 6 camera panels each showing feeds from the map.

 

So I've been googling around and looking info up about misc_portal_surfaces, which I gather are used for mirrors, but can also be used to do what I've described. I'm still a little bit shaky on what to do.

 

Here's my current "target order":

 

Brush (textured with portal on one side) | misc_portal_surface > misc_portal_camera > target_position

 

Is this right? I made sure the misc_portal_surface is really close to the brush, but right now it doesn't draw anything. Any thoughts?

 

Thanks!

 

 

Posted

Besides your current troubles, keep in mind that you can only have one portal in view at any time. If you have multiple (e.g. 6) only one will be displayed.

therfiles likes this
  • Solution
Posted

First off, here's a shader that works:

 

 

textures/blueice_nightfall/nightfall_camera
{
    qer_editorimage textures/blueice_nightfall/nightfall_cameraportal
    surfaceparm playerclip
    surfaceparm nolightmap
    portal
    {
    map textures/blueice_nightfall/nightfall_camera
     blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
    depthWrite
    alphaGen portal 2048
    }
}

 

The image is just that of a glass texture - you can use whatever you like.

 

Entity should be as follows:

 

misc_portal_surface --> misc_portal_camera --> target_position

 

And what Mr Wonko said. Your cameras would need to be seperated (vis wise) from each other else only one will be drawn. Perhaps you could have a trigger system that switches the camera view instead of 6 simultaneous screens

therfiles, PK_Azlon and eezstreet like this
Posted

Perhaps you could have a trigger system that switches the camera view instead of 6 simultaneous screens

 

I am intrigued by this idea. How would one go about setting that up?

Posted

Just have the brush your portal texture is on set as a func_useable. Then set up 5 more func_useables with camera connections (thats 6 sets of each entity ex.useables in total so 18 entities) for each of your 6 views.

 

Then you can simply swap between them using triggers and or script.

Or, if you like scripting you could feasibly change the target of the cameras to different target positions via script without needing so many entities.

Morabis and therfiles like this
Posted

Hey guys!

 

Been derping around in GTK recently, and I've been trying to create a cool "security room" where the player can browse various camera feeds from the entire facility. Pretty neat. Then, I thought it could be cool for, instead of the player pressing a button and using a misc_camera to view the scene, the camera viewpoints to be displayed on the wall (as a 'texture') so I could have like 6 camera panels each showing feeds from the map.

 

So I've been googling around and looking info up about misc_portal_surfaces, which I gather are used for mirrors, but can also be used to do what I've described. I'm still a little bit shaky on what to do.

 

Here's my current "target order":

 

Brush (textured with portal on one side) | misc_portal_surface > misc_portal_camera > target_position

 

Is this right? I made sure the misc_portal_surface is really close to the brush, but right now it doesn't draw anything. Any thoughts?

 

Thanks!

mate. its Radiant, not GTK
therfiles likes this
Posted

textures/blueice_nightfall/nightfall_camera
{
    qer_editorimage textures/blueice_nightfall/nightfall_cameraportal
    surfaceparm playerclip
    surfaceparm nolightmap
    portal
    {
    map textures/blueice_nightfall/nightfall_camera
     blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
    depthWrite
    alphaGen portal 2048
    }
}

 

Thanks, @@Szico VII! Do you mind if I adapt that shader for my own use? I really appreciate the help. I think I'll try it with a script if I can't get all 6 to draw simultaneously

 

mate. its Radiant, not GTK

 

05d.jpg

Posted

No need for a crazy amount of entities. If you want to keep it simple, you don't even have to make the script dynamic. You can make it situationally specific, rotating through a series of misc_portal_cameras.

//Generated by BehavEd


if ( $get( FLOAT, "SET_PARM1")$, $=$, $0$ )
{
	set ( /*@SET_TYPES*/ "SET_PARM1", "1" );

	affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
	{
		set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam1" );
	}

}


else (  )
{

	if ( $get( FLOAT, "SET_PARM1")$, $=$, $1$ )
	{
		set ( /*@SET_TYPES*/ "SET_PARM1", "2" );

		affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
		{
			set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam2" );
		}

	}


	else (  )
	{

		if ( $get( FLOAT, "SET_PARM1")$, $=$, $2$ )
		{
			set ( /*@SET_TYPES*/ "SET_PARM1", "3" );

			affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
			{
				set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam3" );
			}

		}


		else (  )
		{

			if ( $get( FLOAT, "SET_PARM1")$, $=$, $3$ )
			{
				set ( /*@SET_TYPES*/ "SET_PARM1", "4" );

				affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
				{
					set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam4" );
				}

			}


			else (  )
			{

				if ( $get( FLOAT, "SET_PARM1")$, $=$, $4$ )
				{
					set ( /*@SET_TYPES*/ "SET_PARM1", "0" );

					affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
					{
						set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam0" );
					}

				}

			}

		}

	}

}

therfiles likes this
Posted

Thanks, @@Szico VII! Do you mind if I adapt that shader for my own use? I really appreciate the help. I think I'll try it with a script if I can't get all 6 to draw simultaneously

 

No worries, that shader is hardly proprietary to me anyway really :P

 

Also, mine says "GTK" Radiant when it starts up. If I see GTK, I know what it is, even if the generic program name for idtech3 is a radiant level editor

therfiles likes this
Posted

 

No need for a crazy amount of entities. If you want to keep it simple, you don't even have to make the script dynamic. You can make it situationally specific, rotating through a series of misc_portal_cameras.

//Generated by BehavEd


if ( $get( FLOAT, "SET_PARM1")$, $=$, $0$ )
{
	set ( /*@SET_TYPES*/ "SET_PARM1", "1" );

	affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
	{
		set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam1" );
	}

}


else (  )
{

	if ( $get( FLOAT, "SET_PARM1")$, $=$, $1$ )
	{
		set ( /*@SET_TYPES*/ "SET_PARM1", "2" );

		affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
		{
			set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam2" );
		}

	}


	else (  )
	{

		if ( $get( FLOAT, "SET_PARM1")$, $=$, $2$ )
		{
			set ( /*@SET_TYPES*/ "SET_PARM1", "3" );

			affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
			{
				set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam3" );
			}

		}


		else (  )
		{

			if ( $get( FLOAT, "SET_PARM1")$, $=$, $3$ )
			{
				set ( /*@SET_TYPES*/ "SET_PARM1", "4" );

				affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
				{
					set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam4" );
				}

			}


			else (  )
			{

				if ( $get( FLOAT, "SET_PARM1")$, $=$, $4$ )
				{
					set ( /*@SET_TYPES*/ "SET_PARM1", "0" );

					affect ( $script_portal_surface$, /*@AFFECT_TYPE*/ FLUSH )
					{
						set ( /*@SET_TYPES*/ "SET_TARGET", "script_cam0" );
					}

				}

			}

		}

	}

}

 

Thanks, @@MoonDog. That's what I was thinking of doing!

Posted

No worries, that shader is hardly proprietary to me anyway really :P

 

Also, mine says "GTK" Radiant when it starts up. If I see GTK, I know what it is, even if the generic program name for idtech3 is a radiant level editor

It's Radiant. But made in GTK. Hence, GTK Radiant. It should be referred to as Radiant, not GTK. There could also be all kinds of other Radiants, like Qt Radiant, Unity Radiant, etc.

 

SO MUCH THIS.

Posted

Alternatively, it seems like you could just target the misc_portal_surface to multiple misc_portal_cameras, add a wait key to the misc_portal_surface, and the game will automatically cycle though the cameras...

Posted

Ok, so I'm having a bit of trouble. I can get the camera to work, but it only will draw entities. For example, it will only draw my doors, func_walls, effects, etc. And it still acts like a mirror if you turn your view point enough. Does it need a special compile or something?

 

And the floor will sometimes draw, but when you get closer, these brushes just disappear...

Posted

Hm...Should I compile it with -vis? When ever I attempt it it says it cannot find "mapname.prt". I just confused about what I'm doing wrong. It gives me the HOM effect with anything that isn't an ent. I tried a simple mirror and it worked great. It's the cameras that have messed it up...

Posted

Hm...Should I compile it with -vis? When ever I attempt it it says it cannot find "mapname.prt". I just confused about what I'm doing wrong. It gives me the HOM effect with anything that isn't an ent. I tried a simple mirror and it worked great. It's the cameras that have messed it up...

 

You probably have a leak in the bsp that is preventing you from saving a prt file.

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