OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Ghosted Entities Behind Other Entities
View page
Source of version: 5
(current)
This snippet covers producing the following effect as originally discussed in [http://www.ogre3d.org/forums/viewtopic.php?f=5&t=60919|this forum thread]: When an object (e.g. a character) is behind a certain other object (e.g. a wall or the roof), the occluded object will appear visible, but have a different appearance than it would have had when being visible in the normal way. This is often used in games such as Torchlight - when your character is behind a wall from the point of view of the camera, he or she will be displayed as a faint blue silhouette. !!!screenshots The first image shows the scene as it looked before applying the effect: Half of the Ogre head is occluded by the black plane and therefore invisible from the camera's point of view. On the second screenhot, the below listed material has been applied to the Ogre skin. On the third and last shot, you see a modified version of the listed material, to better understand the previous screenshots since it offers more "3D feeling". {img fileId="1940" thumb="y" alt="" rel="box[g]"} {img fileId="1941" thumb="y" alt="" rel="box[g]"} {img fileId="1942" thumb="y" alt="" rel="box[g]"} !!!material script {CODE(wrap="1")} material behindmat { technique { pass behind { ambient 1 0 0 diffuse 0 0 0 depth_write off depth_check off } pass infront { ambient 0 0 1 diffuse 0 0 0 depth_write on depth_check on } } }{CODE} The {LEX()}material{LEX} {LEX()}pass{LEX} "infront" will define the appearence of the normal visible parts of the object. The pass "behind" will be used for parts of the object that are occluded. Then in your code, set the ghoster / occluder entity (e.g. wall or roof) to "RENDER_QUEUE_WORLD_GEOMETRY_1" and the ghosted / occluded entity (character, etc.) to "RENDER_QUEUE_6": {CODE(wrap="1", colors="c++")} pRoofEnt->setRenderQueueGroup(RENDER_QUEUE_WORLD_GEOMETRY_1); pCharacterEnt->setRenderQueueGroup(RENDER_QUEUE_6); {CODE} There is no need to implement RenderTargetListener or have the entity in dual queues or anything that complicated.
Search by Tags
Search Wiki by Freetags
Latest Changes
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
...more
Search
Find
Advanced
Search Help
Online Users
88 online users