Jump to content

DungeonBlock and LightMap: set Gr2 Model for .prd


Recommended Posts

  • Contributor

1115201617196065354.png

 

 

 

PLEASE NOTE: THIS GUIDE WAS MADE BY @TokiSan AND @arves100

 


The DungeonBlock is a type assigned to specific objects that are used in dungeons on metin2, are characterized by a lightmap that is associated with the basic texture, giving particular effects, have their own extension in the property and are not interchangeable with the gr2 present in the Building.


1. Foreword


I start by saying that the following procedure seems to be very expensive:

1124081617193114623.png

I will introduce about the DungeonBlock, explaining how it is used in the objects of metin2 and what's the peculiarity.

Let's start by saying that the object/mount /pet/monster/weapon/player used on Metin2 have all a .gr2 extension and most of the time, we can simply have a preview of the object through the granny viewer:

1115201617193125867.png

In the case of the DungeonBlock instead it is not possible to have a preview of the textures, this is because the textures are linked together in a way that the tool cannot process, which is why they are seen white:

1115201617193247176.png

 

2. What changes compared to normal gr2?


Let's go and see carefully.

If we make a comparison with the textures, we notice that they are present (the path is right!), Except that there is a texture in particular, in common for each object that falls within the DungeonBlock, this texture will not be visible and is the cause of the white texture:

1115201617193288849.png

The "light_passC_pole.dds", which we see highlighted, corresponds to the light map that allows the object to exploit a combination of lights/shadows present in a separate texture and superimpose them on the base texture, thus creating a particular effect that the normal objects cannot get:

1115201617193305124.png

The squares highlighted in blue show the light that is obtained from the specific texture

Here we have a clear example, it is an object present in the new snake dungeon:

1115201617193330898.png

In fact, the object cannot be seen with its textures in the granny viewer, but it is possible instead in the world editor.


Returning to our DungeonBlock type present in the world editor we can see that they have a different extension:

1115201617193378626.png


The ".prb" (property building) are the typical extension of the "Building" the normal gr2 that we normally put in the maps (rocks, houses, bridges), the ".prd" (property dungeons) are typical instead of the "DungeonBlock" .


Trivially we might think that the gr2 present in the Buildings are the same as those present in the DungeonBlock, but this statement is incorrect, the proof is that creating a .prd with a .gr2 typically classified as a Building, will not show the object.

 

3. File management inside maps


The rendering of our maps on Metin2, as you all know, the map will load different objects based on configurations managed in classic txt.
Each of our objects is contained in a particular folder (property) including our dungeon blocks, which differ relatively little from the classic building as regards the format (we have the type change and the gr2 model which has a different name than building ).
Dungeonblocks are an extension of Ymir's approach to classic gr2 models.

Render of the buildings
Normally, during the rendering of a building, the game is limited to rendering the 3d model supporting only one texture in our materials, that is the diffuse map.
The rendering of the shadow is managed by drawing the shape of our 3d model on the widespread map of our terrain, that is, based on our vertices, a fusion with a black color is applied in the texture of our terrain (here the ambient light that basic metin2 has).

112622f2.png


Render of the dungeon block
The dungeonblocks, on the other hand, are rendered with the use of a second texture (the "light map"), this texture will be fused (a blend) with the base texture, and will allow us to create lighting effects.
The shadow rendering is very particular, because Metin2 invisibly renders a second model (of which only the vertices will be invisible), in this way not only will the rendering of the base shadow be ignored, but the customized settings will also be applied. of the light.
Since the color of the light at maximum intensity is white, the alpha of our textures will be ignored and replaced with a highlight color, for this reason (even in the worldeditor) these objects ignore the ambient light. (but theoretically not a problem as we shouldn't see outside the dungeon)

112622f.png


4. Considerations


Probably this lightmap was created to be able to exploit multiple points of light without having to touch or change the base ambient light, which could have general problems if it had not been ignored.

Of all that I have talked about it is possible to find the operation on EterGrnLib / ThingInstance.cpp for basic objects (including the building), while the dungeonblocks are found in GameLib / DungeonBlock.cpp (which makes special calls to the DirectX8 render) , the render of the map (and of the base shadow) can be found in GameLib / MapOutdoor.cpp

5. 3ds Max

To start we need:

-3ds max (I use 2018)
-A model to export as a dungeonblock
-A computer that doesn't explode (preferably)


Let's create a new project and import our object. Let's insert the textures and once this is done, head to the quick controls panel on the right, go to the create section (indicated with the "+" sign) and go to the "Photometric" subsection, choosing the type of lighting you want to insert. In my case I will use the "Free Light":

1134183.png

Once the light points have been inserted, we go to the bar at the top, click Rendering, then Render to Texture.
Once here, a table will appear in which many things are entered. First of all we have to select the object in question, in the input section it will be highlighted.
Let's focus on the window called output and click "Add", here we indicate the LightMap as an output map and indicate the path in which we want to save the texture, once this is done, click the render button:

1134186.png


PLEASE NOTE: the more complicated the object, the longer the rendering time will be to render the object. For more complex objects it is necessary to have better performing computers (unless you want to make your PCs go to a bad end)

In this way we will have created the texture of the LightMap. But that's not all, because metin2 is "special" and has its own way of reading it.
We must in fact go to modify the material of our object, and use the blending option to link the normal texture with the lightmap. this operation must be done for each single texture, the result must be this:

1134188.png

PLEASE NOTE: while for materials and textures you can leave the default name (Material # 1, Map # 1) for blending operations you must write Blend_x, otherwise the game will not recognize it.

Once this part is done, it's time to export our object. We have said in previous times that a dungeonblock cannot be a building, this is because, when the object is to be exported as a dungeonblock it changes a parameter in the mesh. "Coords per vertex" by default is set to one, to make our mesh a dungeonblock it is necessary to set it to at least two:

1134189.png

6. Word Editor

Finally, having exported our object, when we go to the word editor just specify that it is a dungeonblock:

11341810.png

I leave you with a couple of screenshots of an object that accompanied me during the writing of this guide:

11341811.png

11341812.png

11341814.png

11341813.png

  • Metin2 Dev 2
  • Good 4
  • Love 4
  • Love 24
Link to comment
Share on other sites

  • 5 months later...
  • 4 months later...
  • 1 month later...

TL;DR: i did everything exactly like in the tutorial but the object is only visible while placing and completly black if placed. any idea why?

 

I did everything like in the tutorial but it is not working. I added a object, assigned the textures, put a light on the object, rendered to texture and saved as tga like in your images, put a blend operation in and renamed it Blend_01, exported it with coords per vertex on 2, loaded it as dungeonblock in worldeditor but the object is just black. While attached to the mouse and ready to be placed the object is actually normally visible with all its textures but after placing it it is just black.

if i paint the complete lightmap texture red then the object is illuminated red and it seemed like it worked but this only works if i make the whole texture red and not only the spots i want to. Any idea why this is happening?

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.