Ghosted Entities Behind Effect

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Treon
Kobold
Posts: 37
Joined: Mon Mar 07, 2011 2:30 pm

Ghosted Entities Behind Effect

Post by Treon »

Been trying to achieve the render behind wall effect from Torchlight 2 and found this example http://ogre3d.org/tikiwiki/tiki-index.p ... r+Entities

Would it be possible to have the red part of the material merge with the black part? Meaning if the red part were partially transparent then the black part would come through.

To achieve this effect, as you can see the terrain blends with the blue transparent "behind wall" effect.
Attachments
$ShaderExample.png
$ShaderExample.png (120.14 KiB) Viewed 894 times
Syniurge
Halfling
Posts: 40
Joined: Thu Aug 30, 2012 1:43 pm
Location: France
x 3

Re: Ghosted Entities Behind Effect

Post by Syniurge »

Wouldn't three render queues do the trick?
  • Earliest for terrain, walls, ...
  • Mid for ghost entities with depth check and depth write disabled
  • Latest for entities supposed to mask ghost entities (characters? flames, shots, ...?)
Here's the possible values for setRenderQueueGroup() fyi:

Code: Select all

enum RenderQueueGroupID
{
            /// Use this queue for objects which must be rendered first e.g. backgrounds
    RENDER_QUEUE_BACKGROUND = 0,
            /// First queue (after backgrounds), used for skyboxes if rendered first
    RENDER_QUEUE_SKIES_EARLY = 5,
    RENDER_QUEUE_1 = 10,
    RENDER_QUEUE_2 = 20,
    RENDER_QUEUE_WORLD_GEOMETRY_1 = 25,
    RENDER_QUEUE_3 = 30,
    RENDER_QUEUE_4 = 40,
            /// The default render queue
    RENDER_QUEUE_MAIN = 50,
    RENDER_QUEUE_6 = 60,
    RENDER_QUEUE_7 = 70,
    RENDER_QUEUE_WORLD_GEOMETRY_2 = 75,
    RENDER_QUEUE_8 = 80,
    RENDER_QUEUE_9 = 90,
            /// Penultimate queue(before overlays), used for skyboxes if rendered last
    RENDER_QUEUE_SKIES_LATE = 95,
            /// Use this queue for objects which must be rendered last e.g. overlays
    RENDER_QUEUE_OVERLAY = 100, 
            /// Final possible render queue, don't exceed this
    RENDER_QUEUE_MAX = 105
};

#define OGRE_RENDERABLE_DEFAULT_PRIORITY  100
Treon
Kobold
Posts: 37
Joined: Mon Mar 07, 2011 2:30 pm

Re: Ghosted Entities Behind Effect

Post by Treon »

Earliest for terrain, walls, ...
Mid for ghost entities with depth check and depth write disabled
Latest for entities supposed to mask ghost entities (characters? flames, shots, ...?)
So you mean I should render the characters 2 times in diffrent render orders?

let's say walls are render at queue 25, "Clone of character ( ghost )" at 26 and Real character at 27 ?
Syniurge
Halfling
Posts: 40
Joined: Thu Aug 30, 2012 1:43 pm
Location: France
x 3

Re: Ghosted Entities Behind Effect

Post by Syniurge »

By characters I meant the other non ghost characters if there are any.

Actually for your initial question the wiki says enough, simply putting the ghosted entities in a late render queue and disabling depth check and depth write in their materials will work, you'll see the terrain through the ghost entity.

But that may look weird if a non-ghost character is closer to the camera than a ghost entity because that ghost entity being drawn later it will appear "in front" of the non-ghost character despite being behind.
Treon
Kobold
Posts: 37
Joined: Mon Mar 07, 2011 2:30 pm

Re: Ghosted Entities Behind Effect

Post by Treon »

Syniurge wrote:By characters I meant the other non ghost characters if there are any.

Actually for your initial question the wiki says enough, simply putting the ghosted entities in a late render queue and disabling depth check and depth write in their materials will work, you'll see the terrain through the ghost entity.

But that may look weird if a non-ghost character is closer to the camera than a ghost entity because that ghost entity being drawn later it will appear "in front" of the non-ghost character despite being behind.
Understood, so let's see.
  • Material have disabled depth check and depth write
  • World is rendered in queue ( RENDER_QUEUE_WORLD_GEOMETRY_1 )
  • Character rendered in queue ( RENDER_QUEUE_6 )
Material code for pass

Code: Select all

pass behind
{
	depth_write off
	depth_check off
	texture_unit
	{
		texture OUTLINE_BLUE.DDS
		env_map spherical
	}
}
As you can see by the result, I'm standing behind a stone and the stone material is not visible. May it be the texture who causes it from behind pass ?
Last edited by Treon on Fri Aug 15, 2014 2:58 pm, edited 1 time in total.
Treon
Kobold
Posts: 37
Joined: Mon Mar 07, 2011 2:30 pm

Re: Ghosted Entities Behind Effect

Post by Treon »

What I just notice the problem, SceneBlend and add values to the existing scene content.. Now all is working just fine :D

Thank you
Last edited by Treon on Fri Aug 15, 2014 2:57 pm, edited 1 time in total.
Post Reply