Compositor workspace not showing when enabled

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 237
Joined: Thu Oct 14, 2010 12:30 pm
x 58

Compositor workspace not showing when enabled

Post by Hotshot5000 »

I added dynamic cubemap support from the provided sample and I've notice that all compositors in the samples/tutorials that use "connect_external" don't also use automatic connections like "connect" and "connect_output". After that I tried to kind of "merge" also so SMAA sample.

After fixing some obvious issues I get it running with no crash, no error, but it just continues to show the previous compositor as if nothing changed. I know it has changed because the game continues to run in the background even though the loading screen compositor is still showing.

The following compositor might not be 1:1 with what I've done (I lost those files didn't make a commit of backup) but the idea is the same: can you connect_external then also expect the rest of the auto resolves to still work? Kind of rerunning the connectAllNodes() when it sees a change?

If what I did is a bad idea, how should I approach this better to have both dynamic cubemaps + SMAA? (not sure SMAA is actually worth it on mobile, but I kind of want to test the performance hit)

Code: Select all

compositor_node SkyboxSMAA_RenderingNode
{
	//in 0 rt0
	texture rt1 target_width target_height PF_R8G8B8A8

//Play nice with Multi-GPU setups. See Postprocessing sample.
target rt1
{
	pass clear
	{
		colour_value	0 1 0 1
		buffers			colour
		discard_only	true
	}
}

//out 0 rt0
out 1 rt1
}

compositor_node DefaultFinalComposition
{
	in 0 rtN
	// Take input texture #1 and use the local name "rtN" for reference in this scope
	in 1 rt_output
//	in 1 rt_renderwindow

target rt_output
{
	//Play nice with Multi-GPU setups by telling the API there is no inter-frame dependency.
	//On APIs that support discard_only (e.g. DX11) the driver may just ignore the colour value,
	//and use a different memory region (i.e. the value read from a pixel of a discarded buffer
	//without having written to it is undefined)
	pass clear
	{
		colour_value	1 0 0 1
		buffers			colour
		discard_only	true
	}

	pass render_quad
        {
		//Ignore the alpha channel
		material Ogre/Copy/4xFP32
    	        input 0 rtN
	}
	
	pass render_scene
	{
		lod_update_list	off

		//Render Overlays
		overlays	on
		rq_first	254
		rq_last		255
	}
}
}

abstract target cubemap_target_SkyboxWorkspace0
{
	pass clear
	{
		colour_value 0 0 0 1
	}

pass render_scene
{
	//Filter stuff that shouldn't be reflected (vampires?)
	visibility_mask		0x00000005
	overlays			off
	camera_cubemap_reorient true
}

//Render sky (see TutorialSky_Postprocess)
pass render_quad
{
	quad_normals	camera_direction
	material SkyPostprocess0
	camera_cubemap_reorient true
}
}

compositor_node CubemapRendererNode_SkyboxWorkspace0
{
	in 0 cubemap

target cubemap +X : cubemap_target_SkyboxWorkspace0 { }
target cubemap -X : cubemap_target_SkyboxWorkspace0 { }
target cubemap +Y : cubemap_target_SkyboxWorkspace0 { }
target cubemap -Y : cubemap_target_SkyboxWorkspace0 { }
target cubemap +Z : cubemap_target_SkyboxWorkspace0 { }
target cubemap -Z : cubemap_target_SkyboxWorkspace0
{
	pass generate_mipmaps
	{
	}
}
}

compositor_node DynamicCubemapRenderingSkyboxNode0
{
	texture rt0 target_width target_height PF_R8G8B8
	//in 0 rt_renderwindow
	in 0 demo_dynamic_cubemap

target rt0
{
	pass clear
	{
		colour_value 0 0 0 0 1
	}

	pass render_scene
	{
		//Our materials in this pass will be using this cubemap,
		//so we need to expose it to the pass.
		//Note: Even if it "just works" without exposing, the reason for
		//exposing is to ensure compatibility with Vulkan & D3D12.
		expose demo_dynamic_cubemap

	//	shadows		Tutorial_DynamicCubemapShadowNode
		overlays	off
		rq_first	0
		rq_last		2
	}

	//Render sky (see TutorialSky_Postprocess)
	pass render_quad
	{
		quad_normals	camera_direction
		material SkyPostprocess0
	}

	//Render transparent stuff after sky
	pass render_scene
	{
		overlays	on
		rq_first	2
	}
}
out 0 rt0
}

