Jump to content
Sign in to follow this  
theVestarr

Drawing a text on an object

Recommended Posts

Hey all. 

Apologies if I posted in a wrong section. 

 

I'm getting into modding and I'm playing around with some different solutions. I was thinking about creating and releasing a mod soon. As a part of it however, I need to create a custom object that can draw a text (from its custom attributes) on its flat surface. I really want to avoid creating textures for every single digit and letter of the alphabet. I'm guessing it's possible, as even aircraft HUD's and dials can display current altitude and speed. I tried looking it up on the forums but I didn't find anything useful. 

 

Obviously performance is key for me, so if there isn't any good way to solve it, I'm happy to do it with a ton of textures instead. The object is very unlikely to change its text mid-game because it's basically a specific, static sign, so I don't know if having each frame loop to update it is really necessary, unless it doesn't take too much power. 

 

In case I need to use the textures approach, can anyone shed some light how to create an object that works with setObjectTexture? As mentioned earlier, I would like to provide some extra options in the eden editor's object's attributes to customise the sign's textures, is there a way of making it reflect its textures set in attributes in Eden after they've been changed? Is there a way of creating textures that glow in the dark, or otherwise having a light on an object that turns on at night and lights up the sign? 

 

Thanks! 

Share this post


Link to post
Share on other sites

https://drive.google.com/open?id=1euOPKrIqN_hr14ymT4U-n6Ycn1Yyptfj

You could use plate numbers tech on some fake vehicle. Above is example how to do it but keep in mind, that you need adapt CfgPatches & defines on your own. Since it seems you don't have prior experience with modding I would recommend taking a look at Arma 3 Samples - https://store.steampowered.com/app/390500/Arma_3_Samples/

 

As for SetObjectTexture approach, you could use SetObjectMaterial to change emissive values of your letters. I would recommend to try search a little bit here on forums and on wiki for some hints regarding setting up model, sections & things like.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks for a quick response. 

I'll check the samples and documentation. As you said, I don't have much experience with Arma modding itself so I'm kinda trying to find my way around it. I've done some game modding in general in the past and done some scripting for mission in arma though. 

 

Also thanks for that example. It requires Contact DLC or am I wrong reading it?

I gave it some thinking and I decided I'll use the texture approach, I'm just gonna write a script in node that will generate necessary letters on an image and save it. I'll also have to figure out how to make it setObjectTexture-friendly and it should be fine. 

Share this post


Link to post
Share on other sites
4 hours ago, theVestarr said:

 

Also thanks for that example. It requires Contact DLC or am I wrong reading it?

It doesn't require Contact. Anyway, if you would be still interested in plate number approach here is some older topic covering that issue -

 

4 hours ago, theVestarr said:

 

I gave it some thinking and I decided I'll use the texture approach, I'm just gonna write a script in node that will generate necessary letters on an image and save it. I'll also have to figure out how to make it setObjectTexture-friendly and it should be fine. 

I guess if name of file would be same as letter it represents then it would super simple to fetch that.

Share this post


Link to post
Share on other sites

I'll use the textures, but thanks for that, I'll definitely need that in the future. 

However, I'm really struggling with the configs, and both search and google didn't point me anywhere that was helpful, documentation didn't make much sense to me either. Could anyone point me in a direction how to understand some things here? 

 

First of all, I've got the model - all exported from blender, textured (even normal and specular maps generated, I'll try to generate materials later), but I'm not sure how to configure both my material and model/mod in general. The object is supposed to be a static prop so I believe the config shouldn't be too hard, but samples don't have anything that simple if I'm not wrong. Also, my model components have 4 different textures, 2 of which I would like to control with setObjectTexture in the missions and stuff. Im confused what sections, hiddenSelections are and how to configure them to my needs. Could anyone shed some light on that? Also, can I use setObjectTexture when a component has a custom emissive shader, or is it one or the other? 

 

Sorry for asking do many questions but I spent a day looking for answers and found nearly nothing. 

Share this post


Link to post
Share on other sites

