It is currently Sat Aug 22, 2020 12:29 pm


All times are UTC




Post new topic Reply to topic  [ 150 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 15  Next
Author Message
 Post subject: Re: Streaming Volume
PostPosted: Wed Mar 02, 2011 8:47 pm 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
okay,
about the int32 testing we could test a volume like 32x32x131072
takes only 128megs if uncompressed :D


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Wed Mar 02, 2011 9:08 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Yes, absolutely, that's the kind of test we can do. Don't know if we can actually visualise the result of the whole things though - might be too much data for the GPU. But it's worth a shot :-)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Wed Mar 02, 2011 9:11 pm 

Joined: Fri Feb 18, 2011 8:41 pm
Posts: 173
Cool to hear of the progress :) Good luck, hope to be able to use it soon! (Sure a lot of other do too)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Thu Mar 03, 2011 9:06 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
ookay, i guess I had some issues still not worked out
this was a very good idea (doing it stepwise)

I am now quite confident that int32 coordinates work fine as I have tested all the surface extractors on volumes that have one dimension which is larger than the maximum uint16.
(I strongly advise against repeating those tests on machines with little ram (the volume is fine, it takes like 6 megabytes or so)... extracting the surfaces blew up some assertions you made (number of vertices < 1000000) and blows up ram really quickly.

Code:
M       tests/testvolume.cpp
M       library/PolyVoxCore/source/Region.cpp
M       library/PolyVoxCore/source/GradientEstimators.cpp
M       library/PolyVoxCore/include/VolumeSampler.h
M       library/PolyVoxCore/include/Volume.inl
M       library/PolyVoxCore/include/SurfaceExtractor.inl
M       library/PolyVoxCore/include/VolumeSampler.inl
M       library/PolyVoxCore/include/GradientEstimators.inl
M       library/PolyVoxCore/include/Volume.h
M       library/PolyVoxCore/include/PolyVoxImpl/Block.h
M       library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.inl
M       library/PolyVoxCore/include/MeshDecimator.inl
M       library/PolyVoxCore/include/Region.h
M       library/PolyVoxCore/include/SurfaceExtractor.h
M       library/PolyVoxCore/include/CubicSurfaceExtractor.inl
M       examples/Basic/main.cpp
M       examples/OpenGL/Shapes.cpp
M       examples/OpenGL/main.cpp
M       examples/OpenGL/OpenGLWidget.cpp
M       examples/OpenGL/Shapes.h


this spreads everywhere... but I believe the changes I made to be overseeable this time

I also looked through the diff file, no formatting changes in places where I didn't change anything...
Attachment:
polyvox__no_streaming__unsigned__32.diff [50.34 KiB]
Downloaded 251 times

I might have forgotten some places where it is now necessary to check whether the coordinates are negative... not sure how much an issue this is, but usually people should know how they intend to use their volume

OpenGl example works, but does not test any 32bit things

about the streaming, we could introduce a half-step there by using the unordered_map but preloading it like compatibility mode function does it with RLE


Attachments:
File comment: cubic surface (3 gigs of ram for the vertices + opengl)
very_large_volume.png
very_large_volume.png [ 31.68 KiB | Viewed 3501 times ]
File comment: smooth surface with surface extractor
surface_extractor.png
surface_extractor.png [ 28.05 KiB | Viewed 3501 times ]
Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Thu Mar 03, 2011 6:27 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Great stuff, I'll try to apply these changes tonight (i.e. in the next few hours) and commit them if everything is ok.
ker wrote:
ookay, i guess I had some issues still not worked out
this was a very good idea (doing it stepwise)

Good, I'm glad it has some benefit, rather than just causing frustration :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Thu Mar 03, 2011 11:28 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Ok, I have applied your patch to the RLE branch :-)

I had to make a couple of changes:
  • Replaced 'std::numeric_limits<uint32_t>::max()' with '(std::numeric_limits<uint32_t>::max)()'. This is an annoying windows issue due to a globaly defined 'max' macro, I believe.
  • The AStarPathfinder needed to be updated to int32 as well. You would have missed this because there were no tests for it so the templatised code would never have been compiled. It was picked up instead when testing Thermite.

The only other thing I noticed was that some uint16_t's had been changed to int32_t's when they didn't need to be. For example, getWidth() should always be positive even when positions can be negative. However, I didn't change this because I didn't want to break any of your other work. Besides, the whole concept of width is dubious in an infinite volume anyway... but I'm sure we'll come to that ;-)

Anyway, you should be able to update and make sure further patches are against the new latest version.

Oh, one other (important!) thing... I've assumed you agree to your code being released under the zlib license, but it would be great if you could officially state that for the record. I've also added a credits.txt file to the PolyVox root folder in the RLE branch so you are welcome to add your name to that.

Thanks again for the patch!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Fri Mar 04, 2011 11:23 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
not even remotely as frustrating as it would have been later on when trying to figure out what went wrong... ;)

yes of course, you may publish it under any license you see fit, as long as it allows me to still use it ;) and thanks for the credits.
So to state for the record: I agree to my code being released under the zlib license.

ok, that is a weird windows issue...

yes I thought it would change too much in other places if I'd keep the width/depth/height parameters unsigned, especially since they'll get dropped soon anyway.

I'll check it out and test it now :)

I know you like not having any dependencies (or at least very few).
I could actually use standard library equivalents of the boost::bind and boost::function.
or just force the user to use inheritance by creating a virtual function for loading/unloading
what do you think?


also instead of an unordered_map, a simple map or hash_map should be sufficient (and optimizations through other (faster?) techniques can be done once the speed actually becomes a problem).

ugh... I've just noticed something really annoying
imagine you're accessing a voxel in a block that is not loaded yet.
there will be a call to load from inside getUncompressedBlock which is a const function.
load on the other hand tries to call setVoxel... which most definitly is not const.
is it evil in that case to const_cast away the constness of the this pointer of the volume and then pass it to load?

[edit] ok... inheritance is not a good idea :D
but c++0x allows me to get rid of all boost dependencies.
it doesn't look all too neat, but it does the job.
I'm still testing some things that might be troublesome... but streaming is working already
[/edit]


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Fri Mar 04, 2011 9:17 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
ker wrote:
I know you like not having any dependencies (or at least very few).
I could actually use standard library equivalents of the boost::bind and boost::function.
or just force the user to use inheritance by creating a virtual function for loading/unloading
what do you think?


Yes, it would be good to remove the Boost dependancies (they can still be used by people with no C++0x). If you look in TypeDef.h you'll see there are already some typedef for things loke polyvox_shared_ptr being either boost or std.

I'm actually a bit hazy on bind/function - do you really need bind? I used function in the AStarPathfinder and don't think I used bind. Or is bind just used in the client code, so doesn't actually need to be used inside PolyVox?

I would avoid using inhetance for this problem, but you could also consider the Listener/Observer pattern. But overall I'd just stick with function until we do some kind of profiling.

ker wrote:
also instead of an unordered_map, a simple map or hash_map should be sufficient (and optimizations through other (faster?) techniques can be done once the speed actually becomes a problem).


Yep, pick one that's easy and standard, it should be quite easy to swap it around later.

ker wrote:
ugh... I've just noticed something really annoying
imagine you're accessing a voxel in a block that is not loaded yet.
there will be a call to load from inside getUncompressedBlock which is a const function.
load on the other hand tries to call setVoxel... which most definitly is not const.
is it evil in that case to const_cast away the constness of the this pointer of the volume and then pass it to load?

Yes, this is a little tricky. It's hard to think through the code without actually doing it, but I think I would create a new setVoxel funtion e.g. setVoxelHorribleHack() which is actually const. Because it's const it can be called in the way you need, and it can still modify the data because the relevant data can be declared as mutable.

This should work for now, then later on this new method can be made private. We then create some kind of VolumeModifier/VolumeProxy class which is a friend of the Volume. Because it's a friend it can call the private function, and we pass one of these VolumeProxy objects to the callback functions instead of the actual volume. This also has the advantage that they can ensure the user only modifies the voxels they have been told to in the callback function.

As our final trick, we make the constructor of VolumeProxy private (so users can't create them themselves) and make Volume a friend so that Volume can still create them when need be.

Ok, maybe it can be simpler, or maybe it doesn't work, but it's a starting point. But for your next patch just keep it somple by making the new setVoxelHack() funcion public while we check the streaming works.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Sun Mar 06, 2011 10:41 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
ok, I'm getting issues at block borders in the negative range again...
(only with SurfaceExtractor. Cubic is fine)
I'm looking though the code, but I can't figure out how that can happen :/


Attachments:
more_border_issues.png
more_border_issues.png [ 195.44 KiB | Viewed 3443 times ]
Top
Offline Profile  
Reply with quote  
 Post subject: Re: Streaming Volume
PostPosted: Sun Mar 06, 2011 11:00 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Apparently only along one axis though - probably the z axis? Are the trianges actually missing, or are they being drawn in black? If they are being drawn in black it's probably an issue with the normals, but I think they are actually missing.

Also, this is leaving aside the streaming? It's just because of negative positions? I think I can probably take a look at this myself - there's a good chance it's a bug in the SurfaceExtractor, or at least an invalid assumption. The SurfaceExtractor code is horrible so it might be better for me to look at this issue. Presumably it will also occur on the version of the code which I have in the branch, if you give me your example code?


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 150 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 15  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net