bake3d caching problem with low mamory

2007-04-29
2013-04-25
  • AKHmetgaleev ILdar

    I'm trying to cache large volumatic data to particle cloud.
    Sometimes when pixie goes to swap it falls with:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  St9bad_alloc

    It is just uncomfortable.

     
    • Okan Arikan

      Okan Arikan - 2007-04-29

         Hi AKHmetgaleev,

         How many points are you generaing and how big individual points are on the screen (just a rough guess)? Some of the data structures that we use may be a little bigger than they need to be.

         Okan

       
      • George Harker

        George Harker - 2007-04-29

        We could possibly write out the point cloud as we go - currently it is entirely memory resident.

        Hoever, during brickmap construction, or when reading back the pointcloud (if you're not using brickmaps), the entire map will still have to be resident in memory.

        Cheers

        George

         
        • AKHmetgaleev ILdar

          The particle cloud map generated by renderer takes about 150Mb. And seems in my case it works great without conversion to the brick map.

          Now I'm tweaking my shader to get maximum performance and speed.

           
          • George Harker

            George Harker - 2007-04-29

            Hi AKHmetgaleev,

            That's quite a large cloud.  Are you storing one channel (ie one color) per point, or more than that.

            The usual technique is to lower the shading rate when baking (especially if high frequency data is not important).  The point cloud density is directly related to the number of shading points, and hence the shading rate.

            With a large cloud like that, reading a brickmap will most probably be quite a bit faster.

            Cheers

            George

             
            • AKHmetgaleev ILdar

              I'm storing one float per point. It works like the transparent shadow map. Clouds(not particle clouds) can be very close to the camera and far away same time. And I need good detail for near area and large scale for far area.

              One more problem. "show" shows point clouds correctly only if I store it every sample. If I add some condition show came useless.

              This example produces particle cloud map which can be viewed by show:
              if (cachefile != "")
              {
              bpp = transform("world","current",pp);
              bake3d(cachefile, "BakeCShad", bpp, normal(0), "radius",minsamplestep*cachingrate,
                          "interpolate",1, "coordsystem", "camera","BakeCShad",Ov);
                     
              }
              And this one can't be viewed correctly:
              if (cachefile != "" && Ov > 0)
              {
              bpp = transform("world","current",pp);
              bake3d(cachefile, "BakeCShad", bpp, normal(0), "radius",minsamplestep*cachingrate,
                          "interpolate",1, "coordsystem", "camera","BakeCShad",Ov);
                     
              }

              It doesn't affect to final render.

               
              • George Harker

                George Harker - 2007-04-30

                Hi AKHmetgaleev,

                bake3d needs to calculate the point radii much like texture() needs to calculate derivatives for the filter width.  For tthe same reason, putting bake3d in a varying conditional can cause it to misestimate (or produce really bad) radii estimates that will cause problems downstream.

                One surefire sign for this is when show will display the cloud in points mode (press p) but not in the default dics mode (press d).

                If you have to put it in a conditional, you can supply your own raidius to the bake3d shadop  bake3d(....."radius",r","channelname",data").  In general it's best to avoid this though.

                cheers

                George

                 
              • George Harker

                George Harker - 2007-04-30

                Hi AKHmetgaleev,

                |I should have read more carefully - you're already supplying your own radius.

                A couple of points to note, volume date with n=0 will not display as discs in show.  Just press p to display as points - this is normal and doesn't represent a problem (it's just that a disk has to have a normal to orient it).

                If you want to bake out in world space, you should still provide "current" space points to bake3d.  It does the transform for you, and it's important that it know which transform is used so it can calculate scaling factors internally.

                Your points are in world, but you bake out in camera space (which is actually current space for practical purposes in most shaders).  Is that intentional?

                ie.

                bpp = transform("world","current",pp);
                bake3d(cachefile, "BakeCShad", bpp, normal(0), "radius",minsamplestep*cachingrate,
                "interpolate",1, "coordsystem", "camera","BakeCShad",Ov);

                should probably be

                bake3d(cachefile, "BakeCShad", pp, normal(0), "radius",minsamplestep*cachingrate,
                "interpolate",1, "coordsystem", "world","BakeCShad",Ov);

                cheers

                George

                 

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks