Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isoSurfaceVolumeData does not update surface values #1192

Open
TJRL opened this issue Jan 26, 2022 · 6 comments
Open

isoSurfaceVolumeData does not update surface values #1192

TJRL opened this issue Jan 26, 2022 · 6 comments

Comments

@TJRL
Copy link

TJRL commented Jan 26, 2022

Hi,
I've been trying to create an iso surface of volume data that can be modfied by the user with a range slider. The slider simply updates the attributes of the isoSurfaceVolumeData node. However, it does not update the iso surface. Ive tried to combine it with the triggerRedraw function, but no effect.
Is this a bug, or simply non-existing functionality? In the source (see below) I found the comment 'TODO: Reload node', perhaps suggesting the latter.

fieldChanged : function ( fieldName )
{
switch ( fieldName )
{
case "surfaceValues":
this.uniformFloatArraySurfaceValues._vf.value = this._vf.surfaceValues;
this.uniformFloatArraySurfaceValues.fieldChanged( "value" );
//TODO: Reload node
break;
case "surfaceTolerance":
this.uniformFloatSurfaceTolerance._vf.value = this._vf.surfaceTolerance;
this.uniformFloatSurfaceTolerance.fieldChanged( "value" );
break;
case "contourStepSize":
//TODO: Reload node
break;
}
},

Is there a quick way to modify the source so updating the iso values works real time?

@andreasplesch
Copy link
Contributor

I suspect this is not supported. @aarbelaiz may have an idea. It sometimes works to replace the complete node in the dom, rather than modify the attribute. As a workaround, you could also predefine selectable field values in many nodes, and use the "visible" flag to switch those on and off as necessary.

@aarbelaiz
Copy link
Contributor

I do not recall if real-time changes of iso-values where possible, but as uniform values it should be possible. Later I will try to make an example and look at the code then I will report back.

@TJRL
Copy link
Author

TJRL commented Jan 27, 2022

Thanks. I was attempting this because I saw this being implemented in the virtual natural history museum. It allows the user to modify the threshold value for the surface real time. Pretty neat effect. But the code is not accessible on this website so I couldnt see how it is done.

@andreasplesch
Copy link
Contributor

I recall helping Michael with his great natural history museum. It looks like the solution was to develop a custom ProjectionStyle node "ProjectionVolumeStyleMHH" which includes an isosurface option. You can actually access the code with devtools, using the network tab.

@aarbelaiz
Copy link
Contributor

Yes it seems there is a limitation in field change updates at the VolumeData level nodes. I will require time to think about a better solution, however the following one line change has worked for me:

fieldChanged : function ( fieldName )
{
switch ( fieldName )
{
case "surfaceValues":
this.uniformFloatArraySurfaceValues._vf.value = this._vf.surfaceValues;
this.uniformFloatArraySurfaceValues.fieldChanged( "value" );
//TODO: Reload node
break;
case "surfaceTolerance":
this.uniformFloatSurfaceTolerance._vf.value = this._vf.surfaceTolerance;
this.uniformFloatSurfaceTolerance.fieldChanged( "value" );
break;
case "contourStepSize":
//TODO: Reload node
break;
}
this.vrcSinglePassShader.nodeChanged();
},

Just add this.vrcSinglePassShader.nodeChanged(); to the fieldChanged function and changes in the surfaceValues will be reflected in real-time.

@TJRL
Copy link
Author

TJRL commented Jan 28, 2022

@aarbelaiz That works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants