Textures and Materials



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/04/2011 at 06:12, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9-11 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Where do I get started on assigning textures to materials? I want to access the texels directly, I would prefer that over accessing external files. Also, where do I hook in the code? GetVirtualObjects does not seem to be the right place, so I probably need to respond to a message. In one scenario, the data can be produced at any time from an external process that is not supposed to block Cinema 4D during execution, in the other scenario, the texture is produced directly by the plugin.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/04/2011 at 06:48, xxxxxxxx wrote:

    Please provide some more details of what you are trying to achieve.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/04/2011 at 23:09, xxxxxxxx wrote:

    There are two projects. In project #1, I have an external tools that creates textured objects, like houses, plants, and terrain. Currently, invoking the external process and importing the geometry works fine, only textures are missing. I am trying to load the texture using this code:

    void myNode::setTexturePath()
    {
    if (fileExists(cp1252textureFNchars)) {
        GeListNode* node = Get();
        GeData* data = new GeData();
        BaseDocument* doc = node->GetDocument();
        Material *mat = (Material* )m_matlink->GetLink(doc, Mmaterial);

    //data->SetFilename("");
        //mat->SetParameter(CHANNEL_COLOR, *data, 0);
        if (data->SetFilename(cp1252textureFNchars)) {
           if(mat->SetParameter(CHANNEL_COLOR, *data, 0))
              GePrint ("Setting texture filename succeeded:");
           else
              GePrint ("Setting texture filename failed (2) :");
        else*/
           GePrint ("Setting texture filename failed (1) :");
    } else {
        GePrint ("Texture file does not exist:");
    }
    GePrint (cp1252textureFNchars);
    }

    Obviously, I need to call this procedure from somewhere. As the external file can be created at any time, I would like to call setTexturePath when I receive a periodical message in myNode::Message, but I could not find such a periodical message in the documentation. I'm not even certain if setTexturePath is the right way of doing things.

    Project #2 is a texture generator. It describes 3D textures as functions, and I want to bake these textures into a 2D pixel exact texture. This works fine as a command line tool that opens OBJ files with UV coordinates and that creates a BMP, but I want to integrate it into Cinema 4D. In this case, I need direct access to the texels. If you tell me how to access texels in a material, it should solve both my problems, because few things are easier than loading an uncompressed BMP file.

    I want to integrate both projects tightly with Cinema 4D. Both projects may be a bit experimental, but I'm convinced it can work.

    Please help
    Regards


Log in to reply