move fsaa keyword next to ssao and away from dump_modify

we don't need to reallocate the buffers this way
This commit is contained in:
Axel Kohlmeyer
2023-08-17 19:57:46 -04:00
parent 988b121a96
commit 5528cefe0f
3 changed files with 51 additions and 59 deletions

View File

@ -24,7 +24,7 @@ Syntax
* color = atom attribute that determines color of each atom * color = atom attribute that determines color of each atom
* diameter = atom attribute that determines size of each atom * diameter = atom attribute that determines size of each atom
* zero or more keyword/value pairs may be appended * zero or more keyword/value pairs may be appended
* keyword = *atom* or *adiam* or *bond* or *grid* or *line* or *tri* or *body* or *fix* or *size* or *view* or *center* or *up* or *zoom* or *box* or *axes* or *subbox* or *shiny* or *ssao* * keyword = *atom* or *adiam* or *bond* or *grid* or *line* or *tri* or *body* or *fix* or *size* or *view* or *center* or *up* or *zoom* or *box* or *axes* or *subbox* or *shiny* or *fsaa* or *ssao*
.. parsed-literal:: .. parsed-literal::
@ -85,6 +85,8 @@ Syntax
diam = diameter of subdomain lines as fraction of shortest box length diam = diameter of subdomain lines as fraction of shortest box length
*shiny* value = sfactor = shinyness of spheres and cylinders *shiny* value = sfactor = shinyness of spheres and cylinders
sfactor = shinyness of spheres and cylinders from 0.0 to 1.0 sfactor = shinyness of spheres and cylinders from 0.0 to 1.0
*fsaa* arg = yes/no
yes/no = do or do not apply anti-aliasing
*ssao* value = shading seed dfactor = SSAO depth shading *ssao* value = shading seed dfactor = SSAO depth shading
shading = *yes* or *no* = turn depth shading on/off shading = *yes* or *no* = turn depth shading on/off
seed = random # seed (positive integer) seed = random # seed (positive integer)
@ -103,7 +105,7 @@ Syntax
dump_modify dump-ID keyword values ... dump_modify dump-ID keyword values ...
* these keywords apply only to the *image* and *movie* styles and are documented on this page * these keywords apply only to the *image* and *movie* styles and are documented on this page
* keyword = *acolor* or *adiam* or *amap* or *gmap* or *backcolor* or *bcolor* or *bdiam* or *bitrate* or *boxcolor* or *color* or *framerate* or *fsaa* or *gmap* * keyword = *acolor* or *adiam* or *amap* or *gmap* or *backcolor* or *bcolor* or *bdiam* or *bitrate* or *boxcolor* or *color* or *framerate* or *gmap*
* see the :doc:`dump modify <dump_modify>` doc page for more general keywords * see the :doc:`dump modify <dump_modify>` doc page for more general keywords
.. parsed-literal:: .. parsed-literal::
@ -151,8 +153,6 @@ Syntax
R,G,B = red/green/blue numeric values from 0.0 to 1.0 R,G,B = red/green/blue numeric values from 0.0 to 1.0
*framerate* arg = fps *framerate* arg = fps
fps = frames per second for movie fps = frames per second for movie
*fsaa* arg = yes/no
yes/no = do or do not apply anti-aliasing
*gmap* args = identical to *amap* args *gmap* args = identical to *amap* args
Examples Examples
@ -229,7 +229,7 @@ details have to be looked up in the `FFmpeg documentation
described below. described below.
To write out JPEG and PNG format files, you must build LAMMPS with To write out JPEG and PNG format files, you must build LAMMPS with
support for the corresponding JPEG or PNG library. To convert images support for the corresponding JPEG or PNG library. To convert images
into movies, LAMMPS has to be compiled with the -DLAMMPS_FFMPEG into movies, LAMMPS has to be compiled with the -DLAMMPS_FFMPEG
flag. See the :doc:`Build settings <Build_settings>` page for flag. See the :doc:`Build settings <Build_settings>` page for
details. details.
@ -599,13 +599,25 @@ image will appear. The *sfactor* value must be a value 0.0 <=
*sfactor* <= 1.0, where *sfactor* = 1 is a highly reflective surface *sfactor* <= 1.0, where *sfactor* = 1 is a highly reflective surface
and *sfactor* = 0 is a rough non-shiny surface. and *sfactor* = 0 is a rough non-shiny surface.
The *ssao* keyword turns on/off a screen space ambient occlusion .. versionadded:: TBD
(SSAO) model for depth shading. If *yes* is set, then atoms further
away from the viewer are darkened via a randomized process, which is The *fsaa* keyword can be used with the dump image command to improve
perceived as depth. The calculation of this effect can increase the the image quality by enabling full scene anti-aliasing. Internally the
cost of computing the image by roughly 2x. The strength of the effect image is rendered at twice the width and height and then scaled down by
can be scaled by the *dfactor* parameter. If *no* is set, no depth computing the average of each 2x2 block of pixels to produce a single
shading is performed. pixel in the final image at the original size. This produces images with
smoother, less ragged edges. The application of this algorithm can
increase the cost of computing the image by about 3x or more.
The *ssao* keyword turns on/off a screen space ambient occlusion (SSAO)
model for depth shading. If *yes* is set, then atoms further away from
the viewer are darkened via a randomized process, which is perceived as
depth. The strength of the effect can be scaled by the *dfactor*
parameter. If *no* is set, no depth shading is performed. The
calculation of this effect can increase the cost of computing the image
substantially by 5x or more, especially with larger images. When used
in combination with the *fsaa* keyword the computational cost of depth
shading is particularly large.
---------- ----------
@ -959,20 +971,6 @@ frequently.
---------- ----------
.. versionadded:: TBD
The *fsaa* keyword can be used with the dump image command to improve
the image quality by enabling full scene anti-aliasing. Internally the
image is rendered at twice the width and height and then scaled down by
computing the average of each 2x2 block of pixels to produce a single
pixel in the final image at the original size. This produces images with
smoother, less ragged edges. The calculation of this effect can
increase the cost of computing the image by roughly 4x or more,
especially for large images and with large processor counts due to
increased communication cost.
----------
The *gmap* keyword can be used with the dump image command, with its The *gmap* keyword can be used with the dump image command, with its
*grid* keyword, to setup a color map. The color map is used to assign *grid* keyword, to setup a color map. The color map is used to assign
a specific RGB (red/green/blue) color value to an individual grid cell a specific RGB (red/green/blue) color value to an individual grid cell
@ -1067,6 +1065,7 @@ The defaults for the dump_modify keywords specific to dump image and dump movie
* boxcolor = yellow * boxcolor = yellow
* color = 140 color names are pre-defined as listed below * color = 140 color names are pre-defined as listed below
* framerate = 24 * framerate = 24
* fsaa = no
* gmap = min max cf 0.0 2 min blue max red * gmap = min max cf 0.0 2 min blue max red
---------- ----------

View File

@ -1195,6 +1195,7 @@ Freitas
Frenkel Frenkel
Friedrichs Friedrichs
fs fs
fsaa
fsh fsh
fstyle fstyle
fsw fsw

View File

@ -248,10 +248,14 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command"); if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
int width = utils::inumeric(FLERR,arg[iarg+1],false,lmp); int width = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
int height = utils::inumeric(FLERR,arg[iarg+2],false,lmp); int height = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0) error->all(FLERR,"Illegal dump image command");
error->all(FLERR,"Illegal dump image command"); if (image->fsaa) {
image->width = width; image->width = width*2;
image->height = height; image->height = height*2;
} else {
image->width = width;
image->height = height;
}
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"view") == 0) { } else if (strcmp(arg[iarg],"view") == 0) {
@ -345,6 +349,23 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
image->shiny = shiny; image->shiny = shiny;
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"fsaa") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
int aa = utils::logical(FLERR, arg[iarg+1], false, lmp);
if (aa) {
if (!image->fsaa) {
image->width = image->width*2;
image->height = image->height*2;
}
} else {
if (image->fsaa) {
image->width = image->width/2;
image->height = image->height/2;
}
}
image->fsaa = aa;
iarg += 2;
} else if (strcmp(arg[iarg],"ssao") == 0) { } else if (strcmp(arg[iarg],"ssao") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command"); if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
image->ssao = utils::logical(FLERR,arg[iarg+1],false,lmp); image->ssao = utils::logical(FLERR,arg[iarg+1],false,lmp);
@ -1555,35 +1576,6 @@ int DumpImage::modify_param(int narg, char **arg)
return n; return n;
} }
// if antialias state changes, we need to increase the buffer space
// change the (internal) image dimensions and reset the view parameters
if (strcmp(arg[0],"fsaa") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
int aa = utils::logical(FLERR, arg[1], false, lmp);
if (image->fsaa == NO) {
if (aa == YES) {
image->width = image->width*2;
image->height = image->height*2;
// reallocate buffers to make room
image->buffers();
}
} else {
if (aa == NO) {
image->width = image->width/2;
image->height = image->height/2;
box_bounds();
box_center();
view_params();
}
}
image->fsaa = aa;
// reset size based parameters
box_bounds();
box_center();
view_params();
return 2;
}
if (strcmp(arg[0],"bcolor") == 0) { if (strcmp(arg[0],"bcolor") == 0) {
if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
if (atom->nbondtypes == 0) if (atom->nbondtypes == 0)