[2.2] Using HLMS Unlit in render_quad compositor pass?

Problems building or running the engine, queries about how to use features etc.
Post Reply
mrmclovin
Gnome
Posts: 324
Joined: Sun May 11, 2008 9:27 pm
x 20

[2.2] Using HLMS Unlit in render_quad compositor pass?

Post by mrmclovin »

Ogre Version:2.2 :?:
Operating System:macOS :?:
Render System:Metal :?:

The compositor at OgreMain/src/OgreScriptTranslator.cpp:9163 suggest that one can add a "hlms" property instead of "material", e.g.

Code: Select all

        pass render_quad
        {
            quad_normals    camera_direction
            hlms mymaterial
        }
But I keep getting the exception
Ogre::UnimplementedException: OGRE EXCEPTION(9:UnimplementedException): Trying to use slow-path on a desktop implementation. Change the RenderQueue settings. in HlmsUnlit::fillBuffersFor
OgreMain/src/Compositor/Pass/PassQuad/OgreCompositorPassQuad.cpp:284 seems to be calling _renderSingleObject() which calls HlmsUnlit::fillBuffersFor() which doesn't seem to be implemented.

By looking at the code I'm very confused what I should expect.

1. What's the difference between fillBuffersFor(), fillBuffersForV1(), fillBuffersForV2() ?
2. OgreCompositorPassQuad (CompositorManager2) seems to be working with v1::Rectangle2D and not the v2 rectangle. What does that mean?
3. I'm trying to render a small viewport with red background on top of the "main" viewport (that covers the whole screen. Is render_quad really what I'm looking for?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5588
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1413
Contact:

Re: [2.2] Using HLMS Unlit in render_quad compositor pass?

Post by dark_sylinc »

Hi!
3. I'm trying to render a small viewport with red background on top of the "main" viewport (that covers the whole screen. Is render_quad really what I'm looking for?
Yes
The compositor at OgreMain/src/OgreScriptTranslator.cpp:9163 suggest that one can add a "hlms" property instead of "material", e.g.
That's true, but that was added in the case a custom Hlms implementation wants to be used with a render_quad pass and has to be written specifically for it.
The default implementations (Pbs and Unlit) were not design to be used with render_quad

If you want to render a render quad, use a regular "low level" material (see Samples/Media/2.0/scripts/materials/TutorialSky_Postprocess) and change SkyPostprocess_ps.hlsl/glsl/metal to return a solid red colour:

Code: Select all

#version 330
uniform vec4 myColour;
out vec4 fragColour;
void main()
{
	fragColour = myColour;
}

Code: Select all

uniform float4 myColour;
float4 main( PS_INPUT inPs ) : SV_Target0
{
	return myColour;
}

Code: Select all

fragment_program SkyPostprocess_ps unified
{
	delegate SkyPostprocess_ps_HLSL
	delegate SkyPostprocess_ps_GLSL
	delegate SkyPostprocess_ps_Metal

	default_params
	{
		param_named myColour float4 1.0 0.0 0.0 1.0
	}
}
mrmclovin
Gnome
Posts: 324
Joined: Sun May 11, 2008 9:27 pm
x 20

Re: [2.2] Using HLMS Unlit in render_quad compositor pass?

Post by mrmclovin »

dark_sylinc wrote: Sun Jun 28, 2020 8:25 pm Hi!
3. I'm trying to render a small viewport with red background on top of the "main" viewport (that covers the whole screen. Is render_quad really what I'm looking for?
Yes
The compositor at OgreMain/src/OgreScriptTranslator.cpp:9163 suggest that one can add a "hlms" property instead of "material", e.g.
That's true, but that was added in the case a custom Hlms implementation wants to be used with a render_quad pass and has to be written specifically for it.
The default implementations (Pbs and Unlit) were not design to be used with render_quad

If you want to render a render quad, use a regular "low level" material (see Samples/Media/2.0/scripts/materials/TutorialSky_Postprocess) and change SkyPostprocess_ps.hlsl/glsl/metal to return a solid red colour:

Code: Select all

#version 330
uniform vec4 myColour;
out vec4 fragColour;
void main()
{
	fragColour = myColour;
}

Code: Select all

uniform float4 myColour;
float4 main( PS_INPUT inPs ) : SV_Target0
{
	return myColour;
}

Code: Select all

fragment_program SkyPostprocess_ps unified
{
	delegate SkyPostprocess_ps_HLSL
	delegate SkyPostprocess_ps_GLSL
	delegate SkyPostprocess_ps_Metal

	default_params
	{
		param_named myColour float4 1.0 0.0 0.0 1.0
	}
}
Cheers!

Btw, If I were to refactor the PassQuad (and compositor manager) on my fork to use the Rectangle2D2 (and thus it would work with HLMS?), would that be fairly straight forward or would that implicate a lot of refactor for the rest of the code base?
Post Reply