SamplePerPixels

Hello,
how can one increase the sample per pixel?
I al having artifacts in the limit between spheric glyphs and a clip (of volumetric data) that is semi transparent where I have some pixels that are completly trasparent/empty. here as it can be seen in the screenshot of the exported image, in inkscape with a red square under (you can see the perfectly ‘red’ pixels around the sphere)
there are also some on the other spheres.

Hi @otaolafr

I did not succeeded to get the artifact with wavelet slice and glyph spheres.
Could you please share steps to reproduce the artifacts?

Best,

Hello francois,
here is my complete script nothing fancy at all…

#######
# importing libraries
#######

from paraview.simple import *
import numpy as np
import os
import time
import sys
import subprocess
from paraview.servermanager import *
from vtk.numpy_interface import dataset_adapter as dsa

from paraview import python_view
imageResolution=[2832, 1053]
#######
# definition of variables
#######

foamFile='sim.foam'
casePath=str(__file__).replace('\\','/')
casePath=casePath.replace(casePath.split('/')[-1],'')
path=casePath+foamFile

#######
# creating different filters and reading case data
#######

simfoam = OpenFOAMReader(registrationName=foamFile, FileName=path)

try:
    simfoam.MeshRegions = ['internalMesh', 'lagrangian/cellCloud', 'lagrangian/bubbleCloud']
except:
    simfoam.MeshRegions = ['internalMesh', 'lagrangian/cellCloud']
    sys.exit(0)


try:
    os.makedirs(casePath+'/screenshots')
except:
    pass

animationScene1 = GetAnimationScene()

renderView1 = GetActiveViewOrCreate('RenderView')
renderView1.ResetActiveCameraToPositiveY()
renderView1.ResetCamera(-0.5, 0.5, -0.007799999788403511, 0.0, 0.0, 0.6899999976158142, True, 0.9)
renderView1.OrientationAxesVisibility = 0
renderView1.ViewSize = imageResolution

# recovering time step from args of script
try:
    timeForImage=float(sys.argv[1])
    animationScene1.AnimationTime = timeForImage
    fileName=sys.argv[1]
    print('setting time step to '+fileName)
except:
    # if no extra arg was given, it goes to last time step
    animationScene1.GoToLast()
    fileName='test'
    pass


# filter for removing internal boundaries in a parallel mesh
# d31 = D3(registrationName='D31', Input=simfoam)
d31 = simfoam

#getting min max values
axes=['X Axis','Y Axis','Z Axis']
direction=[0,1,2]
boundingBox = [BoundingRuler(registrationName='bounding ruler '+axis, Input=simfoam, Axis = axis) for axis in axes]
XYZLimits = [Fetch(limit) for limit in boundingBox]
[[xMin,xMax],[yMin,yMax],[zMin,zMax]]=[[limit.GetPoint(0)[direction[nAxis]],limit.GetPoint(1)[nAxis]] for nAxis,limit in enumerate(XYZLimits)]

# extracting different parts of the mesh
internalMesh    = ExtractBlock(registrationName='internalMesh', Input=d31,Selectors=['/Root/internalMesh'])
cellCloud       = ExtractBlock(registrationName='cellCloud', Input=d31, Selectors=['/Root/lagrangian/cellCloud'])
bubbleCloud     = ExtractBlock(registrationName='bubbleCloud', Input=d31, Selectors=['/Root/lagrangian/bubbleCloud'])


slice1 = Slice(registrationName='Slice1', Input=simfoam)
slice1.SliceType.Normal = [0.0, 1.0, 0.0]
slice1Display = Show(slice1, renderView1, 'GeometryRepresentation', Representation = 'Surface')
ColorBy(slice1Display, ('POINTS', 'U', 'Magnitude'))
slice1Display.RescaleTransferFunctionToDataRange(True, False)
slice1Display.SetScalarBarVisibility(renderView1, True)
slice1Display.Opacity = 0.5

uLUT = GetColorTransferFunction('U')
uLUTColorBar = GetScalarBar(uLUT, renderView1)
uLUTColorBar.TitleFontSize = 30
uLUTColorBar.LabelFontSize = 30
uLUTColorBar.TitleColor = [0.0, 0.0, 0.0]
uLUTColorBar.LabelColor = [0.0, 0.0, 0.0]
uLUTColorBar.TitleBold = 1
uLUTColorBar.LabelBold = 1

glyph1 = Glyph(registrationName='Glyph1', Input=bubbleCloud,
                GlyphType='Sphere',OrientationArray = ['POINTS', 'No orientation array'], ScaleArray = ['POINTS', 'd'], ScaleFactor = 1.0, GlyphMode = 'All Points',)
glyph1Display = Show(glyph1, renderView1, 'GeometryRepresentation')
glyph1.ScaleFactor = 1.0
glyph1.GlyphType.Radius = 1
glyph1.GlyphType.ThetaResolution = 20
glyph1.GlyphType.PhiResolution = 20

SaveScreenshot(filename=casePath+'/screenshots/'+fileName+'.png', viewOrLayout=renderView1, location=16, ImageResolution=imageResolution,
    TransparentBackground=1, CompressionLevel='1')

here is the data:
https://filesender.renater.fr/?s=download&token=35a46012-723a-4cc5-b93e-e16a576db340

regards

Thanks for sharing the data, I can now reproduce easily it with wavelet and sphere glyphs:

image

The issue happens when a 0.5 opacity slice is behind the spheres AND save screenshot with transparent background. Could you please open an issue at https://gitlab.kitware.com/paraview/paraview/-/issues ?

Thanks !

2 Likes

done :), with a simple case to reproduce the issue https://gitlab.kitware.com/paraview/paraview/-/issues/22558
regards francois

2 Likes