To build up a multi-projector display system

I want to build up a multi-projector display system.
Server can create rtsp stream for client player.
Config can save each screan by real projector position.
Client Player can load video, split images, handle edge blendering for each projector.
I am newcomer for CGE. and wonder whether CGE can do it well.
or is there any example for this ?

Hi!

Sorry for the lack of response for such a long time. I was buried in lots of CGE tasks, and admittedly your question wasn’t trivial, so I see you didn’t get an answer. Let me try :slight_smile: Here’s a teaser screenshot:

I would split the description of your application into:

  1. You want to read stream of images from the Internet.

    This part is mostly outside of CGE – though you can use our TCastleDownload ( Castle Game Engine: CastleDownload: Class TCastleDownload ) to perform HTTP(s) requests. But you can also use any other networking library that fits you.

  2. You want to define a 3D world with projectors, and some things where projectors cast their image (e.g. walls of a room, and inside this room are projectors).

    I would recommend you just set up your 3D world in the Castle Game Engine editor, and not worry about allowing user to configure the projectors, at first. Follow our manual ( Manual | Manual | Castle Game Engine ), in particular take a look at the viewport features, Viewport with scenes, camera, navigation | Manual | Castle Game Engine , to learn how to set up 3D models.

  3. You want to actually make “projector” perform its work, i.e. “cast a texture” on other 3D objects.

    More on this below – this is the interesting, non-trivial bit, but yes, you can do this with CGE.

  4. You want user to configure projectors translation/rotation.

    You can store the projectors translation/rotation in a user config using UserConfig (see Persistent data (user preferences, savegames) | Manual | Castle Game Engine ). When loading, set the projector translation (TVector3) and direction (TVector4).

AD 3 How to “cast a texture” from a projector?

The answer is to use the TProjectedTextureCoordinateNode in Castle Game Engine, that allows to cast a texture along the direction of some (maybe “fake”, i.e. used only to cast texture) light or viewpoint.

I started writing here a detailed explanation… but eventually I decided to just turn it into a complete Castle Game Engine example :slight_smile: The new example is now committed to the Castle Game Engine repository, in examples/viewport_and_scenes/projector.

It really only does one thing from code: modifies the loaded scene in SceneLevel1 to add there a TProjectedTextureCoordinateNode. The main code is in example’s code/gameviewmain.pas unit.

Please take a look at this example, and the accompanying README.md inside, I tried to explain there everything. If you’re interested in going forward, just ask – I can explain how to extend this.

To download the new engine along with this example,

Here are screenshots how it looks in editor and when working:


Hi michalis,
Thanks for you replay, I am very appreciated it. As new comer,i try to follow your instruction. but there are still some questions.

  1. when i cast image to the wall by spotlight, there is some lagging of image.

Hi, and very sorry for long delay in answering!

Indeed this was a bug in my projector example – fixed now. Thanks for reporting! It is fixed in commit Fix projector example - we need to limit texture colors to affect onl… · castle-engine/castle-engine@86a8dd7 · GitHub , details:

  • needs new helper routine CreateEffectToLimitTexture
  • and helper shader file data/shaders/limit_texture.fs
  • and applying it on texture using ProjTexture.SetEffects([CreateEffectToLimitTexture]);

Once this is done, texture doesn’t affect the calculated material color outside of the area where the texture coordinates are in 0…1 range – this was the source of the problem.

Here are pictures with the projector location/direction that I used to reproduce the problem. First image is before the fix, 2nd image is after the fix :slight_smile:

The fix is committed to Castle Game Engine. It will be available in engine downloads ( Download | Castle Game Engine ) shortly. You can watch this page Comparing snapshot...master · castle-engine/castle-engine · GitHub , when it will no longer contain the commit titled “Fix projector example - we need to limit texture colors…” then it means the fix is part of engine release.