# SamplePerPixels

**URL:** https://discourse.paraview.org/t/sampleperpixels/14297
**Category:** ParaView Support
**Created:** [March 29, 2024, 1:03pm UTC](https://discourse.paraview.org/t/sampleperpixels/14297 "2024-03-29T13:03:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![otaolafr](https://discourse.paraview.org/user_avatar/discourse.paraview.org/otaolafr/32/3595_2.png) [@otaolafr](https://discourse.paraview.org/u/otaolafr)
#### Post date: [March 29, 2024, 1:03pm UTC](https://discourse.paraview.org/t/sampleperpixels/14297/1 "2024-03-29T13:03:14Z")

</div>

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.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/c/ccc1938c91b06bc52e84ab0b4c507c186c2a1e72.png)

---

<div class="post-metadata">

### Author: ![Francois\_Mazen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/francois_mazen/32/6483_2.png) [@Francois\_Mazen](https://discourse.paraview.org/u/Francois_Mazen)
#### Post date: [April 2, 2024, 7:46am UTC](https://discourse.paraview.org/t/sampleperpixels/14297/2 "2024-04-02T07:46:59Z")

</div>

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,

---

<div class="post-metadata">

### Author: ![otaolafr](https://discourse.paraview.org/user_avatar/discourse.paraview.org/otaolafr/32/3595_2.png) [@otaolafr](https://discourse.paraview.org/u/otaolafr)
#### Post date: [April 2, 2024, 8:13am UTC](https://discourse.paraview.org/t/sampleperpixels/14297/3 "2024-04-02T08:13:16Z")

</div>

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

```auto
#######
# 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](https://filesender.renater.fr/?s=download&token=35a46012-723a-4cc5-b93e-e16a576db340)

regards

---

<div class="post-metadata">

### Author: ![Francois\_Mazen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/francois_mazen/32/6483_2.png) [@Francois\_Mazen](https://discourse.paraview.org/u/Francois_Mazen)
#### Post date: [April 3, 2024, 8:13am UTC](https://discourse.paraview.org/t/sampleperpixels/14297/4 "2024-04-03T08:13:00Z")

</div>

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

![image](https://discourse.paraview.org/uploads/default/original/2X/6/6ebbcd0a374bcfee45e9d2e2eb5bdaac5c1419b3.png)

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](https://gitlab.kitware.com/paraview/paraview/-/issues) ?

Thanks !

---

<div class="post-metadata">

### Author: ![otaolafr](https://discourse.paraview.org/user_avatar/discourse.paraview.org/otaolafr/32/3595_2.png) [@otaolafr](https://discourse.paraview.org/u/otaolafr)
#### Post date: [April 3, 2024, 11:27am UTC](https://discourse.paraview.org/t/sampleperpixels/14297/5 "2024-04-03T11:27:08Z")

</div>

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