So - quick update.

After a long research and hundreds of attempts, I've gotten somewhere.
Finally my model is showing in game, has correct textures, even managed to get the material to be emissive and it's looking good so far.

However, I still can't get this setObjectTexture thing to work.
I'm still not sure if I understand sections/hiddenSelections. I've got a few components in my LOD (it's a low poly model so I use one resolution LOD). Here's my model.cfg:
 

class CfgModels
{
    class Default 
    {
        skeletonName = "";
        sectionsInherit = "";
        sections[] = {};
    };

    class VAP_DTD_SIGN : Default 
    {
        sections[] = {
            "body",
            "display_L",
            "display_M",
            "display_R",
            "Leg1",
            "Leg2",
            "Leg3"
        };
    };
};

these sections correspond to my Component names in the model.

Now my CfgVehicles for this object goes like this:

class CfgVehicles {
    class Thing;

    class VAP_DTD_SIGN : Thing {
        displayName = "D-T-D Taxiway Sign";
        author = "Vestarr";
        editorPreview = "\airportshit\data\dtd_sign\icons\dtd_sign_icon.paa";
        scope = 2;

        mapSize = 0.9;
        accuracy = 1;
        destrType = "DestructNo";

        model = "\airportshit\data\dtd_sign\objects\dtd_sign.p3d";
        hiddenSelections[] = {"display_L","display_M","display_R"};
        hiddenSelectionsTextures[] = {"\airportshit\data\common\textures\taxiway_dir_b_9.paa", "\airportshit\data\common\textures\taxiway_mark_a.paa", "\airportshit\data\common\textures\taxiway_dir_b_9.paa"};
    };
};


I assumed I'll be able to change these textures in-game with setObjectTexture but it doesn't happen. If I call getObjectTextures afterwards, it returns the updated textures, but it doesn't reflect it on the model, like it's not connected. Am I supposed to set no textures at all to that component in the object editor or something?

 

Thanks for the help so far!

Share this post


Link to post
Share on other sites

EDIT: I'll move it to a new topic as it's already kinda out of scope of the question.

So - quick update.

After a long research and hundreds of attempts, I've gotten somewhere.
Finally my model is showing in game, has correct textures, even managed to get the material to be emissive and it's looking good so far.

However, I still can't get this setObjectTexture thing to work.
I'm still not sure if I understand sections/hiddenSelections. I've got a few components in my LOD (it's a low poly model so I use one resolution LOD). Here's my model.cfg:
 

class CfgModels
{
    class Default 
    {
        skeletonName = "";
        sectionsInherit = "";
        sections[] = {};
    };

    class VAP_DTD_SIGN : Default 
    {
        sections[] = {
            "body",
            "display_L",
            "display_M",
            "display_R",
            "Leg1",
            "Leg2",
            "Leg3"
        };
    };
};

these sections correspond to my Component names in the model.

Now my CfgVehicles for this object goes like this:

class CfgVehicles {
    class Thing;

    class VAP_DTD_SIGN : Thing {
        displayName = "D-T-D Taxiway Sign";
        author = "Vestarr";
        editorPreview = "\airportshit\data\dtd_sign\icons\dtd_sign_icon.paa";
        scope = 2;

        mapSize = 0.9;
        accuracy = 1;
        destrType = "DestructNo";

        model = "\airportshit\data\dtd_sign\objects\dtd_sign.p3d";
        hiddenSelections[] = {"display_L","display_M","display_R"};
        hiddenSelectionsTextures[] = {"\airportshit\data\common\textures\taxiway_dir_b_9.paa", "\airportshit\data\common\textures\taxiway_mark_a.paa", "\airportshit\data\common\textures\taxiway_dir_b_9.paa"};
    };
};


I assumed I'll be able to change these textures in-game with setObjectTexture but it doesn't happen. If I call getObjectTextures afterwards, it returns the updated textures, but it doesn't reflect it on the model, like it's not connected. Am I supposed to set no textures at all to that component in the object editor or something?

 

Thanks for the help so far!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×