Class VolumeCalcEffect

  • All Implemented Interfaces:
    java.io.Serializable, WildMagic.LibGraphics.ObjectSystem.NameIdInterface, WildMagic.LibGraphics.ObjectSystem.StreamInterface

    public class VolumeCalcEffect
    extends VolumeClipEffect
    implements WildMagic.LibGraphics.ObjectSystem.StreamInterface
    ShaderEffect class for calculating the volume normals on the GPU. The volume normals are calculated in two passes with two different shaders. The shader code is based on the normal calculation function in RenderViewBase.java. The first pass calculates the fDX, fDY, and fDZ values for the voxels. The second pass calculates the normals as the average of the current voxel normal with it's 6 axis-aligned neighbors. All calculations are done on the GPU, the textures remain on the GPU and are not copied into system memory. After both passes are complete, the texture containing the normals is accessible through the VolumeImage.GetNormalMapTarget() Texture. The VolumeImageViewer class applies the VolumeCalcEffect and maps the output textures to the VolumeImage object normal map texture.
    See Also:
    RenderViewBase.java, VolumeImageViewer.java, Serialized Form
    • Field Detail

      • m_bIsColor

        private boolean m_bIsColor
        When true the volume data is color.
      • m_afMinMax

        private float[] m_afMinMax
        stores the gradient magnitude filter on/off value:
    • Constructor Detail

      • VolumeCalcEffect

        public VolumeCalcEffect​(VolumeImage kVolumeImage,
                                WildMagic.LibGraphics.Rendering.Texture kTexture)
        Create a new VolumeCalcEffect shader with the VolumeImage data. This fn creates the first-pass shader.
        Parameters:
        kVolumeImageA - the shared volume data and textures.
      • VolumeCalcEffect

        public VolumeCalcEffect​(VolumeImage kVolumeImage,
                                VolumeClipEffect kClip)
        For creating the surface mask texture.
        Parameters:
        kVolumeImage - Volume data
        kClip - current clipping state.
      • VolumeCalcEffect

        public VolumeCalcEffect​(VolumeImage kVolumeImage,
                                VolumeClipEffect kClip,
                                boolean bGM)
        For creating the surface mask texture.
        Parameters:
        kVolumeImage - Volume data
        kClip - current clipping state.
    • Method Detail

      • OnLoadPrograms

        public void OnLoadPrograms​(int iPass,
                                   WildMagic.LibGraphics.Shaders.Program pkVProgram,
                                   WildMagic.LibGraphics.Shaders.Program pkPProgram,
                                   WildMagic.LibGraphics.Shaders.Program pkCProgram)
        Overrides:
        OnLoadPrograms in class VolumeClipEffect
      • SetIsoVal

        public void SetIsoVal​(float fVal)
      • SetStepSize

        public void SetStepSize​(float fX,
                                float fY,
                                float fZ)
        Sets the step size shader parameter.
        Parameters:
        kVolumeImage - the shared volume data and textures.
      • SetStepSize

        public void SetStepSize​(VolumeImage kVolumeImage)
        Sets the step size shader parameter.
        Parameters:
        kVolumeImage - the shared volume data and textures.
      • SetVolumeIndex

        public void SetVolumeIndex​(int iIndex)