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.
Ghosted Entities Behind Effect
-
- Kobold
- Posts: 37
- Joined: Mon Mar 07, 2011 2:30 pm
Ghosted Entities Behind Effect
- Attachments
-
- $ShaderExample.png (120.14 KiB) Viewed 895 times
-
- Halfling
- Posts: 40
- Joined: Thu Aug 30, 2012 1:43 pm
- Location: France
- x 3
Re: Ghosted Entities Behind Effect
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, ...?)
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
-
- Kobold
- Posts: 37
- Joined: Mon Mar 07, 2011 2:30 pm
Re: Ghosted Entities Behind Effect
So you mean I should render the characters 2 times in diffrent render orders?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, ...?)
let's say walls are render at queue 25, "Clone of character ( ghost )" at 26 and Real character at 27 ?
-
- Halfling
- Posts: 40
- Joined: Thu Aug 30, 2012 1:43 pm
- Location: France
- x 3
Re: Ghosted Entities Behind Effect
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.
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.
-
- Kobold
- Posts: 37
- Joined: Mon Mar 07, 2011 2:30 pm
Re: Ghosted Entities Behind Effect
Understood, so let's see.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.
- 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 )
Code: Select all
pass behind
{
depth_write off
depth_check off
texture_unit
{
texture OUTLINE_BLUE.DDS
env_map spherical
}
}
Last edited by Treon on Fri Aug 15, 2014 2:58 pm, edited 1 time in total.
-
- Kobold
- Posts: 37
- Joined: Mon Mar 07, 2011 2:30 pm
Re: Ghosted Entities Behind Effect
What I just notice the problem, SceneBlend and add values to the existing scene content.. Now all is working just fine
Thank you
Thank you
Last edited by Treon on Fri Aug 15, 2014 2:57 pm, edited 1 time in total.