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


All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Getting an access violation when I go "into" a polyvox mesh!
PostPosted: Thu Nov 11, 2010 8:27 am 

Joined: Wed Nov 10, 2010 7:15 pm
Posts: 43
this is my code:
Code:
//Create an empty volume and then place a sphere in it
   Volume<MaterialDensityPair44> volData(64, 64, 64);
   createSphereInVolume(volData, 30);

   //Extract the surface
   SurfaceMesh<PositionMaterialNormal> mesh;
   CubicSurfaceExtractorWithNormals<MaterialDensityPair44> surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh);
   surfaceExtractor.execute();

   Ogre::ManualObject* PVWorld = mSceneMgr->createManualObject("PVWorld");

    uint32_t noVertices = mesh.getNoOfVertices();
    uint32_t noIndices = mesh.getNoOfIndices();

    PVWorld->estimateVertexCount(noVertices);
    PVWorld->estimateIndexCount(noIndices);

    PVWorld->begin("ColouredCubicVoxel", Ogre::RenderOperation::OT_TRIANGLE_LIST);

    // vertices
    const std::vector<PolyVox::PositionMaterialNormal>& vVertices = mesh.getVertices();
    for (unsigned int i=0; i<noVertices; i++) {
        const PolyVox::Vector3DFloat& pos = vVertices[i].getPosition();
        PVWorld->position(pos.getX(), pos.getY(), pos.getZ());
    }

    // indices
   
    const std::vector<uint32_t>& vIndices = mesh.getIndices();
    for (unsigned int i=0; i<noIndices; i++) {
        PVWorld->index( vIndices[i] );
    }
   

    PVWorld->end();
   PVWorld->convertToMesh(Ogre::String("Sphere"));
   Ogre::Entity* lEntity = mSceneMgr->createEntity(Ogre::String("Sphere"));
   Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
   node->attachObject(lEntity);
   


any idea what is wrong? Also I thought it is very interesting that at least for me, using cubicsurfaceextratorwithnormals is identical in speed to using cubicsurfaceextractor. One oddity is that the fps drops in half at some viewing angles of the sphere... I imagine just because of more faces, but still it is sad to drop from 900 to 450fps. I kind of expected it to be much faster than this, but I dunno I guess.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Getting an access violation when I go "into" a polyvox m
PostPosted: Thu Nov 11, 2010 10:16 am 

Joined: Sun Oct 03, 2010 10:13 pm
Posts: 73
As this looks very much like my code the code I currently have is nearly exactly the same. The only differences I can see are these:
I use
Code:
PolyVox::SurfaceMesh< PolyVox::PositionMaterial > mesh;
as mesh extractor and
Code:
const std::vector< PolyVox::PositionMaterial >& vVertices = mesh.getVertices();
when getting the vertices. Here's how you can calculate the normals in the shader: http://www.thermite3d.org/phpBB3/viewtopic.php?f=2&t=81

The end of the code looks something like this:
Code:
   PVWorld->end();
   node->attachObject(PVWorld);


I'm not sure why your program crashes if these are not the problems. Did you look at the Ogre log if you use it? Or maybe you should just put some simple printf's in there to see where it crashes.

paycheck wrote:
One oddity is that the fps drops in half at some viewing angles of the sphere...
I experience something similar here. However this could also have other causes as I do not have only one volume right now.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Getting an access violation when I go "into" a polyvox m
PostPosted: Thu Nov 11, 2010 4:40 pm 

Joined: Wed Nov 10, 2010 7:15 pm
Posts: 43
Code:
09:35:17: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program Ogre/ParticleGS/GenerateVS: CG ERROR : "The compile returned an error."
(0) : error C6015: Output 'POSITION' not completely written
 in CgProgram::loadFromSource at ..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
09:35:17: High-level program Ogre/ParticleGS/GenerateVS encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program Ogre/ParticleGS/GenerateVS: CG ERROR : "The compile returned an error."
(0) : error C6015: Output 'POSITION' not completely written
 in CgProgram::loadFromSource at ..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
09:35:17: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program Ogre/ParticleGS/DisplayVS: CG ERROR : "The compile returned an error."
(249) : warning C7050: "output.color" might be used before being initialized
(0) : error C6015: Output 'POSITION' not completely written
 in CgProgram::loadFromSource at ..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
09:35:17: High-level program Ogre/ParticleGS/DisplayVS encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program Ogre/ParticleGS/DisplayVS: CG ERROR : "The compile returned an error."
(249) : warning C7050: "output.color" might be used before being initialized
(0) : error C6015: Output 'POSITION' not completely written
 in CgProgram::loadFromSource at ..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
09:35:17: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program Ogre/ParticleGS/DisplayPS: CG ERROR : "The compile returned an error."
(323) : fatal error C9999: unexpected cast operation
 in CgProgram::loadFromSource at ..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
09:35:17: High-level program Ogre/ParticleGS/DisplayPS encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program Ogre/ParticleGS/DisplayPS: CG ERROR : "The compile returned an error."
(323) : fatal error C9999: unexpected cast operation
 in CgProgram::loadFromSource at ..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)


and
Code:
09:35:19: Compiler error: unknown error in RTShaderSystem.material(23): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(52): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(81): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(110): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(146): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(81): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(162): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(81): token "rtshader_system" is not recognized
09:35:19: Compiler error: unknown error in RTShaderSystem.material(110): token "rtshader_system" is not recognized


are the only errors in the log... I'm not 100% satisfied that that is the problem, but I'll try and get the normals calculated like you suggested.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Getting an access violation when I go "into" a polyvox m
PostPosted: Thu Nov 11, 2010 4:48 pm 

Joined: Wed Nov 10, 2010 7:15 pm
Posts: 43
Actually, I have no idea where to put that shader code... I've never dealt with shaders before, so any pointers would be good. I got rid of the problem by commenting out my directional light though (which wasn't doing anything anyway, because the shader code is wrong!) so I'm pretty sure that is the problem.

Once again, any tips would be massively appreciated. While I'm not doing anything today at work (I do tech support) I'll try and read all the relavent code in polyvox so I can use it a bit more effectively... I always seem to get lost in the complexity of ogre unless I do things by trial and error (it is too big to read and understand everything, at least for me right now : /) I really appreciate all the help though. Thanks.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Getting an access violation when I go "into" a polyvox m
PostPosted: Thu Nov 11, 2010 6:26 pm 

Joined: Sun Oct 03, 2010 10:13 pm
Posts: 73
I don't have much time right now, but look at this post or the whole thread for more information:
http://www.thermite3d.org/phpBB3/viewtopic.php?p=450#p450
And look here for more info on shaders:
http://www.ogre3d.org/docs/manual/manual_14.html#SEC23


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Getting an access violation when I go "into" a polyvox m
PostPosted: Thu Nov 11, 2010 9:27 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Correct me if I'm wrong, but it seems like we are talking about an Ogre/material issue here rather than a problem with PolyVox as such? If so I'll just answer you question in the other thread.


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

All times are UTC


Who is online

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