Jump to content

Forcing objects to be rendered last


photo

Recommended Posts

Hello All,

 

We are looking for a way to render objects last over the entire scene, or to somehow prevent the renderer from occluding them. The purpose of this would be to spawn a billboard object where physical contacts occur anywhere in the world, and have seen even if they are behind a wall.

 

Is there a way to do this without altering deep levels of code?

 

Cheers,

 

Ken

 

EDIT: Typo.

Link to comment

Is there a way to do this without altering deep levels of code?

WidgetSpriteViewport GUI element might be a possible approach. Basic idea would be to

 

  1. render your scene as normal without your contact billboards by propper viewport/object masking of player camera into framebuffer
  2. render only your billboard objects into additional WidgetSpriteViewport via matching viewport masks between sprite viewport and billboards. Use same modelview/projection matrix as player camera. As no scene geometry is rendered to the viewport, no occlusion of billboards will happen.
  3. blend WidgetSpriteViewport texture as transparent GUI overlay with propper blend setting into framebuffer

 

Details on propper player/viewport/object masking can be found here

Link to comment

Works great, Ulf. Only thing is the blending isnt allowing my objects rendered in the separate ViewportMask to show up as fully opaque, but I bet this is due to wrong blend flags.

 

impacts.setBlendFunc( GUI_BLEND_ONE, GUI_BLEND_ONE);

 

this is showing the best results, but not 100%

Link to comment

I would expect that src=alpha, dest=one_minus_alpha should work if assigned billboard material texture has proper alpha=1 values for opaque regions. More details on different blend mode effects can be found here. It might also be necessary to tune overall transparency parameters on GUI object (e.g Gui::setTransparent-/-Default-/-DisabledAlpha) to get full opaque overlay rendering.

Link to comment
  • 1 month later...

Could you please write, what settings you do, to realize this? We need render some special objects always on top of all scene, we write next code:

viewport = new WidgetSpriteViewport(_gui, _gui.getWidth(), _gui.getHeight()); // full screen widget
viewport.setViewportMask(0x0000004); // mask for our special objects

gui.addChild(viewport, GUI_ALIGN_OVERLAP);

this variant render our special object on blur background (instead opacity background).

We try to set

viewport.setBlendFunc(::GUI_BLEND_ONE, ::GUI_BLEND_ONE_MINUS_SRC_ALPHA); // don't change picture at all

and

viewport.setBlendFunc(::GUI_BLEND_ONE, ::GUI_BLEND_ONE); // this work like we see our scene via colored glass

Link to comment

We ended up not using this method, as we have found something better for our use (See "World space to Screen space conversion" under Programming->Graphics forum)... though this may not be suitable for what you're trying to do.

Link to comment

We ended up not using this method, as we have found something better for our use (See "World space to Screen space conversion" under Programming->Graphics forum)... though this may not be suitable for what you're trying to do.

No, it is different... we don't need any mouse interaction with this layer... we only need render game's HUD: for example, if player tale weapon in hands and go to wall, then weapon newer "enter to the wall", cause we render this weapon via next pass, after all scene is rendered. We can't look into how set bland options for WidgetSpriteViewport that it render on all scene with transparent (now it overlaps and we don't see our scene, only HUD)

Link to comment

We can't look into how set bland options for WidgetSpriteViewport that it render on all scene with transparent (now it overlaps and we don't see our scene, only HUD)

May be some variant of viewport masking can be used to achieve desired effect.

Link to comment

May be some variant of viewport masking can be used to achieve disired effect.

Thanks for link, but... I need generate masking image in every frame? How could I get black-and-white mask to use in WidgetSpriteViewport output? :)

Link to comment
×
×
  • Create New...