Hi! Ok, let's say I have a large map, with: terrain, ocean, montains and hills and dales.
like this picture
I need to render it into minimap (or global map for ui), how to make this ?
in result i want to see someting like this pic
added later:
trying to think step by step
1. need slice map into cells (regions)
2. capture each cell(region) as top-down picture (ortho camera)
3. save each picture to file
4. joint all pictures in Gimp into global map
my's 1st Q: how to save picture from camera into picture file ?
Re: How to generate minimap?
#2Far as i know Crytek is redoing the Minimap feature. Best to wait for that? You can always fake it in the engine ofcourse by sending map coordinates to scaleform and move the map there. Display the DSS with alpha properties within a circle / rectangle in the corner.
To capture the viewport simplely navigate upwards to desired height and use the r_getscreenshot = 2 cvar.
To capture the viewport simplely navigate upwards to desired height and use the r_getscreenshot = 2 cvar.
Re: How to generate minimap?
#3Thx lavizh for reply, but until we waiting till crytech implement this feature, we could find own solutuon for this minimapGenerator.
I got Screenshoot writer for now from active camera
Do you know how to create orthographic camera in Cryeinge?
I think I somewhere nearly to getting ortho, but do not know exactly how
with FOV = 0 do not do the trick(
I got Screenshoot writer for now from active camera
void GlobalMinimapGenerator::Generate()
{
#ifdef VISUAL_DEBUG
static IPersistantDebug* debug = gEnv->pGameFramework->GetIPersistantDebug();
debug->Begin("GlobalMinimapGenerator", true);
debug->Add2DText("GlobalMinimapGenerator::Generate()", 2.0f, ColorF(1, 1, 1), 4.0f);
#endif
ICameraManager* m_pCameraManager = gEnv->pSystem->GetIPluginManager()->QueryPlugin<IPlugin_CryDefaultEntities>()->GetICameraManager();;
//m_pCameraManager->AddCamera(m_pCameraComponent);
m_pCameraManager->SwitchCameraToActive(m_pCameraComponent);
const char* filename = "screenshoot1.jpg";
char sFileName[_MAX_PATH];
cry_sprintf(sFileName, "%s/MinimapGenerator", PathUtil::GetGameFolder().c_str());
CryCreateDirectory(sFileName);
cry_sprintf(sFileName, "%s/MinimapGenerator/%s", PathUtil::GetGameFolder().c_str(), filename);
const int iWidth = gEnv->pRenderer->GetWidth();
const int iHeight = gEnv->pRenderer->GetHeight();
uint32* m_RGB = new uint32[3 * iWidth * iHeight];
gEnv->pRenderer->ReadFrameBuffer(m_RGB, iWidth, iHeight, true, EReadTextureFormat::RGB8);
//bool bOk = gEnv->pRenderer->WriteTGA((byte*)&m_RGB[0], iWidth, iHeight, sFileName, 32, 32);
bool bOk = gEnv->pRenderer->WriteJPG((byte*)&m_RGB[0], iWidth, iHeight, sFileName, 24);
delete[] m_RGB;
hmm, but i need few screenhots, captured one by one, moreover I needed special setup for camera (2d ortho view), this allow me to joining screenshots in 2d editor seamless.To capture the viewport simplely navigate upwards to desired height and use the r_getscreenshot = 2 cvar.
Do you know how to create orthographic camera in Cryeinge?
I think I somewhere nearly to getting ortho, but do not know exactly how
with FOV = 0 do not do the trick(
// How setup ortho Camera ?
CCamera& m_camera = CCamera(m_pCameraComponent->GetCamera());
const CCamera& systemCamera = gEnv->pSystem->GetViewCamera();
float m_nearPlane = systemCamera.GetNearPlane();
float m_farPlane = systemCamera.GetNearPlane();
//m_camera.SetFrustumVertices()
m_camera.SetFrustum(systemCamera.GetViewSurfaceX(), systemCamera.GetViewSurfaceZ(), 0.0f, m_nearPlane, m_farPlane, systemCamera.GetPixelAspectRatio());
m_camera.SetMatrix(GetWorldTransformMatrix());
gEnv->pSystem->SetViewCamera(m_camera);
// Camera
Re: How to generate minimap?
#4Here you have two choices
Scaleform :
Load UI and map locations and images
(C++)
call scaleform events update camview each tick
or
Shaders:
In render loop...
Clear the render target view
Tell cry engine to use the shader for the next render-able object
Set up the view
position the object in the mini-map
Render the geometry
draw to screen
I don't have cry engine source code to check your arguments but i believe that is whats wrong with your code..
Scaleform :
Load UI and map locations and images
(C++)
call scaleform events update camview each tick
or
Shaders:
In render loop...
Clear the render target view
Tell cry engine to use the shader for the next render-able object
Set up the view
position the object in the mini-map
Render the geometry
draw to screen
I don't have cry engine source code to check your arguments but i believe that is whats wrong with your code..
Re: How to generate minimap?
#5I need only this, do you know how to setup otho view for camera component?Set up the view
I need render world map -> few pictures -> then I use gimp to joint it into global minimap pictureHere you have two choices
and then i just render part of global minimap with helps IRenderAuxImage
Code: Select all
IRenderAuxImage::DrawImage(x, y,
screenSize.x, screenSize.y, iTextureID,
0.0f, 1.0f, 1.0f, 0.0f,
color.r, color.g, color.b, fAlpha, false);
I need somehow to setup ortho view for camera to keep going testing my generator, with perpective's view this is problem
you may take a look my generator, it slice map into few cells with same size and trying to capture each, and save each to file
this consume few frames after I press F11 key in editor
Re: How to generate minimap?
#6For orthographic camera projection you may need to modify the camera view matrix manually by using the GitHub source engine.
The world map you provide there looks to be hand finished, some parts like the general geometry and roads were probably traced.
For displaying the map, Scaleform is most likely the way to go unless you want to code your own UI system
.
The world map you provide there looks to be hand finished, some parts like the general geometry and roads were probably traced.
For displaying the map, Scaleform is most likely the way to go unless you want to code your own UI system

Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.
My personal belongings;
Beginner Guides | My GitHub | Splash Plugin
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.
My personal belongings;
Beginner Guides | My GitHub | Splash Plugin
Re: How to generate minimap?
#7Thx Cry-Flare for reply!
Could you plz point to me to code (cpp files, lines) where exaclty I need set otho matrix?
I think I need made just custom camera class, and on Update-event feeds the CCamera struct with right data for ortho view, Is am right ?
And secondly, why CCamera class do not provide helpers for construct othro view only perspective helpers? Could you plz reminds to cryengeeners to add such handy functional to CCamera ? Or even just add Ortho camera component in future releases of cryengine (it's a bit funny, but even isometric template that provided by cryengine, uses perspective camera, in my opinion isometric means ortho view with some angle)
Could you plz point to me to code (cpp files, lines) where exaclty I need set otho matrix?
I think I need made just custom camera class, and on Update-event feeds the CCamera struct with right data for ortho view, Is am right ?
And secondly, why CCamera class do not provide helpers for construct othro view only perspective helpers? Could you plz reminds to cryengeeners to add such handy functional to CCamera ? Or even just add Ortho camera component in future releases of cryengine (it's a bit funny, but even isometric template that provided by cryengine, uses perspective camera, in my opinion isometric means ortho view with some angle)
Yep, after all... after I'll have whole peaces of the global map I may paint on it someting, even by hand )The world map you provide there looks to be hand finished, some parts like the general geometry and roads were probably traced.
Re: How to generate minimap?
#8I'm not a rendering engineer and unfortunately can't provide precise edits necessary. Speaking to an engineer here though it may be a little more difficult as certain parts of the rendering systems might be affected.
Generally though, you will want to modify the file `Code\CryEngine\CryCommon\CryMath\Cry_Camera.h`to allow the use of Orthographic matrices. Then there may be other modifications necessary to the renderer to fix visual artifacting caused by these changes.
Generally though, you will want to modify the file `Code\CryEngine\CryCommon\CryMath\Cry_Camera.h`to allow the use of Orthographic matrices. Then there may be other modifications necessary to the renderer to fix visual artifacting caused by these changes.
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.
My personal belongings;
Beginner Guides | My GitHub | Splash Plugin
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.
My personal belongings;
Beginner Guides | My GitHub | Splash Plugin
Re: How to generate minimap?
#9Hey I don't know if this will still be helpful at all but whatever. I think you can fake the effect for are looking for by putting the camera really high up and the FOV very low (0). I would upload the image of what I got but I honestly don't know how lol. It was able to get rid of x and y dimensions in the screenshot though if that makes any sense.
BASIC CODE:
BASIC CODE: