It is currently Sat Aug 22, 2020 4:27 am


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Raycast on scaled mesh.
PostPosted: Sun Jan 05, 2014 5:19 pm 

Joined: Sat Dec 21, 2013 3:41 pm
Posts: 10
I want to use PolyVox raycasting, but in my project I've scaled my mesh.

Increasing block side lenght to max in simple volume constructor doesn't seem to change anything.

Can't find any other method on changing block size. Are there any other solutions?

Futhermore, it says in docs that it hasn't been tested with marching cubes.

I think one of the solution would be to use custom raycasting against mesh, then somehow translate resulting point down, and then check if it is inside a voxel, but this way I'd have to loop through entire volume.

---

How can we determite where did the ray hit something? Not sure about purpose of callback funtion.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Raycast on scaled mesh.
PostPosted: Mon Jan 06, 2014 11:56 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
PolyVox volumes have no concept of scale, translation, or rotation - they are basically just arrays of numbers representing the voxel values. I guess you can consider them to exist in their own space (we call this 'volume space' in Cubiquity) where voxel (0,0,0) is at position (0,0,0) and voxel x, y, z) is at position (x,y,z). Raycasting should be performed in this same space.

Of course, you may well want to transform volumes in your application, and this can be done by applying transformations to the meshes using your graphics/game engine. You would essentially be defining a mapping from volume space to world space, and if you then want to perform picking with a ray provided by your engine in world space then you will need to convert it back to volume space first.

Actually I've been working on this in Cubiqity recently and it does work... though I haven't finished yet.

Neomex wrote:
Futhermore, it says in docs that it hasn't been tested with marching cubes.


I think it does work (we're using it in Cubiquity). Test it without scaling etc, first though.

Neomex wrote:
I think one of the solution would be to use custom raycasting against mesh...


Yes, this should also be possible.

Neomex wrote:
and then check if it is inside a voxel, but this way I'd have to loop through entire volume.


I don't see why you'd need to loop though the volume - if the intersection point is (x,y,z) then by definition the voxel is also the one at position (x,y,z). Unless I'm misunderstanding your question?

Neomex wrote:
How can we determite where did the ray hit something? Not sure about purpose of callback funtion.


Rather than using the rayasting functions you might want to use the picking functions (actually these are the ones which we use in Cubiquity I think). They wrap the same functionality with a slightly simplified/clearer interface: https://bitbucket.org/volumesoffun/poly ... at=develop


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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