Package 'nativeshadr'

Title: Introduction of 'HLSL' Syntax to 'Rcpp'
Description: Brings 'HLSL'-like syntax to 'Rcpp' codes via the 'HLSL++' library <https://github.com/redorav/hlslpp>.
Authors: Akiru Kato [aut, cre], Emilio López [cph] (Author of the 'HLSL++' library)
Maintainer: Akiru Kato <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-05-31 06:09:15 UTC
Source: https://github.com/paithiov909/nativeshadr

Help Index


ASCII filter

Description

ASCII filter

Usage

ascii_filter(nr, sc_factor = 128, intensity = 0.8)

Arguments

nr

A nativeRaster object.

sc_factor

A numeric scalar; the scale factor.

intensity

A numeric scalar; the intensity of filter edge. Set to 0 to disable the filter.

Value

A nativeRaster object.


Deformation

Description

Deforms the image by sampling it at uv + float2(sin(uv.y * freq.x) * amp.x, cos(uv.x * freq.y) * amp.y).

Usage

deform(nr, freq = c(10, 10), amp = c(0.1, 0.1))

Arguments

nr

A nativeRaster object.

freq

A numeric vector of length 2; the frequency of the deformation.

amp

A numeric vector of length 2; the amplitude of the deformation.

Value

A nativeRaster object.


Godray effect

Description

Godray effect

Usage

godray(
  nr,
  parallel = FALSE,
  angle = pi/6,
  center = c(0, 0),
  gain = 0.5,
  lacunarity = 2.5,
  alpha = 1,
  octaves = 5,
  time = 0
)

Arguments

nr

A nativeRaster object.

parallel

A logical scalar; whether to use parallel lighting.

angle

A numeric scalar; the angle of the light. If parallel is FALSE, this is ignored.

center

A numeric vector of length 2; the offset coordinates to roughly change the position of the light. If parallel is TRUE, this is ignored.

gain

A numeric scalar; the gain of the effect.

lacunarity

A numeric scalar; the lacunarity of the effect.

alpha

A numeric scalar; the alpha of the effect.

octaves

A numeric scalar; the octaves of turbulence.

time

A numeric scalar; ellapsed time.

Value

A nativeRaster object.


Multiply turbulence to the image

Description

Multiply turbulence to the image

Usage

gritty_shade(
  nr,
  lacunarity = 2,
  gain = 1.2,
  intensity = 0.4,
  octaves = 5,
  time = 0
)

Arguments

nr

A nativeRaster object.

lacunarity

A numeric scalar; the lacunarity of the effect.

gain

A numeric scalar; the gain of the effect.

intensity

A numeric scalar; the intensity of the effect.

octaves

A numeric scalar; the octaves of turbulence.

time

A numeric scalar; ellapsed time.

Value

A nativeRaster object.


Retro look effect

Description

Retro look effect

Usage

retro_filter(nr, asp = rev(dim(nr)/100), distort = TRUE, time = 0)

Arguments

nr

A nativeRaster object.

asp

A numeric vector of length 2; factor to scale the offset of vignette effect.

distort

A logical scalar; whether to apply barrel distortion.

time

A numeric scalar; ellapsed time.

Value

A nativeRaster object.


Chromatic aberration effect

Description

Chromatic aberration effect

Usage

rgb_split(nr, r = c(0.01, 0), g = c(0, 0.01), b = c(0, 0))

Arguments

nr

A nativeRaster object.

r, g, b

A numeric vector of length 6; X and Y offsets for the red, green and blue channels (in uv coordinates).

Value

A nativeRaster object.


Ripple effect

Description

Adds a ripple effect to the image by sampling it at uv + sin(length(uv - center) * freq) * amp.

Usage

ripple(nr, center = rev(dim(nr))/2, freq = 50, amp = 0.01)

Arguments

nr

A nativeRaster object.

center

A numeric vector of length 2. The distortion of the effect increases the farther they are from this point.

freq

A numeric scalar; the frequency of the effect.

amp

A numeric scalar; the amplitude of the effect.

Value

A nativeRaster object.


Shockwave effect

Description

Shockwave effect

Usage

shockwave(
  nr,
  center = rev(dim(nr))/2,
  speed = log(min(dim(nr))),
  amp = 50,
  wave_length = 160,
  brigthness = 1,
  radius = -1,
  time = 1
)

Arguments

nr

A nativeRaster object.

center

A numeric vector of length 2; the center coordinates where the shockwave starts.

speed

A numeric scalar; the speed about the shockwave ripples out (in pixels per time).

amp

A numeric scalar; the amplitude of the shockwave.

wave_length

A numeric scalar; the wave length of the shockwave.

brigthness

A numeric scalar; the brigthness of the shockwave.

radius

A numeric scalar; The maximum radius of the shockwave. Set to -1 for infinite radius.

time

A numeric scalar; ellapsed time.

Value

A nativeRaster object.


Twist effect

Description

Twist effect

Usage

twist(nr, offset = rev(dim(nr))/2, angle = pi, radius = 100, padding = 0)

Arguments

nr

A nativeRaster object.

offset

A numeric vector of length 2; the offset coordinates to change the position of the center of the effect.

angle

A numeric scalar; the angle of the twist.

radius

A numeric scalar; the radius of the twist.

padding

A numeric scalar; padding for the filter area.

Value

A nativeRaster object.