workspace SkyboxWorkspace0
{

connect_external 0 DynamicCubemapRenderingSkyboxNode0 0

    connect DynamicCubemapRenderingSkyboxNode0 0 SmaaNode 0
connect SkyboxSMAA_RenderingNode 1 SmaaNode 1

connect SmaaNode 0 DefaultFinalComposition 0
connect_output DefaultFinalComposition 1
}

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5446
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1348

Re: Compositor workspace not showing when enabled

Post by dark_sylinc »

Hi!

Hotshot5000 wrote: Mon Dec 09, 2024 6:10 pm

I added dynamic cubemap support from the provided sample and I've notice that all compositors in the samples/tutorials that use "connect_external" don't also use automatic connections like "connect" and "connect_output". After that I tried to kind of "merge" also so SMAA sample.

I do not understand what do you mean by this, because:

  • "connect" just connects one node's outputs with another node's input.

  • "connect_output" is just an old way of saying "connect_external 0", because originally the Compositor only supported providing just one external output (i.e. connect_output) whereas later we added support for multiple outputs, so the keyword changed to "connect_external <external #> <node_name> <input channel #>".

continues to show the previous compositor as if nothing changed. I know it has changed because the game continues to run in the background even though the loading screen compositor is still showing.

Do you mean between launches you don't see any difference, or you're editing the compositor in C++ in realtime and after the changes, those changes are not reflected in the workspace?

Hotshot5000 wrote: Mon Dec 09, 2024 6:10 pm

but the idea is the same: can you connect_external then also expect the rest of the auto resolves to still work? Kind of rerunning the connectAllNodes() when it sees a change?

I don't fully understand what do you mean by this.

Your script is also a bit confusing. For example you didn't include the definition for SmaaNode, but you included a definition for a node called "CubemapRendererNode_SkyboxWorkspace0" which is not used in a workspace at all.

Your scripts are also really old. They seem to be from 2.1 version. We have load and store actions to clear render targets now; which are much more mobile friendly.

But regardless, I think I spotted your problem:

Code: Select all

connect_external 0 DynamicCubemapRenderingSkyboxNode0 0
connect_output DefaultFinalComposition 1

In the first line you connect the external texture 0 to DynamicCubemapRenderingSkyboxNode0's channel 0. You intended this to be your cubemap (which it should've already been rendered).
In the second line, you also connect the external texture 0 to DefaultFinalComposition. You intended this to be the render window.

One of those two must be wrong. I think you meant to write:

Code: Select all

connect_external 0 DynamicCubemapRenderingSkyboxNode0 0
connect_external 1 DefaultFinalComposition 1

// Or alternatively (this depends on what you're suplying from C++):
connect_external 1 DynamicCubemapRenderingSkyboxNode0 0
connect_external 0 DefaultFinalComposition 1

Cheers

Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 237
Joined: Thu Oct 14, 2010 12:30 pm
x 58

Re: Compositor workspace not showing when enabled

Post by Hotshot5000 »

Yes I am using Ogre 2.1. I cannot move to a newer version for now.

Do you mean between launches you don't see any difference, or you're editing the compositor in C++ in realtime and after the changes, those changes are not reflected in the workspace?

The script is edited offline. I have 2 workspaces and first I enable the defaultWorkspace and then when you select New Game it adds the SkyboxWorkspace0 and enables it. The new workspace doesn't show up and the last one remains in place.

But I think I understand now.. I'm using connect_external 0 in 2 places, one with the renderwindow and one with the cubemap. So it's probably rendering into the cubemap and so nothing shows in the renderwindow, which would explain the behavior, as there is nothing to update the renderwindow.

I forgot to add the SMAANode. It's the same from the SMAA sample.

EDIT: Tested now and it's working. I should have read the docs more carefully, it says there that connect_external 0 is the same as connect_output. Thank you for your help!