Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

python bindings
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=693
Page 2 of 3

Author:  David Williams [ Mon Jan 23, 2017 11:12 pm ]
Post subject:  Re: python bindings

Great, glad you got it working :-)

Author:  kalwalt [ Tue Jan 24, 2017 5:03 pm ]
Post subject:  Re: python bindings

David Williams wrote:
Great, glad you got it working :-)

Thank you! :)

I created a github repo if someone is interested of my experiments: https://github.com/kalwalt/sverchok_nodes_collection/tree/master/blend

and issue on sverchok https://github.com/nortikin/sverchok/issues/1168#issuecomment-274850616


Only a question: i have some troubles with the indices of the mesh, in the sense i can't figure out how they are stored. Since i do not put the indices in a vbo i have to recreate the list of edges or polygons by code. How shoul i manage them?

Author:  kalwalt [ Wed Jan 25, 2017 9:29 am ]
Post subject:  Re: python bindings

Quote:
Only a question: i have some troubles with the indices of the mesh, in the sense i can't figure out how they are stored. Since i do not put the indices in a vbo i have to recreate the list of edges or polygons by code. How shoul i manage them?


i solved that issue, polyvox output tris so was easy to fix it. Now we have a polyvox voxilized sphere inside blender!!
A new era began.... :D

Attachment:
File comment: Polyvox inside Blender!
Schermata del 2017-01-24 23-51-41.png
Schermata del 2017-01-24 23-51-41.png [ 158.88 KiB | Viewed 7605 times ]

Author:  David Williams [ Thu Jan 26, 2017 9:37 pm ]
Post subject:  Re: python bindings

Wow, cool stuff! I've never seen PolyVox in Blender before :-)

Author:  kalwalt [ Fri Jan 27, 2017 10:30 pm ]
Post subject:  Re: python bindings

David Williams wrote:
Wow, cool stuff! I've never seen PolyVox in Blender before :-)

There is always a first time!

i tried to import also the LargeVolume but it seems that something is broken at that point of the commit i was receiving an error conceirning a compressor not assigned, this the output from the Paging example:

Code:
  PolyVox Assertion Failed!
    =========================
    Condition: m_pCompressor
    Message:   You must provide a compressor for the LargeVolume to use.
    Location:  Line 452 of /home/walter/polyvox-bitbucket-wperdan/polyvox/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl


Did you remember maybe when this bug has fixed?

Author:  David Williams [ Tue Jan 31, 2017 12:01 am ]
Post subject:  Re: python bindings

I'm not sure this is a bug (though I guess you can say it is a bug if it occurs in the example). The idea used to be that you had to provide an object implementing a compression algorithm which would be used when the LargeVolume became low on space. At different points in PolyVox's history this was compulsory or not compulsory, but there should at least be a default compressor implementation somewhere in PolyVox?

At any rate, I wouldn't worry too much about the LargeVolume. It adds some complications compared to RawVolume and is not really needed until your volume are bigger than about 512x512x512 voxels. In my experience it is actually the size of the generate mesh data which becomes a problem first.

Author:  kalwalt [ Wed Feb 01, 2017 10:58 pm ]
Post subject:  Re: python bindings

Quote:
At any rate, I wouldn't worry too much about the LargeVolume. It adds some complications compared to RawVolume and is not really needed until your volume are bigger than about 512x512x512 voxels. In my experience it is actually the size of the generate mesh data which becomes a problem first.


yes maybe i don't need a Large Volume, i'm primarly focused to create small meshes ( but with high number of polygons), I would be interested also to add directly a material to the voxel, As i remember and i looked at the Api it should be possible use RawVolume with MaterialDensityPair, but i can't found in the python bindings ,Maybe is implemented in another way or there is a different way? You should in theory assign the value voxel with setDensity() method and setMaterial(), Unfortunately the docs in that commit wasn't so clear ( maybe was broken at that he moment) so it's difficult fro me to understand if it's a possible thing or not.

Author:  David Williams [ Sat Feb 04, 2017 10:08 am ]
Post subject:  Re: python bindings

kalwalt wrote:
As i remember and i looked at the Api it should be possible use RawVolume with MaterialDensityPair, but i can't found in the python bindings ,Maybe is implemented in another way or there is a different way? You should in theory assign the value voxel with setDensity() method and setMaterial()


This is how it should be done, but unfortunately I don't know if it is possible through Python. The problem is that PolyVox makes heavy use of templates but these are not supported by Python. So in the SWIG files for the bindings we have to explicitly define every combination of volume and voxel type which we want Python to support. You can have a look at the '*.i' files to see if it is in there? But I suspected using class types such as MaterialDensityPair is trickier than adding basic types such as int.

This is why I will try to avoid using templates in the public interface of future projects, as it makes writing bindings quite complicated. I've learned a lot of stuff from writing PolyVox!

Author:  kalwalt [ Sun Feb 05, 2017 4:08 pm ]
Post subject:  Re: python bindings

Quote:
So in the SWIG files for the bindings we have to explicitly define every combination of volume and voxel type which we want Python to support. You can have a look at the '*.i' files to see if it is in there?

Unfortunately i can't find such def in the *.i files. I think it's time to solve the python bindings definetevely. I have already a fork of polyvox_bitbucket, i will create a new branch
Code:
new_bindings
in my repo and will continue the discussion there. At the moment i'm in stuck with the cubic and MC extractor, I think the Swig template def are not correct. i will post here the link fo the new branch. Actually you can find my polyvox fork here

Author:  kalwalt [ Sun Feb 05, 2017 4:59 pm ]
Post subject:  Re: python bindings

I created a pull request on your repo, so we can collaborate there! :)

Page 2 of 3 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/