Archive 17/01/2023.

Drawing static image as the background

atai

Hi, what is the best way to render a static image as the background, such that all the other rendering objects appear on top of and cover the background image, but the background image will fill the viewport and show up where no other rendering object exist? Think this background in the same manner as the static desktop background image, but here this is for the background of a viewport in a Urho3d rendering area or window

jmiller

You may want to check “Static Background in 3D Scene” thread:
topic945.html

atai

[quote=“carnalis”]You may want to check “Static Background in 3D Scene” thread:
topic945.html[/quote]

Thanks. Using a quad in the rendering path before scene pass works, as suggested in that thread.

sabotage3d

Hey guys can someone share a renderpath example for this?

1vanK

Modified Forward.xml:

[code]

<!-- Added -->
<command type="quad" vs="CopyFramebuffer" ps="CopyFramebuffer" output="viewport">
    <texture unit="diffuse" name="Textures/UrhoDecal.dds" />
</command>

<command type="scenepass" pass="base" vertexlights="true" metadata="base" />
<command type="forwardlights" pass="light" />
<command type="scenepass" pass="postopaque" />
<command type="scenepass" pass="refract">
    <texture unit="environment" name="viewport" />
</command>
<command type="scenepass" pass="alpha" vertexlights="true" sort="backtofront" metadata="alpha" />
<command type="scenepass" pass="postalpha" sort="backtofront" />

[/code]

In OpenGL texture is flipped. Also texture is stretched in full screen, so it looks different for 4x3 and 16x9 screens. U need make own shader and fix it.

sabotage3d

Thanks a lot. Works like a charm.

Petryk

Thanks for example of renderpath! Good job! Does anybody know how to create shader with fixing texture issue?