Jump to content

Render transport scheme in scene


photo

Recommended Posts

Hi!

 

I want to use orthographic camera mode for rendering transport scheme (because when it's used perspective mode some buildings in city model cover scheme) but I have not find this property in camera settings in Unigine editor (Unigine ver. 2.2).

 

How can I switch on orthographic mode? And how can I render scheme (scheme is single node) always over all?

Link to comment
Hi,
 
Ortho projection for editor camera was temporary disabled in Unigine 2, sorry for that. It will be fixed in 2.3 update.
 
Sorry for the inconvenience caused.

 

And how can I render scheme (scheme is single node) always over all?

 

There are several answers. Please describe your issue and expected result in more details. 
Transport scheme - what kind of node and material you use? Do you need translucent view or something else. 
Simple test scene or at least screenshot would be useful for us.
Link to comment

Hi,

 

Ortho projection for editor camera was temporary disabled in Unigine 2, sorry for that. It will be fixed in 2.3 update.

 

Sorry for the inconvenience caused.

Oh, it's a pity. And when 2.3 update will release?

 

There are several answers. Please describe your issue and expected result in more details. 

Transport scheme - what kind of node and material you use? Do you need translucent view or something else. 

Simple test scene or at least screenshot would be useful for us.

Hm, let me explain on this example (on the screenshot):

I need that white plane overlaps all geometry in scene. Polygon offset does similar effect, but I need that this effect isn't limited by distance.

post-2051-0-89711400-1459163495_thumb.png

Link to comment

Hi,

 

Sorry for late reply
 

Oh, it's a pity. And when 2.3 update will release?

ETA - end of june.

 

I need that white plane overlaps all geometry in scene. Polygon offset does similar effect, but I need that this effect isn't limited by distance.

 

Please check sample scenes attached overlap_sample.zip.

 

  • scene_simple: expected result achieved by using visualizer.renderSolidObject() method. Besides, we disable visualizer depth test ("show_visualizer 2" command). The problem is that you can't set texture for object (using this method)
  • scene_advanced: (preferable) We add new WidgetSpriteViewport where only objects with exact viewport mask (0x02) should be rendered.
Link to comment
  • 4 weeks later...

Thanks for your help, it's very useful.

 

I decided to use a WidgetSpriteViewport, but it was reduced performance (my scheme is pretty big): I had lost 3-5 fps and when I dragged camera fast (camera's velocity about 1000-1500) the scheme had moved with inertia. Also, my scheme renders overlap user interface (see screenshot).

 

How may I solve these problems?

post-2051-0-35633600-1461571965_thumb.png

Link to comment
Hi,

 

Thanks for the scene!

 

As for overlaping problem, please, add GUI_ALING_BACKGROUND to your widget's code. So 29 line in unigine_project.cpp should be: 

engine.gui.addChild(sprite,GUI_ALIGN_OVERLAP | GUI_ALIGN_BACKGROUND | GUI_ALIGN_RIGHT);

 

As for the problem with inertia of scheme, we're still investigating it.

Link to comment
I'm afraid, due to the current realization of the WidgetSpriteViewport, there might be some problems with latency on high camera speed or with low FPS.

 

If such behavior is not suitable, you may try the following solutions:

 

1. Use widgetCanvas:

 

samples: samples/widgets/canvas_02,03

 

pros

- potentially low performance drop

- no lag

 

cons:

- have to manually set the geometry and sort vertexes

 

2. Use Viewport:

 

pros:

- no lag

 

cons:

- suitable for c++ only

- perfomance drop will be the same as with WidgetSpriteViewport

 

Step by step instruction for Viewport:

 - create Viewport and get the texture using renderTexture2D() (with viewport mask) or renderNodeTexture2D()

 - create custom post material (or you may use render_copy_2d material with additional alpha blend settings, but it's not available in editor)

 - find the texture by name using findTexture("color")

 - set the texture by setImageTexture

 - set the post material to camera

 

 

Also, we've added a feature request to our internal tracker to add an option to allow rendering the geometry over all other geometry (ETA - 2.3 release).

Link to comment
  • 9 months later...
 
Also, we've added a feature request to our internal tracker to add an option to allow rendering the geometry over all other geometry (ETA - 2.3 release).

 

 

HI!

Has this feature been released?

 

Also I have a question:

in overlap_sample with WidgetSpriteViewport you use post_deferred_color material. How is this material named now in 2.4?

Link to comment

I'm afraid not - it's still under research phase.

Oh, what a pity. And when will this feature be realesed?

 

 

Please, check the post_deferred_albedo.

Thank you.

Also I've decided to rewrite code from overlap_sample using c++ API, but when I've compiled project and launched it, I've seen only scheme on black screen (see screenshot). What must I do in order to my c++ project works as unigine script project?

post-2335-0-44391600-1487318383_thumb.png

Link to comment

Also I've decided to rewrite code from overlap_sample using c++ API, but when I've compiled project and launched it, I've seen only scheme on black screen (see screenshot). What must I do in order to my c++ project works as unigine script project?

Without seeing the whole project or small sample code it's hard to say.

 

 

Oh, what a pity. And when will this feature be realesed?

Can't say right now. In case of any updates we will surely let you know.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Without seeing the whole project or small sample code it's hard to say.

I use unigine script code from scene_advanced (overlap_sample in post 4):

 

int init() {
    sprite = new WidgetSpriteViewport(engine.getGui(), engine.app.getWidth(), engine.app.getHeight());
    engine.gui.addChild(sprite, GUI_ALIGN_OVERLAP | GUI_ALIGN_BACKGROUND | GUI_ALIGN_RIGHT);
    sprite.setColor(vec4(1.0f, 1.0f, 1.0f, 0.5f));
    sprite.setBlendFunc(GUI_BLEND_SRC_ALPHA, GUI_BLEND_ONE_MINUS_SRC_ALPHA);
    return 1;
}

int update() {
    Player player = engine.game.getPlayer();
    if (player != NULL) {
        Camera camera = player.getCamera();
        camera.setPostMaterials("post_deferred_albedo");
        camera.setViewportMask(0x02);
        sprite.setCamera(camera);
    }
    return 1;
} 
 

and I'm doing so:

 

int AppWorldLogic::init() {
    // Write here code to be called on world initialization: initialize resources for your world scene during the world start.
    GuiPtr gui = Gui::get();
    sprite = WidgetSpriteViewport::create(gui, App::get()->getWidth(), App::get()->getHeight());
    gui->addChild(sprite->getWidget(), Gui::ALIGN_OVERLAP | Gui::ALIGN_BACKGROUND | Gui::ALIGN_RIGHT);
    sprite->setColor(vec4(1.0f, 1.0f, 1.0f, 0.5f));
    sprite->setBlendFunc(Gui::BLEND_SRC_ALPHA, Gui::BLEND_ONE_MINUS_SRC_ALPHA);

    return 1;
}

// start of the main loop
int AppWorldLogic::update() {
    // Write here code to be called before updating each render frame: specify all graphics-related functions you want to be called every frame while your application executes.
    PlayerPtr p = Game::get()->getPlayer();
    if (Editor::get()->getPlayer() != (PlayerPtr)NULL) p = Editor::get()->getPlayer();
    CameraPtr camera = p->getCamera();
    camera->setPostMaterials("post_deferred_albedo");
    camera->setViewportMask(0x02);
    sprite->setCamera(camera);

    return 1;
} 
After compilation I've seen scheme on black screen (screenshot in previous post) although I expect to see normal background (screenshot in this post)

post-2335-0-50245600-1487325581_thumb.png

Link to comment
×
×
  • Create New...