OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Changing minFilter/magFilter of texture in osgVolume::RayTracedTechnique


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Sailesh
Newbie


Joined: 16 Apr 2019
Posts: 2
Location: Boston, United States

PostPosted: Tue Apr 16, 2019 7:12 pm    Post subject:
Changing minFilter/magFilter of texture in osgVolume::RayTracedTechnique
Reply with quote

I have RayTracedTechnique putting graphics on the screen, but things aren’t rendering correctly. The culprit is the ‘osg::Texture3D::LINEAR’ choice that is used by default as the min/mag filter for the Texture3D object created by RayTracedTechnique. I'd like to change to NEAREST as I’m working with segmented/ labeled volume. The problem I'm seeing is that when I use the setMinFilter and setMaxFilter methods on the associated ImageLayer, things aren't getting updated for some reason. I know that's what's going on because if I actually edit the code in RayTracedTechnique.cpp to use NEAREST for the min/max filter on the Texture3D, I get the texture I want on the screen.


Here is some code for context:

osg::ref_ptr<osgVolume::Volume> volume = new osgVolume::Volume;

osg::ref_ptr<osgVolume::VolumeTile> tile = new osgVolume::VolumeTile;
volume->addChild(tile.get());

osg::ref_ptr<osg::Image> image_3d = createTexture3D(data,xfer_table);

osg::ref_ptr<osgVolume::ImageLayer> layer = new osgVolume::ImageLayer(image_3d.get());

tile->setLayer(layer.get());

layer->addProperty(new osgVolume::AlphaFuncProperty(0.02f));

osg::ref_ptr<osgVolume:: RayTracedTechnique > technique = new osgVolume:: RayTracedTechnique ();
technique->setNumSlices(200);
tile->setVolumeTechnique(technique);

layer->setMagFilter(osg::Texture3D:: NEAREST);
layer->setMinFilter(osg::Texture3D:: NEAREST);


Here is how the output looks when I edit RayTracedTechnique.cpp to use NEAREST minFilter/magFilter. This is how I expect it to look





Default RayTracedTechnique.cpp (which uses LINEAR minFilter/magFilter): (Not expected)



How can I force the Texture3D object created by RayTracedTechnique to use NEAREST for minFilter/magFiltering?


I'm using OSG 3.0. I know I need to upgrade, but I didn’t see any way to do this even in OSG 3.6


Thanks,
-Sailesh

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Sailesh
Newbie


Joined: 16 Apr 2019
Posts: 2
Location: Boston, United States

PostPosted: Tue Apr 16, 2019 7:49 pm    Post subject:
Reply with quote

Sending the email, messed up where the images were supposed to be.

For reference, 'image001.png' is how the output looks when I edit RayTracedTechnique.cpp to use NEAREST minFilter/magFilter. This is how I expect it to look
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12321

PostPosted: Wed Apr 17, 2019 1:28 pm    Post subject:
Changing minFilter/magFilter of texture in osgVolume::RayTracedTechnique
Reply with quote

Hi Saliesh,


Looking at the code in the 3.6 branch can see that it's hardwired to LINEAR and doesn't check the Layer setting.  I must written the Layer class and then later when I added RayTechnique didn't wire up the Filter settings.  I can't see any reason why it shouldn't work fine to just read the Layer Filter settings and given the public API this is what should be done.  I see that the MultipassTechnique and FixedFunctionTechnique all suffer the same hard wring.  Clearly it's something that I missed when developing osgVolume.  It's quite a niche tool so only a small % of the community use it so assume that the hardwired defaults have been fine for those that have used it as I don't recall this limitation being raised before.


I think the best step is to fix the 3.6 and 3.4 branches, and 3.0 too 3.2 if you really want to continue using the much older releases.  Feel free to fix this and generate a PR on github, if not please generate a Issue on github so that I don't forgot to look at it next time I'm doing bug fixing/updates on the OSG side.



Cheers,

Robert.

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts I want to move the texture to rain. H... robertosfield General 4 Thu Jul 25, 2019 12:06 am View latest post
No new posts 回复: Is it possible to load text... GarfieldPig General 118 Fri May 10, 2019 4:32 pm View latest post
No new posts Is it possible to load texture withou... robertosfield General 9 Thu May 09, 2019 8:29 pm View latest post
No new posts Is it possible to load texture withou... DrPowers General 0 Thu May 09, 2019 3:30 pm View latest post
No new posts Is it possible to load texture withou... DrPowers General 0 Thu May 09, 2019 3:29 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP