Jump to content

Render Issue with Multiple Cameras + Post Effects.


reepblue
 Share

Recommended Posts

This is in the XFORM project currently. If you use multiple cameras for rendering and load in a map with post effects, this will be the result. 
image.thumb.png.c18dcd6956eca7d1dd4a25bcd6162d85.png

 

This is how I'm creating the camera.

void FPSWeapon::AttachToPlayer(std::shared_ptr<Component> playercomponent)
{
	// Set up the camera for the viewmodel.
	Start();

	auto entity = GetEntity();
	auto world = entity->GetWorld();

	auto player = playercomponent->As<FirstPersonControls>();
	if (player)
	{
		auto playercam = player->GetCamera();
		if (playercam != NULL)
		{
			if (drawonlayer)
			{
				viewmodelcam = CreateCamera(world);
				viewmodelcam->SetClearColor(0, 0, 0, 0);
				viewmodelcam->SetClearMode(CLEAR_DEPTH);
				viewmodelcam->SetMatrix(playercam->GetMatrix(true), true);
				viewmodelcam->SetFov(viewmodelfov);
				viewmodelcam->SetRange(0.001f, playercam->GetRange().y);
				viewmodelcam->SetOrder(RENDERLAYER_VIEWMODEL);
				viewmodelcam->SetRenderLayers(RENDERLAYER_VIEWMODEL);
				viewmodelcam->SetParent(playercam);

				entity->SetParent(viewmodelcam);

				entity->SetRenderLayers(RENDERLAYER_VIEWMODEL);
				viewmodel.lock()->SetRenderLayers(RENDERLAYER_VIEWMODEL);
			}
			else
			{
				playercam->SetRange(0.001f, playercam->GetRange().y);
				entity->SetParent(playercam);
			}
		}

		playerentity = player->GetEntity();
	}
}

Full code here:

XFORM/Source/Components/Weapons/FPSWeapon.cpp at main · UltraEngine/XFORM (github.com)

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...