Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Aaron
    A
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 23
    • Best 1
    • Controversial 0
    • Groups 0

    Aaron

    @Aaron

    1
    Reputation
    93
    Profile views
    23
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Aaron Unfollow Follow

    Best posts made by Aaron

    • RE: C4D hangs when call BaseShader->Edit() for the message MSG_DESCRIPTION_CHECKUPDATE

      Ok, I will. Just need to remove all not-needed things

      posted in Cinema 4D SDK
      A
      Aaron

    Latest posts made by Aaron

    • Motion Blur, ExecutePasses in VideoPostData

      Hi colleagues,
      What's the way to get several steps of motion blur transformation matrices for BaseObjects of the BaseDocument within the single frame that is on the render process of VideoPostData?
      I usually do

      1. ClonedDoc = BaseDoc->GetClone(COPYFLAGS_0, NULL);
      2. Then do execute of passes and collection of matrix positions
        for(time steps) {
        ClonedDoc->SetTime();
        ClonedDoc->ExecutePasses()
        }
      3. Then use matrix positions to calculate motion blur
        The observations tell that GetClone and ExecutePasses are expensive calls.
        Is there any way to get subframe transformation matrices?
        I have seen some get motion data, but it seems to be for Physical render.

      Thanks,
      Aaron


      I think there is a bug in the following situation:

      1. There is a recent featured with object Liquid Mesh in the document of VideoPostData pipeline
      2. When we just collect the scene elements the polygon object cache (POC) returned by Liquid Mesh->GetCache() contains the polygons to build this nice liquid object mesh
      3. When we want to add Motion Blur and call document->ExecutePasses(...) for some time then this POC is flushed and has no polygons or vertices, so it's not collected and can't be rendered
      4. Even if we don't call ExecutePasses() but add Sub-Frame Motion Blur effect in Cinema Settings then POC is also flushed the same way as in #3.

      Bake to Alembic for Liquid Mesh helps but still...

      posted in Cinema 4D SDK c++ 2025
      A
      Aaron
    • RE: BaseBitmap.Init("somefile.exr") crashes with multiple std::thread

      @ferdinand said in BaseBitmap.Init("somefile.exr") crashes with multiple std::thread:

      omp #parallel

      Sorry for late reply, I am not advocating for std::threads, I understand your design explanation.
      The omp #parallel thing is OpenMP directive to launch parallel threads. It's an old but simple method.
      Actually I have made a solution by exploiting Cinema way of launching threads and it works fine.
      However, I hope it would be good to make BaseBitmap->Init a thread safe and independent call from other C4D threads and resources.
      I will collect an example for you with exr images soon.

      Cheers,
      Aaron

      posted in Cinema 4D SDK
      A
      Aaron
    • RE: BaseBitmap.Init("somefile.exr") crashes with multiple std::thread

      Few more experiments:

      1. When I replace std::thread to omp #parallel for the result is the same - crash
      2. When I launch a std::thread and from inside it I launch several C4D threads each with BaseBitmap.Init() then it works just fine.

      I honestly think that BaseBitmap.Init() should be local and independent function from any other C4D infrastructure.

      posted in Cinema 4D SDK
      A
      Aaron
    • RE: BaseBitmap.Init("somefile.exr") crashes with multiple std::thread

      Ferdinand, thank you very much for detailed explanation!
      Sure I will integrate the most recent threading mechanisms. The files that we tried to read in parallel are different. I guess there is something with OpenEXR reader that you probably wrap around. Other file types reading in parallel is working just fine.
      The whole code workflow is more complex because it involves several libraries and plugin system communication.
      So I have reduced the issue just that short and it's reproduces always.
      My goal was indeed to read in parallel, it's not very fast to read and decode sequentially when you deal with 1000s of files.
      However for some file types we can probably serialize the access.
      Best regards,
      Aaron

      posted in Cinema 4D SDK
      A
      Aaron
    • RE: BaseBitmap.Init("somefile.exr") crashes with multiple std::thread

      Ferdinand, thank you for very quick reply.
      Of course I know about this sample code with leaks, it was just to keep the message very short.
      It's working code for jpg, png, bmp - it scales well on multi-core, reads data correctly, never had a problem with that formats. But not for exr, no any exr in multi-threaded environment.
      Actually all exr files fail, you may check. I have catched it on 8K exr files.
      It was IMAGERESULT::MISC_ERROR (-6) error code that I mentioned for situation of parallel BaseBitmap.Init() without using mutex to access this function.

      Sure I have to use C4D threads to do this kind of optimization. Thank you very much!
      I was just hoping to figure out maybe some special image IO mutex lock may help.

      Best regards,
      Aaron

      posted in Cinema 4D SDK
      A
      Aaron
    • BaseBitmap.Init("somefile.exr") crashes with multiple std::thread

      Hello colleagues,
      I have found an issue that when we want to read several .EXR files in parallel using multiple std::threads they crash on BaseBitmap.Init(file.EXR).
      It doesn't crash when we read exr sequentially without threads. It doesn't crash when we use C4DThread instead, however some bitmaps are not read correctly and return err codes. However to perform correctly we need to use C4DThread and mutex lock/unlock before/after bitmap.Init(exr)
      You may test this short code. I have tested 4 different 8K .exr files. It reproduces the crash always. Maybe I miss something, some threading parameter for this case.

      void bthread(int id)
      {
      	String st[4] = {"S:\\test\\img1_8K.exr",
      					"S:\\test\\img2_8K.exr",
      					"S:\\test\\img3_8K.exr",
      					"S:\\test\\img4_8K.exr" };
      
      	Filename fn(st[id]);
      
      	BaseBitmap* bitmapE = BaseBitmap::Alloc();
      	IMAGERESULT res = bitmapE->Init(fn);
      	printf("\n [file %s result %d size %d x %d]", st[id].GetCStringCopy(), res, bitmapE->GetBw(), bitmapE->GetBh());
      	BaseBitmap::Free(bitmapE);
      }
      
      void test_exr()
      {
      	std::thread* t[4];
      	for (int i = 0; i < 4; i++)
      	{
      		t[i] = new std::thread(bthread, i);
      		t[i]->detach();
      	}
      }
      
      posted in Cinema 4D SDK 2025 c++ windows
      A
      Aaron
    • RE: How to access thinkin particles data channels correctly?

      Solved, it works this way:

      Vector v(0.0);
      tps->GetData(pid, channel, &v, ID_GV_VALUE_TYPE_VECTOR);
      
      posted in Cinema 4D SDK
      A
      Aaron
    • How to access thinkin particles data channels correctly?

      Hi All,
      There is thinking particles system and it has few named channels such as here:

       Float   [chan   5] DataChannelType    19 DataChannelName mass(Real)
       Float   [chan   6] DataChannelType    19 DataChannelName oldP(Real)
       Float   [chan   8] DataChannelType    19 DataChannelName pscale(Real)
       Float   [chan 10] DataChannelType    19 DataChannelName spriteuv(Real)
       Vector [chan   1] DataChannelType    23 DataChannelName Cd(Vector)
      

      I get channel info using tps->DataChannelType(chan) and etc.
      19 is DTYPE_REAL, 23 is DTYPE_VECTOR
      But when I try to read the channel value per particle then it returns false and doesn't read the values. For example this request returns false:

        TP_MasterSystem* tps;
        Vector fval(0.0);
        tps->GetData(pid, channel, &fval, DTYPE_VECTOR);
      // nothing is written in fval. I also tried to use GeData, but it didn't help
      

      Other particle data such as tps->Transform(...), tps->Color(...), tps->Age(...) is returning relevant results.

      Please, can someone show me a valid example of correct TP data channel access?

      Cheers

      posted in Cinema 4D SDK c++ 2024
      A
      Aaron
    • RE: MoGraph color tag access

      Hi @m_adam Maxime,
      I don't understand yet, how to use the Python example within a C++ environment. Can't find C++ functions such as this:

      md = c4d.modules.mograph.GeGetMoData(op)
      ... 
      offset = op[c4d.MG_LINEAR_OFFSET]
      

      I have noticed that for example the Text object type has MoData->GetCount() with N elements corresponding to the number of letters. And then the cache object of Text has N children each with Motion Graphics Color Tag [tag->GetType() = 1018768].
      I thought there could be a way to read this color tag somehow.

      But if no then during scene traversal there is a way to inherit the array of the Text object with MoData->GetCount() > 0 and then count each descendant object with Motion Graphics Color Tag with increasing id to reference to the correct element of MoData->GetArray()

      Same extraction can be done for Voronoi Fracture and other MoGraph objects with some checks.

      posted in Cinema 4D SDK
      A
      Aaron
    • RE: Save Project with Assets not updating the maxon::Url of node textures in R26 and 2023

      Hi @Manuel I have checked the new update 2023.2.0 and the feature works just fine with custom bitmaps without any change from my side. Congrats with a very quick bugfix! This is very cool! 🙂
      Also it's great the half-year version 2023.2 doesn't need 3rd party plugin rebuild and recompile as in S24, S26. Thanks for this!

      posted in Cinema 4D SDK
      A
      Aaron