demostenes Posted August 7, 2018 Share Posted August 7, 2018 (edited) I ve tried to create simple small terrain for manual editing (we usually use these as floor in dungeon, so it is 100% manual work). I ve used landscape tool, but there is no option to create just blank flat terrain. So I ve loaded some height map (i dont need albedo in this case), put size, normalized height to interval 0-0.1 to make it flat. But now I have problem, that if I add detail layer for painting, there is no mask, so I cant paint. Same issue with migrated terrain, If I add new layer, I cant add mask for it (I see only migrated masks). Is it not possible, or am I doing something wrong? So questions: 1) It is possible to somehow create just blank terrain like with previous object terrain without workarounding it via flatting imported height map? 2) How can I add detail mask for terrain? I understand I can prepare something in landscape tool in advance, but I want to add mask on the fly (just empty for manual painting, or load something), I never know in advance how many layers I will need (mask via albedo is fantastic feature, but not for this use case). Is it somehow possible? Simillar workflow as was in object terrain. This is exactly opposite workflow than via landscape tool. First I draw detail textures and then I generate terrain albedo if needed (in dungeon case usually not). 3) Export masks. I know currently it is not supported again, but it is quite handy. For example I decide to retexture whole terrain (better HW, so I can have more layers, etc...), but I want to keep manually created layers like various muds/stones in cities...In case I cant export, many and many hours of work is lost. Terrain workflow for game is always procedural start and manual finetuning, so we cant be 100% procedural. Thanks. Edited August 7, 2018 by demostenes Link to comment
morbid Posted August 8, 2018 Share Posted August 8, 2018 Hello demostenes, unfortunately, you can't just draw terrain from a scratch. You'll need some raster sources for this. 6 hours ago, demostenes said: 1) It is possible to somehow create just blank terrain like with previous object terrain without workarounding it via flatting imported height map? Nope, the easiest way is using black raster file for elevation. 6 hours ago, demostenes said: 2) How can I add detail mask for terrain? You still require a raster file for this. You can use RGBA files for storing 4 different masks (each in a separate channel). Right now there's no possibility of in-editor mask creation. Possible workaround without generation could be Mask by albedo feature, but it won't give you overlapping layers: https://developer.unigine.com/en/docs/2.7.1/objects/objects/terrain/terrain_global/details/. 6 hours ago, demostenes said: 3) Export masks. I know currently it is not supported again, but it is quite handy. Yes, we understand that this is causing a lot of troubles. The current workaround is saving TerrainGlobal into a node reference (you\ll keep all details settings in node file) and regenerating it with new masks (layers). Task on such feature was already described but can't say when will it be done. More likely it'll come with new terrain. Just in case you haven't seen the post, here is the new tutorial for Landscape tool: https://www.youtube.com/watch?v=L_Wb-oylt_Y Thank you for the feedback! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
demostenes Posted August 8, 2018 Author Share Posted August 8, 2018 Thanks for quick answer. I ve seen tutorial, it is nice. The biggest problem is, that I cant add mask. Current workflow supports very well rasterdata->terrain, but also opposite direction is needed. For now we can somehow workaround by preparing for example 4 empty masks and height map and use it as "template" for typical paintable terrain, but there is no flexibility in this and in case level designer finds during his work, that he needs 6 layers, he has to do everything again? This is creative work, you cant plan everything in advance. Also I cant add layers to migrated terrain, I have to rework it from scratch and once we start some manual mask modifications, I cant add new layer anymore (or I will lost changes). I can probably workaround by making empty layers and use them in future when needed, but this is not flexible. Why did you remove option to add layers (masks) according to need? New terrain? Can you be more specific, when do you plan it? I have to rework main terrain from scratch, so If you are planning new terrain, maybe it would make sense to wait? Link to comment
morbid Posted August 8, 2018 Share Posted August 8, 2018 1 hour ago, demostenes said: Why did you remove option to add layers (masks) according to need? Well, we didn't remove it. TerrainGlobal just never had such option. I'm afraid masks pre-generation remains the best workaround. 1 hour ago, demostenes said: New terrain? Can you be more specific, when do you plan it? It was planned for 2.8 release, but I can't say when exactly will it come. It's in R&D stage right now. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
demostenes Posted August 8, 2018 Author Share Posted August 8, 2018 (edited) Ok, thans for explanation. We would write such mask export tool ourselves, but we need information how are these data stored. Can you provide us this info? Thanks. Edited August 8, 2018 by demostenes Link to comment
morbid Posted August 10, 2018 Share Posted August 10, 2018 Well, it could be a challenging task. If you want to save or export terrain data you'll have to work with the tileset. These articles could be useful: General info on terrain files structure - https://developer.unigine.com/en/docs/2.7.2/objects/objects/terrain/terrain_global/ Tileset API https://developer.unigine.com/en/docs/2.7.2/api/library/objects/class.tileset and https://developer.unigine.com/en/docs/2.7.2/api/library/objects/class.tilesetfile TerrainGlobal is a much more complicated object (compared to ObjectTerrain) mostly due to the insets feature. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
demostenes Posted August 10, 2018 Author Share Posted August 10, 2018 (edited) Thanks, we will look at it. Edited August 10, 2018 by demostenes Link to comment
roboch.matej Posted August 31, 2018 Share Posted August 31, 2018 Is there a way to find the resolution of a mask from ObjectTerrainGlobal? I can't find it in UnigineEditor or api docs. Link to comment
morbid Posted September 4, 2018 Share Posted September 4, 2018 Hi @roboch.matej, I'm sorry, but TerrainGlobal is an infinite object and you can't grab its resolution. You're trying to make some kind of a tool for terrain? Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
roboch.matej Posted September 4, 2018 Share Posted September 4, 2018 I am trying to extract a mask - the only way I found was to export tile by tile form tileset, but If I don't know how big the whole image is, I dont know how many tiles to export (Tileset has information about tile size, but not about tile count)... Link to comment
sergej.koptev Posted September 4, 2018 Share Posted September 4, 2018 1 hour ago, roboch.matej said: I am trying to extract a mask - the only way I found was to export tile by tile form tileset, but If I don't know how big the whole image is, I dont know how many tiles to export (Tileset has information about tile size, but not about tile count)... Maybe this code will help you. First, you need calculate indexes of valid tiles, then - process tiles itself. const auto h_lod0 = terraingl->getHeightLods()->getLod(0); const auto tileset = h_lod0->getTileset(); //-- calc tiles bounds (no such methods!) int l = 0, r = 0, t = 0, b = 0; //-- valid tiles indexes { while ( tileset->hasTile( ivec2(l,0))) --l; while ( tileset->hasTile( ivec2(r,0))) ++r; while ( tileset->hasTile( ivec2(0,b))) --b; while ( tileset->hasTile( ivec2(0,t))) ++t; ++l; --r; ++b; --t; } const int tiles_cnt_w = r-l+1; const int tiles_cnt_h = t-b+1; const int tile_res = tileset->getTileResolution(); const float tile_sz = tileset->getTileSize(); //-- processing of heightmap data { auto img = Unigine::Image::create(); img->grab(); for ( int i = l; i <= r; ++i ) for ( int j = b; j <= t; ++j ) { tileset->getTileData( ivec2(i,j), img, 1 ); float *values = reinterpret_cast<float*>(img->getPixels2D()); for ( int x = 0; x < tile_res; ++x ) for ( int y = 0; y < tile_res; ++y ) { float val = values[x+y*tile_res]; // <some other code...> } } } Link to comment
roboch.matej Posted September 4, 2018 Share Posted September 4, 2018 Ohh, thank You so much @sergej.koptev, I feel like an idiot now. Nice solution! Link to comment
roboch.matej Posted September 10, 2018 Share Posted September 10, 2018 (edited) Ok, at the moment I am done with height, alb and normals. Now I would like to export masks. I can find the count, names, basically all the information about masks, but I cannot find a method to export any detail mask. Can anyone help me? *EDIT*: Kinda dumb question, it can be done almost the same way, I was confused by all the masks being in the same LOD... Edited September 11, 2018 by roboch.matej Link to comment
Recommended Posts